@@ -1781,6 +1781,46 @@ function isLoopbackAddress(host) {
1781
1781
1782
1782
/***/ } ) ,
1783
1783
1784
+ /***/ 3166 :
1785
+ /***/ ( ( module ) => {
1786
+
1787
+ module . exports = function dedent ( templateStrings ) {
1788
+ var values = [ ] ;
1789
+ for ( var _i = 1 ; _i < arguments . length ; _i ++ ) {
1790
+ values [ _i - 1 ] = arguments [ _i ] ;
1791
+ }
1792
+ var matches = [ ] ;
1793
+ var strings = typeof templateStrings === 'string' ? [ templateStrings ] : templateStrings . slice ( ) ;
1794
+ // 1. Remove trailing whitespace.
1795
+ strings [ strings . length - 1 ] = strings [ strings . length - 1 ] . replace ( / \r ? \n ( [ \t ] * ) $ / , '' ) ;
1796
+ // 2. Find all line breaks to determine the highest common indentation level.
1797
+ for ( var i = 0 ; i < strings . length ; i ++ ) {
1798
+ var match = void 0 ;
1799
+ if ( match = strings [ i ] . match ( / \n [ \t ] + / g) ) {
1800
+ matches . push . apply ( matches , match ) ;
1801
+ }
1802
+ }
1803
+ // 3. Remove the common indentation from all strings.
1804
+ if ( matches . length ) {
1805
+ var size = Math . min . apply ( Math , matches . map ( function ( value ) { return value . length - 1 ; } ) ) ;
1806
+ var pattern = new RegExp ( "\n[\t ]{" + size + "}" , 'g' ) ;
1807
+ for ( var i = 0 ; i < strings . length ; i ++ ) {
1808
+ strings [ i ] = strings [ i ] . replace ( pattern , '\n' ) ;
1809
+ }
1810
+ }
1811
+ // 4. Remove leading whitespace.
1812
+ strings [ 0 ] = strings [ 0 ] . replace ( / ^ \r ? \n / , '' ) ;
1813
+ // 5. Perform interpolation.
1814
+ var string = strings [ 0 ] ;
1815
+ for ( var i = 0 ; i < values . length ; i ++ ) {
1816
+ string += values [ i ] + strings [ i + 1 ] ;
1817
+ }
1818
+ return string ;
1819
+ } ;
1820
+ //# sourceMappingURL=index.js.map
1821
+
1822
+ /***/ } ) ,
1823
+
1784
1824
/***/ 9479 :
1785
1825
/***/ ( ( module , __unused_webpack_exports , __nccwpck_require__ ) => {
1786
1826
@@ -6781,7 +6821,11 @@ const bundleFileBase = (name, importedFiles, mixins, fetcher) => {
6781
6821
} ;
6782
6822
exports . bundleFileBase = bundleFileBase ;
6783
6823
const bundleFile = ( name , sourcePath , mixins ) => {
6784
- return ( 0 , remove_comments_1 . removeComments ) ( ( 0 , exports . bundleFileBase ) ( name , exports . files , mixins , ( fileName ) => fs_1 . default . readFileSync ( path_1 . default . join ( sourcePath , fileName ) ) . toString ( ) ) ) ;
6824
+ const bundled = ( 0 , exports . bundleFileBase ) ( name , exports . files , mixins , ( fileName ) => fs_1 . default . readFileSync ( path_1 . default . join ( sourcePath , fileName ) ) . toString ( ) ) ;
6825
+ const parts = ( 0 , helpers_1 . getFileParts ) ( bundled ) ;
6826
+ return ( 0 , remove_comments_1 . removeComments ) ( parts . prolog , true )
6827
+ + ( 0 , remove_comments_1 . removeComments ) ( parts . plugindef , false )
6828
+ + ( 0 , remove_comments_1 . removeComments ) ( parts . epilog , true ) ;
6785
6829
} ;
6786
6830
exports . bundleFile = bundleFile ;
6787
6831
@@ -6794,7 +6838,7 @@ exports.bundleFile = bundleFile;
6794
6838
"use strict" ;
6795
6839
6796
6840
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
6797
- exports . getAllImports = exports . getImport = exports . requireRegex = void 0 ;
6841
+ exports . getFileParts = exports . getAllImports = exports . getImport = exports . requireRegex = void 0 ;
6798
6842
exports . requireRegex = new RegExp ( [
6799
6843
/ (?: ^ | [ \W ] ) / ,
6800
6844
/ (?: _ _ o r i g i n a l _ ) ? r e q u i r e / ,
@@ -6833,6 +6877,19 @@ const getAllImports = (file) => {
6833
6877
return [ ...imports ] ;
6834
6878
} ;
6835
6879
exports . getAllImports = getAllImports ;
6880
+ const plugindefRegex = / (?< plugindef > ^ f u n c t i o n \s + p l u g i n d e f .* ?^ e n d ) / ms;
6881
+ const getFileParts = ( contents ) => {
6882
+ const plugindefMatch = contents . match ( plugindefRegex ) ;
6883
+ if ( ( plugindefMatch === null || plugindefMatch === void 0 ? void 0 : plugindefMatch . index ) !== undefined ) {
6884
+ const prolog = contents . slice ( 0 , plugindefMatch . index ) ;
6885
+ const epilog = contents . slice ( plugindefMatch . index + plugindefMatch [ 0 ] . length ) ;
6886
+ return { prolog, plugindef : plugindefMatch [ 0 ] , epilog } ;
6887
+ }
6888
+ else {
6889
+ return { prolog : '' , plugindef : '' , epilog : contents } ;
6890
+ }
6891
+ } ;
6892
+ exports . getFileParts = getFileParts ;
6836
6893
6837
6894
6838
6895
/***/ } ) ,
@@ -6885,30 +6942,64 @@ sourceFiles.forEach(file => {
6885
6942
/***/ } ) ,
6886
6943
6887
6944
/***/ 9879 :
6888
- /***/ ( ( __unused_webpack_module , exports ) => {
6945
+ /***/ ( function ( __unused_webpack_module , exports , __nccwpck_require__ ) {
6889
6946
6890
6947
"use strict" ;
6891
6948
6949
+ var __importDefault = ( this && this . __importDefault ) || function ( mod ) {
6950
+ return ( mod && mod . __esModule ) ? mod : { "default" : mod } ;
6951
+ } ;
6892
6952
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
6893
6953
exports . injectExtras = void 0 ;
6954
+ const helpers_1 = __nccwpck_require__ ( 8092 ) ;
6955
+ const child_process_1 = __nccwpck_require__ ( 2081 ) ;
6956
+ const dedent_js_1 = __importDefault ( __nccwpck_require__ ( 3166 ) ) ;
6957
+ const path_1 = __importDefault ( __nccwpck_require__ ( 1017 ) ) ;
6894
6958
const injectExtras = ( name , contents ) => {
6895
- const functionRegex = / ^ ( \s * ) f u n c t i o n \s + p l u g i n d e f / gm;
6896
- const returnRegex = / ^ ( \s * ) r e t u r n / gm;
6897
- const endRegex = / ^ ( \s * ) * e n d / gm;
6898
- const functionMatch = functionRegex . exec ( contents ) ;
6899
- if ( functionMatch ) {
6900
- const functionIndex = functionMatch . index ;
6901
- const returnMatch = returnRegex . exec ( contents . substring ( functionIndex ) ) ;
6902
- const endMatch = endRegex . exec ( contents . substring ( functionIndex ) ) ;
6903
- const index = Math . min ( returnMatch ? returnMatch . index : Infinity , endMatch ? endMatch . index : Infinity ) ;
6904
- const strippedName = name . split ( '.' ) . slice ( 0 , - 1 ) . join ( '' ) ;
6905
- const injection = ` finaleplugin.HashURL = \"https://raw.githubusercontent.com/finale-lua/lua-scripts/master/hash/${ strippedName } .hash\"` ;
6906
- const injectedContents = contents . slice ( 0 , functionIndex + index ) + injection + '\n' + contents . slice ( functionIndex + index ) ;
6907
- return injectedContents ;
6959
+ const parts = ( 0 , helpers_1 . getFileParts ) ( contents ) ;
6960
+ if ( parts . plugindef ) {
6961
+ if ( ! parts . plugindef . includes ( 'finaleplugin.RTFNotes' ) )
6962
+ parts . plugindef = inject ( parts . plugindef , getRTFNotes ( parts . plugindef ) ) ;
6963
+ parts . plugindef = inject ( parts . plugindef , getHashURL ( name ) ) ;
6908
6964
}
6909
- return contents ;
6965
+ return parts . prolog + parts . plugindef + parts . epilog ;
6910
6966
} ;
6911
6967
exports . injectExtras = injectExtras ;
6968
+ const inject = ( contents , injection ) => {
6969
+ if ( injection ) {
6970
+ const returnRegex = / ^ ( \s * ) r e t u r n / gm;
6971
+ const endRegex = / ^ ( \s * ) * e n d / gm;
6972
+ const returnMatch = returnRegex . exec ( contents ) ;
6973
+ const endMatch = endRegex . exec ( contents ) ;
6974
+ const index = Math . min ( returnMatch ? returnMatch . index : Infinity , endMatch ? endMatch . index : Infinity ) ;
6975
+ return contents . slice ( 0 , index ) + injection + '\n' + contents . slice ( index ) ;
6976
+ }
6977
+ else {
6978
+ return contents ;
6979
+ }
6980
+ } ;
6981
+ const getHashURL = ( name ) => {
6982
+ const strippedName = name . split ( '.' ) . slice ( 0 , - 1 ) . join ( '' ) ;
6983
+ return ` finaleplugin.HashURL = "https://raw.githubusercontent.com/finale-lua/lua-scripts/master/hash/${ strippedName } .hash"` ;
6984
+ } ;
6985
+ const getRTFNotes = ( input ) => {
6986
+ let result = '' ;
6987
+ const notesRegex = / (?< = f i n a l e p l u g i n .N o t e s = \[ \[ ) .* (? = \] \] ) / ius;
6988
+ const match = input . match ( notesRegex ) ;
6989
+ if ( match ) {
6990
+ const notes = ( 0 , dedent_js_1 . default ) ( match [ 0 ] ) ;
6991
+ const templateFile = path_1 . default . join ( __dirname , "custom_template.rtf" ) ;
6992
+ const args = [ '-f' , 'markdown' , '-t' , 'rtf' , '-s' , `--template=${ templateFile } ` ] ;
6993
+ const pandocResult = ( 0 , child_process_1 . spawnSync ) ( 'pandoc' , args , { input : notes , encoding : 'utf-8' } ) ;
6994
+ if ( ! pandocResult . error ) {
6995
+ result = pandocResult . stdout . replace ( / f s 2 8 / g, 'fs24' )
6996
+ . replace ( / f s 3 2 / g, 'fs28' )
6997
+ . replace ( / f s 3 6 / g, 'fs32' ) ;
6998
+ result = ` finaleplugin.RTFNotes = [[${ result } ]]` ;
6999
+ }
7000
+ }
7001
+ return result ;
7002
+ } ;
6912
7003
6913
7004
6914
7005
/***/ } ) ,
@@ -6942,12 +7033,16 @@ exports.resolveRequiredFile = resolveRequiredFile;
6942
7033
6943
7034
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
6944
7035
exports . removeComments = void 0 ;
6945
- const removeComments = ( contents ) => {
6946
- return contents
7036
+ const removeComments = ( contents , trimWhitespace ) => {
7037
+ let result = contents
6947
7038
. replace ( / - - \[ \[ [ \s \S ] * ?\] \] / giu, '' )
6948
- . replace ( / (?< ! " ) - - .* $ / gimu, '' )
6949
- . replace ( / \n \n + / gimu, '\n' )
6950
- . replace ( / * $ / gimu, '' ) ;
7039
+ . replace ( / (?< ! " ) - - .* $ / gimu, '' ) ;
7040
+ if ( trimWhitespace ) {
7041
+ result = result
7042
+ . replace ( / \n \n + / gimu, '\n' )
7043
+ . replace ( / * $ / gimu, '' ) ;
7044
+ }
7045
+ return result ;
6951
7046
} ;
6952
7047
exports . removeComments = removeComments ;
6953
7048
@@ -6985,6 +7080,14 @@ module.exports = require("assert");
6985
7080
6986
7081
/***/ } ) ,
6987
7082
7083
+ /***/ 2081 :
7084
+ /***/ ( ( module ) => {
7085
+
7086
+ "use strict" ;
7087
+ module . exports = require ( "child_process" ) ;
7088
+
7089
+ /***/ } ) ,
7090
+
6988
7091
/***/ 2057 :
6989
7092
/***/ ( ( module ) => {
6990
7093
0 commit comments