@intelligentgraphics/ig.gfx.packager 3.1.0-alpha.6 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/build/bin.mjs +1 -2
  2. package/build/bin.mjs.map +1 -1
  3. package/build/{cli-CRt1pnL8.mjs → cli-DIedP7qK.mjs} +8 -14
  4. package/build/cli-DIedP7qK.mjs.map +1 -0
  5. package/build/{dependencies-DzwnAMHr.mjs → dependencies-COlDsLND.mjs} +2 -2
  6. package/build/{dependencies-DzwnAMHr.mjs.map → dependencies-COlDsLND.mjs.map} +1 -1
  7. package/build/{generateIndex-1_US73VT.mjs → generateIndex-C3QM6b_P.mjs} +15 -13
  8. package/build/generateIndex-C3QM6b_P.mjs.map +1 -0
  9. package/build/{generateParameterType-DSWCBqzV.mjs → generateParameterType-BQWvx09Q.mjs} +3 -3
  10. package/build/{generateParameterType-DSWCBqzV.mjs.map → generateParameterType-BQWvx09Q.mjs.map} +1 -1
  11. package/build/{index-BIqEoSQH.mjs → index-DwMieljj.mjs} +7 -7
  12. package/build/{index-BIqEoSQH.mjs.map → index-DwMieljj.mjs.map} +1 -1
  13. package/build/{index-Sj6AX2Pu.mjs → index-DzhYnNye.mjs} +45 -17
  14. package/build/index-DzhYnNye.mjs.map +1 -0
  15. package/build/{postinstall-DLxLg3tD.mjs → postinstall-C--lHX5F.mjs} +4 -4
  16. package/build/{postinstall-DLxLg3tD.mjs.map → postinstall-C--lHX5F.mjs.map} +1 -1
  17. package/build/{publishNpm-ByIPsGI3.mjs → publishNpm-XfGrMd4N.mjs} +6 -6
  18. package/build/{publishNpm-ByIPsGI3.mjs.map → publishNpm-XfGrMd4N.mjs.map} +1 -1
  19. package/build/{rollup-Dspsy6kv.mjs → rollup-C1CqoDDv.mjs} +18 -120
  20. package/build/rollup-C1CqoDDv.mjs.map +1 -0
  21. package/build/{scripts-BmQnbRem.mjs → scripts-B3noxiX3.mjs} +2 -2
  22. package/build/{scripts-BmQnbRem.mjs.map → scripts-B3noxiX3.mjs.map} +1 -1
  23. package/build/{versionFile-CK9FMt3L.mjs → versionFile-DfWPXq6d.mjs} +4 -4
  24. package/build/{versionFile-CK9FMt3L.mjs.map → versionFile-DfWPXq6d.mjs.map} +1 -1
  25. package/lib/lib.mjs +53 -24
  26. package/package.json +4 -5
  27. package/readme.md +81 -43
  28. package/build/cli-CRt1pnL8.mjs.map +0 -1
  29. package/build/generateIndex-1_US73VT.mjs.map +0 -1
  30. package/build/index-Sj6AX2Pu.mjs.map +0 -1
  31. package/build/rollup-Dspsy6kv.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup-C1CqoDDv.mjs","sources":["../src/commands/build/rollup.ts"],"sourcesContent":["import * as path from \"path\";\nimport ts from \"typescript\";\nimport * as os from \"os\";\nimport resolve from \"resolve\";\nimport { rollup, watch, RollupOutput, RollupOptions } from \"rollup\";\nimport rollupPluginNodeResolve from \"@rollup/plugin-node-resolve\";\nimport rollupPluginTypescript from \"@rollup/plugin-typescript\";\nimport rollupPluginBabel from \"@rollup/plugin-babel\";\nimport rollupPluginCommonJs from \"@rollup/plugin-commonjs\";\nimport rollupPluginJson from \"@rollup/plugin-json\";\nimport rollupPluginAlias from \"@rollup/plugin-alias\";\nimport babelPresetEs5 from \"@intelligentgraphics/ig.gfx.packager-babel-preset-es5\";\n\nimport { bundleFromEntryFile } from \"@intelligentgraphics/declarationbundler\";\n\nimport { CreatorPackage, PackageLocation } from \"../../lib/package\";\nimport { BuildArtefacts, BuilderEnvironment, BuildParticipant } from \"./types\";\nimport { resolveScriptPackageEntryModule } from \"../../lib/scripts\";\n\nexport function createRollupBuildParticipant(\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n\toutDir: string,\n\tskipDeclarations: boolean,\n): BuildParticipant {\n\treturn (env: BuilderEnvironment) => {\n\t\tenv.onBuildStart();\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tconst rollupConfig = getRollupConfig(\n\t\t\t\t\tlocation,\n\t\t\t\t\tmanifest,\n\t\t\t\t\toutDir,\n\t\t\t\t\tskipDeclarations,\n\t\t\t\t\tenv,\n\t\t\t\t);\n\n\t\t\t\tconst build = await rollup(rollupConfig);\n\n\t\t\t\tconst output = await build.generate(rollupConfig.output);\n\n\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\ttype: \"success\",\n\t\t\t\t\tartefacts: processRollupOutput(\n\t\t\t\t\t\toutput,\n\t\t\t\t\t\tlocation,\n\t\t\t\t\t\tmanifest,\n\t\t\t\t\t\trollupConfig.input,\n\t\t\t\t\t\tskipDeclarations,\n\t\t\t\t\t),\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\tenv.onBuildEnd({ type: \"error\", error: err });\n\t\t\t}\n\t\t})();\n\n\t\treturn {\n\t\t\tdestroy: () => {},\n\t\t};\n\t};\n}\n\nexport function createRollupWatchBuildParticipant(\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n\toutDir: string,\n\tskipDeclarations: boolean,\n): BuildParticipant {\n\treturn (env: BuilderEnvironment) => {\n\t\tenv.onBuildStart();\n\n\t\tconst rollupConfig = getRollupConfig(\n\t\t\tlocation,\n\t\t\tmanifest,\n\t\t\toutDir,\n\t\t\tskipDeclarations,\n\t\t\tenv,\n\t\t);\n\n\t\tconst watcher = watch({\n\t\t\t...rollupConfig,\n\t\t\twatch: {\n\t\t\t\tskipWrite: true,\n\t\t\t},\n\t\t});\n\n\t\twatcher.on(\"event\", async (event) => {\n\t\t\tswitch (event.code) {\n\t\t\t\tcase \"BUNDLE_START\":\n\t\t\t\t\tenv.onBuildStart();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"BUNDLE_END\":\n\t\t\t\t\tconst output = await event.result.generate(\n\t\t\t\t\t\trollupConfig.output!,\n\t\t\t\t\t);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\t\t\ttype: \"success\",\n\t\t\t\t\t\t\tartefacts: processRollupOutput(\n\t\t\t\t\t\t\t\toutput,\n\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\tmanifest,\n\t\t\t\t\t\t\t\trollupConfig.input,\n\t\t\t\t\t\t\t\tskipDeclarations,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\t\terror: err,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tevent.result.close();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"ERROR\":\n\t\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\terror: Object.assign(\n\t\t\t\t\t\t\tnew Error(event.error.message),\n\t\t\t\t\t\t\tevent.error,\n\t\t\t\t\t\t),\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tdestroy: () => watcher.close(),\n\t\t};\n\t};\n}\n\nfunction getRollupConfig(\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n\toutDir: string,\n\tskipDeclarations: boolean,\n\tenv: BuilderEnvironment,\n) {\n\tconst entryModule = resolveScriptPackageEntryModule(location, manifest);\n\n\tif (entryModule === undefined) {\n\t\tthrow new Error(`Could not find an entry module`);\n\t}\n\n\treturn {\n\t\tinput: entryModule,\n\t\tplugins: [\n\t\t\trollupPluginNodeResolve(),\n\t\t\trollupPluginCommonJs(),\n\t\t\trollupPluginJson(),\n\t\t\trollupPluginAlias({\n\t\t\t\tentries: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfind: /^core-js(.*)/,\n\t\t\t\t\t\treplacement: path.join(\n\t\t\t\t\t\t\tpath.dirname(\n\t\t\t\t\t\t\t\tresolve.sync(\"core-js\", {\n\t\t\t\t\t\t\t\t\tbasedir: import.meta.dirname,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\"/$1\",\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}),\n\t\t\trollupPluginTypescript({\n\t\t\t\tcompilerOptions: {\n\t\t\t\t\trootDir: skipDeclarations ? undefined : location.scriptsDir,\n\t\t\t\t\tdeclaration: !skipDeclarations,\n\t\t\t\t\tdeclarationDir: skipDeclarations ? undefined : outDir,\n\t\t\t\t\tmodule: \"esnext\",\n\t\t\t\t\ttarget: \"esnext\",\n\t\t\t\t},\n\t\t\t\ttsconfig: path.join(location.scriptsDir, \"tsconfig.json\"),\n\t\t\t\tremoveComments: false,\n\t\t\t\tfilterRoot: skipDeclarations ? false : undefined,\n\t\t\t\tincremental: false,\n\t\t\t\tnoEmitOnError: false,\n\t\t\t}),\n\t\t\trollupPluginBabel({\n\t\t\t\tpresets: [[babelPresetEs5, {}]],\n\t\t\t\ttargets: {\n\t\t\t\t\tie: \"11\",\n\t\t\t\t},\n\t\t\t\tbabelHelpers: \"bundled\",\n\t\t\t\textensions: [\".ts\", \".js\"],\n\t\t\t\tsourceMaps: true,\n\t\t\t\texclude: /core-js/,\n\t\t\t}),\n\t\t],\n\t\toutput: {\n\t\t\tformat: \"iife\",\n\t\t\tname: manifest.Scope ?? manifest.Package,\n\t\t\tdir: outDir,\n\t\t\tsourcemap: \"hidden\",\n\t\t},\n\t\tonLog: createLogger(env),\n\t} satisfies RollupOptions;\n}\n\nfunction createLogger(env: BuilderEnvironment): RollupOptions[\"onLog\"] {\n\treturn (level, log, _handler) => {\n\t\tenv.log(log.message);\n\t};\n}\n\nfunction processRollupOutput(\n\toutput: RollupOutput,\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n\tentryModulePath: string,\n\tskipDeclarations: boolean,\n): BuildArtefacts {\n\tconst [primaryChunk, ...otherOutputs] = output.output;\n\n\tconst assets = otherOutputs.filter((chunk) => chunk.type === \"asset\");\n\n\tconst sourceMap = assets.find((asset) =>\n\t\tasset.fileName.endsWith(\".js.map\"),\n\t);\n\n\tlet declarations: string | undefined;\n\n\tif (!skipDeclarations) {\n\t\tconst declarationFileMap = new Map(\n\t\t\tassets\n\t\t\t\t.filter((asset) => asset.fileName.endsWith(\".d.ts\"))\n\t\t\t\t.map((asset) => {\n\t\t\t\t\treturn [\n\t\t\t\t\t\tpath\n\t\t\t\t\t\t\t.resolve(location.scriptsDir, asset.fileName)\n\t\t\t\t\t\t\t.replaceAll(\"\\\\\", \"/\"),\n\t\t\t\t\t\tasset.source as string,\n\t\t\t\t\t];\n\t\t\t\t}),\n\t\t);\n\n\t\tconst entryModulePathWithDts = path.join(\n\t\t\tpath.dirname(entryModulePath),\n\t\t\tpath.basename(entryModulePath, path.extname(entryModulePath)) +\n\t\t\t\t\".d.ts\",\n\t\t);\n\n\t\tdeclarations = bundleTSDeclarations(\n\t\t\tdeclarationFileMap,\n\t\t\tentryModulePathWithDts,\n\t\t\tmanifest.Scope ?? manifest.Package,\n\t\t);\n\t}\n\n\treturn {\n\t\tjs: primaryChunk.code,\n\t\tdeclarations,\n\t\tsourceMap: sourceMap?.source as string,\n\t};\n}\n\nconst referenceRegex = /(\\/\\/\\/ ?<reference .+\\/>$)/;\n\nfunction bundleTSDeclarations(\n\tfiles: Map<string, string>,\n\tentryFileName: string,\n\tnamespace: string,\n) {\n\tconst references: string[] = [];\n\n\tfor (const [_fileName, content] of files) {\n\t\tif (content.indexOf(\"reference\") === -1) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst lines = content.split(os.EOL);\n\n\t\tfor (let index = 0; index < lines.length; index++) {\n\t\t\tconst line = lines[index];\n\t\t\tconst match = line.match(referenceRegex);\n\n\t\t\tif (match === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!references.includes(match[1])) {\n\t\t\t\treferences.push(match[1]);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst compilerOptions: ts.CompilerOptions = {\n\t\tremoveComments: false,\n\t};\n\n\tconst host = ts.createCompilerHost(compilerOptions, true);\n\thost.fileExists = (fileName) => files.has(fileName);\n\thost.readFile = (fileName) => files.get(fileName);\n\n\tconst program = ts.createProgram({\n\t\thost,\n\t\toptions: compilerOptions,\n\t\trootNames: [entryFileName],\n\t});\n\n\tconst mainFile = program.getSourceFile(entryFileName);\n\n\tif (mainFile === undefined) {\n\t\tthrow new Error(\n\t\t\t`Unexpected: Failed to find compiled declaration entry module`,\n\t\t);\n\t}\n\n\tconst result = bundleFromEntryFile(\n\t\tnamespace,\n\t\tmainFile,\n\t\tprogram,\n\t\thost,\n\t\tprogram.getTypeChecker(),\n\t\tcompilerOptions,\n\t);\n\treturn [...references, result].join(os.EOL);\n}\n"],"names":["createRollupBuildParticipant","location","manifest","outDir","skipDeclarations","env","onBuildStart","rollupConfig","getRollupConfig","build","rollup","output","generate","onBuildEnd","type","artefacts","processRollupOutput","input","err","error","destroy","createRollupWatchBuildParticipant","watcher","watch","skipWrite","on","event","code","result","close","Object","assign","Error","message","entryModule","resolveScriptPackageEntryModule","undefined","plugins","rollupPluginNodeResolve","rollupPluginCommonJs","rollupPluginJson","rollupPluginAlias","entries","find","replacement","path","join","dirname","resolve","sync","basedir","rollupPluginTypescript","compilerOptions","rootDir","scriptsDir","declaration","declarationDir","module","target","tsconfig","removeComments","filterRoot","incremental","noEmitOnError","rollupPluginBabel","presets","babelPresetEs5","targets","ie","babelHelpers","extensions","sourceMaps","exclude","format","name","Scope","Package","dir","sourcemap","onLog","createLogger","level","log","_handler","entryModulePath","primaryChunk","otherOutputs","assets","filter","chunk","sourceMap","asset","fileName","endsWith","declarations","declarationFileMap","Map","map","replaceAll","source","entryModulePathWithDts","basename","extname","bundleTSDeclarations","js","referenceRegex","files","entryFileName","namespace","references","_fileName","content","indexOf","lines","split","os","EOL","index","length","line","match","includes","push","host","ts","createCompilerHost","fileExists","has","readFile","get","program","createProgram","options","rootNames","mainFile","getSourceFile","bundleFromEntryFile","getTypeChecker"],"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AC3B,QAAA,MAAM,IAAIJ,KAAAA,CACT,CAAC,4DAA4D,CAAC,CAAA;AAEhE,IAAA;IAEA,MAAMJ,MAAAA,GAAS4G,oBACd5B,SAAAA,EACA0B,QAAAA,EACAJ,SACAP,IAAAA,EACAO,OAAAA,CAAQO,cAAc,EAAA,EACtBrF,eAAAA,CAAAA;IAED,OAAO;AAAIyD,QAAAA,GAAAA,UAAAA;AAAYjF,QAAAA;KAAO,CAACkB,IAAI,CAACqE,EAAAA,CAAGC,GAAG,CAAA;AAC3C;;;;"}
@@ -3,7 +3,7 @@ import * as fs from 'fs';
3
3
  import * as path from 'path';
4
4
  import ts from 'typescript';
5
5
  import 'resolve';
6
- import 'write-pkg';
6
+ import 'write-package';
7
7
  import 'axios';
8
8
 
9
9
  const getPackageTypescriptFiles = (location)=>glob.sync("**/*.ts", {
@@ -42,4 +42,4 @@ function isScriptPackageModules(options) {
42
42
  }
43
43
 
44
44
  export { resolveScriptPackageEntryModule as a, getPackageTypescriptFiles as g, isScriptPackageModules as i, readScriptPackageTSConfig as r };
45
- //# sourceMappingURL=scripts-BmQnbRem.mjs.map
45
+ //# sourceMappingURL=scripts-B3noxiX3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"scripts-BmQnbRem.mjs","sources":["../../tools.core/build/scripts.mjs","../src/lib/scripts.ts"],"sourcesContent":["import * as glob from 'glob';\n\nconst getPackageTypescriptFiles = (location)=>glob.sync(\"**/*.ts\", {\n absolute: true,\n cwd: location.scriptsDir,\n ignore: \"node_modules/**/*\"\n });\n\nexport { getPackageTypescriptFiles };\n//# sourceMappingURL=scripts.mjs.map\n","import * as fs from \"fs\";\nimport * as path from \"path\";\nimport ts from \"typescript\";\n\nimport {\n\tCreatorPackage,\n\tPackageLocation,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nexport { getPackageTypescriptFiles } from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nexport function resolveScriptPackageEntryModule(\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n) {\n\tlet candidates = [\"index.ts\"];\n\n\tif (manifest.Type === \"Context\") {\n\t\tcandidates.push(\"Context.ts\");\n\t}\n\n\tfor (const candidate of candidates) {\n\t\tconst candidatePath = path.join(location.scriptsDir, candidate);\n\n\t\tif (fs.existsSync(candidatePath)) {\n\t\t\treturn candidatePath;\n\t\t}\n\t}\n}\n\nexport function readScriptPackageTSConfig(location: PackageLocation) {\n\tconst { config } = ts.readConfigFile(\n\t\tpath.join(location.scriptsDir, \"tsconfig.json\"),\n\t\t(path) => {\n\t\t\ttry {\n\t\t\t\treturn fs.readFileSync(path, \"utf8\");\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t);\n\n\tconst parsedTsConfig = ts.parseJsonConfigFileContent(\n\t\tconfig,\n\t\tts.sys,\n\t\tlocation.scriptsDir,\n\t);\n\n\treturn parsedTsConfig;\n}\n\nexport function isScriptPackageModules(options: ts.CompilerOptions) {\n\treturn options.module === ts.ModuleKind.ES2015;\n}\n"],"names":["getPackageTypescriptFiles","location","glob","sync","absolute","cwd","scriptsDir","ignore","resolveScriptPackageEntryModule","manifest","candidates","Type","push","candidate","candidatePath","path","join","fs","existsSync","readScriptPackageTSConfig","config","ts","readConfigFile","readFileSync","undefined","parsedTsConfig","parseJsonConfigFileContent","sys","isScriptPackageModules","options","module","ModuleKind","ES2015"],"mappings":";;;;;;;;MAIaA,yBAAAA,GAA4B,CAACC,QAAAA,GACzCC,IAAAA,CAAKC,IAAI,CAAC,SAAA,EAAW;AACpBC,QAAAA,QAAAA,EAAU,IAAA;QACVC,GAAAA,EAAKJ,SAASK,UAAU;AACxBC,QAAAA,MAAAA,EAAQ;AACT,KAAA;;ACEM,SAASC,+BAAAA,CACfP,QAAyB,EACzBQ,QAAwB,EAAA;AAExB,IAAA,IAAIC,UAAAA,GAAa;AAAC,QAAA;AAAW,KAAA;IAE7B,IAAID,QAAAA,CAASE,IAAI,KAAK,SAAA,EAAW;AAChCD,QAAAA,UAAAA,CAAWE,IAAI,CAAC,YAAA,CAAA;AACjB,IAAA;IAEA,KAAK,MAAMC,aAAaH,UAAAA,CAAY;AACnC,QAAA,MAAMI,gBAAgBC,IAAAA,CAAKC,IAAI,CAACf,QAAAA,CAASK,UAAU,EAAEO,SAAAA,CAAAA;QAErD,IAAII,EAAAA,CAAGC,UAAU,CAACJ,aAAAA,CAAAA,EAAgB;YACjC,OAAOA,aAAAA;AACR,QAAA;AACD,IAAA;AACD;AAEO,SAASK,0BAA0BlB,QAAyB,EAAA;AAClE,IAAA,MAAM,EAAEmB,MAAM,EAAE,GAAGC,GAAGC,cAAc,CACnCP,IAAAA,CAAKC,IAAI,CAACf,QAAAA,CAASK,UAAU,EAAE,kBAC/B,CAACS,IAAAA,GAAAA;QACA,IAAI;YACH,OAAOE,EAAAA,CAAGM,YAAY,CAACR,IAAAA,EAAM,MAAA,CAAA;AAC9B,QAAA,CAAA,CAAE,OAAM;YACP,OAAOS,SAAAA;AACR,QAAA;AACD,IAAA,CAAA,CAAA;IAGD,MAAMC,cAAAA,GAAiBJ,GAAGK,0BAA0B,CACnDN,QACAC,EAAAA,CAAGM,GAAG,EACN1B,QAAAA,CAASK,UAAU,CAAA;IAGpB,OAAOmB,cAAAA;AACR;AAEO,SAASG,uBAAuBC,OAA2B,EAAA;AACjE,IAAA,OAAOA,QAAQC,MAAM,KAAKT,EAAAA,CAAGU,UAAU,CAACC,MAAM;AAC/C;;;;"}
1
+ {"version":3,"file":"scripts-B3noxiX3.mjs","sources":["../../tools.core/build/scripts.mjs","../src/lib/scripts.ts"],"sourcesContent":["import * as glob from 'glob';\n\nconst getPackageTypescriptFiles = (location)=>glob.sync(\"**/*.ts\", {\n absolute: true,\n cwd: location.scriptsDir,\n ignore: \"node_modules/**/*\"\n });\n\nexport { getPackageTypescriptFiles };\n//# sourceMappingURL=scripts.mjs.map\n","import * as fs from \"fs\";\nimport * as path from \"path\";\nimport ts from \"typescript\";\n\nimport {\n\tCreatorPackage,\n\tPackageLocation,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nexport { getPackageTypescriptFiles } from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nexport function resolveScriptPackageEntryModule(\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n) {\n\tlet candidates = [\"index.ts\"];\n\n\tif (manifest.Type === \"Context\") {\n\t\tcandidates.push(\"Context.ts\");\n\t}\n\n\tfor (const candidate of candidates) {\n\t\tconst candidatePath = path.join(location.scriptsDir, candidate);\n\n\t\tif (fs.existsSync(candidatePath)) {\n\t\t\treturn candidatePath;\n\t\t}\n\t}\n}\n\nexport function readScriptPackageTSConfig(location: PackageLocation) {\n\tconst { config } = ts.readConfigFile(\n\t\tpath.join(location.scriptsDir, \"tsconfig.json\"),\n\t\t(path) => {\n\t\t\ttry {\n\t\t\t\treturn fs.readFileSync(path, \"utf8\");\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t);\n\n\tconst parsedTsConfig = ts.parseJsonConfigFileContent(\n\t\tconfig,\n\t\tts.sys,\n\t\tlocation.scriptsDir,\n\t);\n\n\treturn parsedTsConfig;\n}\n\nexport function isScriptPackageModules(options: ts.CompilerOptions) {\n\treturn options.module === ts.ModuleKind.ES2015;\n}\n"],"names":["getPackageTypescriptFiles","location","glob","sync","absolute","cwd","scriptsDir","ignore","resolveScriptPackageEntryModule","manifest","candidates","Type","push","candidate","candidatePath","path","join","fs","existsSync","readScriptPackageTSConfig","config","ts","readConfigFile","readFileSync","undefined","parsedTsConfig","parseJsonConfigFileContent","sys","isScriptPackageModules","options","module","ModuleKind","ES2015"],"mappings":";;;;;;;;MAIaA,yBAAAA,GAA4B,CAACC,QAAAA,GACzCC,IAAAA,CAAKC,IAAI,CAAC,SAAA,EAAW;AACpBC,QAAAA,QAAAA,EAAU,IAAA;QACVC,GAAAA,EAAKJ,SAASK,UAAU;AACxBC,QAAAA,MAAAA,EAAQ;AACT,KAAA;;ACEM,SAASC,+BAAAA,CACfP,QAAyB,EACzBQ,QAAwB,EAAA;AAExB,IAAA,IAAIC,UAAAA,GAAa;AAAC,QAAA;AAAW,KAAA;IAE7B,IAAID,QAAAA,CAASE,IAAI,KAAK,SAAA,EAAW;AAChCD,QAAAA,UAAAA,CAAWE,IAAI,CAAC,YAAA,CAAA;AACjB,IAAA;IAEA,KAAK,MAAMC,aAAaH,UAAAA,CAAY;AACnC,QAAA,MAAMI,gBAAgBC,IAAAA,CAAKC,IAAI,CAACf,QAAAA,CAASK,UAAU,EAAEO,SAAAA,CAAAA;QAErD,IAAII,EAAAA,CAAGC,UAAU,CAACJ,aAAAA,CAAAA,EAAgB;YACjC,OAAOA,aAAAA;AACR,QAAA;AACD,IAAA;AACD;AAEO,SAASK,0BAA0BlB,QAAyB,EAAA;AAClE,IAAA,MAAM,EAAEmB,MAAM,EAAE,GAAGC,GAAGC,cAAc,CACnCP,IAAAA,CAAKC,IAAI,CAACf,QAAAA,CAASK,UAAU,EAAE,kBAC/B,CAACS,IAAAA,GAAAA;QACA,IAAI;YACH,OAAOE,EAAAA,CAAGM,YAAY,CAACR,IAAAA,EAAM,MAAA,CAAA;AAC9B,QAAA,CAAA,CAAE,OAAM;YACP,OAAOS,SAAAA;AACR,QAAA;AACD,IAAA,CAAA,CAAA;IAGD,MAAMC,cAAAA,GAAiBJ,GAAGK,0BAA0B,CACnDN,QACAC,EAAAA,CAAGM,GAAG,EACN1B,QAAAA,CAASK,UAAU,CAAA;IAGpB,OAAOmB,cAAAA;AACR;AAEO,SAASG,uBAAuBC,OAA2B,EAAA;AACjE,IAAA,OAAOA,QAAQC,MAAM,KAAKT,EAAAA,CAAGU,UAAU,CAACC,MAAM;AAC/C;;;;"}
@@ -1,10 +1,10 @@
1
1
  import simpleGit from 'simple-git';
2
2
  import * as path from 'path';
3
- import { P as PackageVersion } from './index-Sj6AX2Pu.mjs';
3
+ import { P as PackageVersion } from './index-DzhYnNye.mjs';
4
4
  import * as fs from 'fs';
5
5
  import 'resolve';
6
- import 'write-pkg';
7
- import { i as isErrorENOENT } from './cli-CRt1pnL8.mjs';
6
+ import 'write-package';
7
+ import { i as isErrorENOENT } from './cli-DIedP7qK.mjs';
8
8
  import 'glob';
9
9
  import 'axios';
10
10
 
@@ -203,4 +203,4 @@ const createYearString = (years)=>{
203
203
  };
204
204
 
205
205
  export { parseVersionFromString as a, getVersionInformationFromGit as b, getWorkspaceBannerText as c, getVersionFileHandler as g, parseVersionFromNumericVersion as p };
206
- //# sourceMappingURL=versionFile-CK9FMt3L.mjs.map
206
+ //# sourceMappingURL=versionFile-DfWPXq6d.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"versionFile-CK9FMt3L.mjs","sources":["../../tools.core/build/fs.mjs","../src/lib/git.ts","../src/lib/banner.ts","../src/lib/parseVersion.ts","../src/lib/versionFile.ts"],"sourcesContent":["import * as fs from 'fs';\nimport { isErrorENOENT } from './error.mjs';\n\nconst readStringFromFile = (filePath)=>fs.readFileSync(filePath, {\n encoding: \"utf8\"\n });\nconst readStringFromFileOrUndefined = (filePath)=>{\n try {\n return readStringFromFile(filePath);\n } catch (err) {\n if (!isErrorENOENT(err)) {\n throw err;\n }\n return undefined;\n }\n};\n\nexport { readStringFromFile, readStringFromFileOrUndefined };\n//# sourceMappingURL=fs.mjs.map\n","import simpleGit from \"simple-git\";\nimport * as path from \"path\";\n\nimport { WorkspaceLocation } from \"./workspace\";\nimport { PackageLocation } from \"./package\";\n\nexport const getVersionInformationFromGit = async (\n\tworkspaceLocation: WorkspaceLocation,\n\tpackageLocation: PackageLocation,\n) => {\n\ttry {\n\t\tconst git = simpleGit({\n\t\t\tbaseDir: workspaceLocation.path,\n\t\t});\n\n\t\t// check wether the files for a folder are changed\n\t\t// if so, mark as dirty\n\t\tconst diff = await git.diffSummary();\n\n\t\tconst dirty = diff.files.some((file) => {\n\t\t\tif (\n\t\t\t\tfile.file.toLowerCase().includes(\"releases\") ||\n\t\t\t\tfile.file.toLowerCase().endsWith(\"version.ts\") ||\n\t\t\t\tfile.file.toLowerCase().endsWith(\"package.json\")\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst fullPath = path.resolve(workspaceLocation.path, file.file);\n\t\t\tconst relativePath = path.relative(packageLocation.path, fullPath);\n\n\t\t\treturn !relativePath.startsWith(\"..\");\n\t\t});\n\n\t\tconst log = await git.log({ maxCount: 1 });\n\t\tconst commit = !log.latest?.hash\n\t\t\t? undefined\n\t\t\t: log.latest.hash.substring(0, 7);\n\n\t\treturn {\n\t\t\tcommit,\n\t\t\tdirty,\n\t\t\tcommitDate: log.latest?.date,\n\t\t};\n\t} catch (err) {\n\t\treturn {};\n\t}\n};\n","import { WorkspacePackageJSON } from \"./workspace\";\n\nexport const getWorkspaceBannerText = (manifest: WorkspacePackageJSON) => {\n\tlet bannerText = manifest?.packager?.banner;\n\n\tif (bannerText) {\n\t\tconst match = bannerText.match(/Copyright \\(C\\) (\\d+)( ?- ?(\\d+))?/);\n\n\t\tif (match !== null) {\n\t\t\tconst startYear = parseInt(match[1]);\n\t\t\tconst endYear = new Date().getFullYear();\n\n\t\t\tif (startYear !== endYear) {\n\t\t\t\tbannerText = bannerText.replace(\n\t\t\t\t\tmatch[0],\n\t\t\t\t\t`Copyright (C) ${startYear} - ${endYear}`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbannerText = bannerText.replace(\n\t\t\t\t\tmatch[0],\n\t\t\t\t\t`Copyright (C) ${startYear}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn bannerText;\n};\n","import { PackageVersion } from \"./packageVersion\";\n\nexport const parseVersionFromString = (input: string) => {\n\tif (input === undefined) {\n\t\tthrow new Error(`Can not parse version from undefined`);\n\t}\n\n\tlet match: RegExpMatchArray | null;\n\n\tlet major!: string;\n\tlet minor!: string;\n\tlet patch!: string;\n\tlet build: string | undefined;\n\tlet preReleaseType: string | undefined;\n\tlet preReleaseNumber: string | undefined;\n\n\tif (\n\t\t// first try to find a full match with build number\n\t\t(match = input.match(\n\t\t\t/(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)(-([^\\.]+)\\.(\\d+))?/,\n\t\t)) !== null\n\t) {\n\t\t[, major, minor, patch, build, preReleaseType, preReleaseNumber] =\n\t\t\tmatch;\n\t} else if (\n\t\t(match = input.match(/(\\d+)\\.(\\d+)\\.(\\d+)(-([^\\.]+)\\.(\\d+))?/)) !== null\n\t) {\n\t\t[, major, minor, patch, , preReleaseType, preReleaseNumber] = match;\n\t}\n\n\tif (match === null) {\n\t\tthrow new Error(`Could not parse version from input: ${input}`);\n\t}\n\n\tlet preRelease: PackageVersion[\"preRelease\"] = undefined;\n\tlet buildNumber = 100;\n\n\tif (preReleaseType && preReleaseNumber) {\n\t\tpreRelease = {\n\t\t\ttype: preReleaseType,\n\t\t\tversion: parseInt(preReleaseNumber),\n\t\t};\n\t}\n\n\tif (build) {\n\t\tbuildNumber = Number(build);\n\t} else if (input) {\n\t\tconst descriptionMatch = input.match(/(\\d+)\\)$/);\n\n\t\tif (descriptionMatch) {\n\t\t\tbuildNumber = parseInt(descriptionMatch[1]);\n\t\t}\n\t}\n\n\treturn new PackageVersion(\n\t\tparseInt(major),\n\t\tparseInt(minor),\n\t\tparseInt(patch),\n\t\tpreRelease,\n\t\tbuildNumber,\n\t);\n};\n\n// 1000001001 -> 1.0.1.1\n// 1002017001 -> 1.2.17.1\nexport const parseVersionFromNumericVersion = (\n\tversion: number,\n): PackageVersion => {\n\tconst major = Math.floor(version / 1000000000);\n\tconst minor = Math.floor((version % 1000000000) / 1000000);\n\tconst patch = Math.floor((version % 1000000) / 1000);\n\tconst buildNumber = version % 1000;\n\n\treturn new PackageVersion(major, minor, patch, undefined, buildNumber);\n};\n","import * as fs from \"fs\";\nimport * as path from \"path\";\n\nimport { isErrorENOENT } from \"./error\";\nimport { readStringFromFileOrUndefined } from \"./fs\";\nimport { PackageLocation } from \"./package\";\nimport { PackageVersion } from \"./packageVersion\";\n\n// https://regex101.com/r/LtGAu5/1\nconst logRegex =\n\t/console\\.log\\(\\s*\"([\\w\\s\\.\\(\\)]+)\\ *Copyright[\\w\\s\\(\\)\\.]+(\\d{4}|\\d{4} - \\d{4})([\\w\\s\\(\\)\\.]+)?\",?\\s*\\)/i;\nconst currentYear = new Date(Date.now()).getFullYear();\n\nexport function getVersionFileHandler(location: PackageLocation) {\n\tconst filePath = path.join(location.scriptsDir, \"Version.ts\");\n\n\tfunction invalidVersionFile(\n\t\tversionFile: string | undefined,\n\t\texists: boolean,\n\t) {\n\t\treturn {\n\t\t\texists,\n\t\t\twrite: (name: string, newVersion: PackageVersion) => {\n\t\t\t\tconst scriptsContent = fs.readdirSync(location.scriptsDir);\n\t\t\t\tconst tsFiles = scriptsContent.filter((file) =>\n\t\t\t\t\tfile.endsWith(\".ts\"),\n\t\t\t\t);\n\n\t\t\t\tif (tsFiles.length > 0) {\n\t\t\t\t\treturn createVersionFileWriter([currentYear], \"\")(\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tnewVersion,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\treset: () => {\n\t\t\t\tif (versionFile !== undefined) {\n\t\t\t\t\tfs.writeFileSync(filePath, versionFile, {\n\t\t\t\t\t\tencoding: \"utf8\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfs.rmSync(filePath);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tif (!isErrorENOENT(err)) {\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\ttype CopyrightRange = [number, number?];\n\n\tfunction createVersionFileWriter(\n\t\tcopyright: CopyrightRange = [currentYear],\n\t\tcopyrightStuff: string = \"\",\n\t) {\n\t\treturn (name: string, newVersion: PackageVersion) => {\n\t\t\tconst descriptionText = newVersion.toDescriptionString(name);\n\t\t\tconst copyrightText = createYearString(copyright);\n\n\t\t\tconst result = `console.log(\"${descriptionText}. Copyright (C) ${copyrightText}${copyrightStuff}\");`;\n\n\t\t\tfs.writeFileSync(filePath, result, { encoding: \"utf-8\" });\n\t\t};\n\t}\n\n\tlet rawVersionFile = readStringFromFileOrUndefined(filePath);\n\n\tif (rawVersionFile === undefined) {\n\t\treturn invalidVersionFile(rawVersionFile, false);\n\t}\n\n\tconst versionFile = rawVersionFile.replace(/\\n/g, \"\");\n\n\tconst match = versionFile.match(logRegex);\n\n\tif (!match) {\n\t\treturn invalidVersionFile(versionFile, true);\n\t}\n\n\tconst [_full, _description, copyright, copyrightStuff] = match as [\n\t\tstring,\n\t\tstring,\n\t\tstring,\n\t\tstring?,\n\t];\n\n\tconst copyrightYears = copyright.match(/^(\\d+)( ?- ?(\\d+))?$/);\n\n\tlet years: [number, number?];\n\n\tif (copyrightYears === null) {\n\t\tyears = [currentYear];\n\t} else {\n\t\tyears = [Number(copyrightYears[1]), currentYear];\n\t}\n\n\treturn {\n\t\texists: true,\n\t\twrite: createVersionFileWriter(years, copyrightStuff),\n\t\treset: () => {\n\t\t\tfs.writeFileSync(filePath, versionFile, { encoding: \"utf8\" });\n\t\t},\n\t};\n}\n\nconst createYearString = (years: [number, number?]) => {\n\tif (years[1] === undefined || years[0] === years[1]) {\n\t\treturn years[0].toString();\n\t}\n\n\treturn `${years[0]} - ${years[1]}`;\n};\n"],"names":["readStringFromFile","filePath","fs","readFileSync","encoding","readStringFromFileOrUndefined","err","isErrorENOENT","undefined","getVersionInformationFromGit","workspaceLocation","packageLocation","git","simpleGit","baseDir","path","diff","diffSummary","dirty","files","some","file","toLowerCase","includes","endsWith","fullPath","resolve","relativePath","relative","startsWith","log","maxCount","commit","latest","hash","substring","commitDate","date","getWorkspaceBannerText","manifest","bannerText","packager","banner","match","startYear","parseInt","endYear","Date","getFullYear","replace","parseVersionFromString","input","Error","major","minor","patch","build","preReleaseType","preReleaseNumber","preRelease","buildNumber","type","version","Number","descriptionMatch","PackageVersion","parseVersionFromNumericVersion","Math","floor","logRegex","currentYear","now","getVersionFileHandler","location","join","scriptsDir","invalidVersionFile","versionFile","exists","write","name","newVersion","scriptsContent","readdirSync","tsFiles","filter","length","createVersionFileWriter","reset","writeFileSync","rmSync","copyright","copyrightStuff","descriptionText","toDescriptionString","copyrightText","createYearString","result","rawVersionFile","_full","_description","copyrightYears","years","toString"],"mappings":";;;;;;;;;;MAIaA,kBAAAA,GAAqB,CAACC,QAAAA,GAClCC,EAAAA,CAAGC,YAAY,CAACF,QAAAA,EAAU;AAAEG,QAAAA,QAAAA,EAAU;AAAO,KAAA,CAAA;AAEvC,MAAMC,6BAAAA,GAAgC,CAC5CJ,QAAAA,GAAAA;IAEA,IAAI;QACH,OAAOD,kBAAAA,CAAmBC,QAAAA,CAAAA;IAC3B,CAAA,CAAE,OAAOK,GAAAA,EAAK;AACb,QAAA,IAAI,CAACC,aAAAA,CAAcD,GAAAA,CAAAA,EAAM;AACxB,YAAA,MAAMA,GAAAA;AACP,QAAA;AACA,QAAA,OAAOE,SAAAA;AACR,IAAA;AACD,CAAA;;ACZO,MAAMC,4BAAAA,GAA+B,OAC3CC,iBAAAA,EACAC,eAAAA,GAAAA;IAEA,IAAI;AACH,QAAA,MAAMC,MAAMC,SAAAA,CAAU;AACrBC,YAAAA,OAAAA,EAASJ,kBAAkBK;AAC5B,SAAA,CAAA;;;QAIA,MAAMC,IAAAA,GAAO,MAAMJ,GAAAA,CAAIK,WAAW,EAAA;AAElC,QAAA,MAAMC,QAAQF,IAAAA,CAAKG,KAAK,CAACC,IAAI,CAAC,CAACC,IAAAA,GAAAA;YAC9B,IACCA,IAAAA,CAAKA,IAAI,CAACC,WAAW,GAAGC,QAAQ,CAAC,UAAA,CAAA,IACjCF,IAAAA,CAAKA,IAAI,CAACC,WAAW,EAAA,CAAGE,QAAQ,CAAC,YAAA,CAAA,IACjCH,IAAAA,CAAKA,IAAI,CAACC,WAAW,EAAA,CAAGE,QAAQ,CAAC,c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MAAO;QACNgC,KAAAA,GAAQ;YAACvC,MAAAA,CAAOsC,cAAc,CAAC,CAAA,CAAE,CAAA;AAAG/B,YAAAA;AAAY,SAAA;AACjD,IAAA;IAEA,OAAO;QACNQ,MAAAA,EAAQ,IAAA;AACRC,QAAAA,KAAAA,EAAOQ,wBAAwBe,KAAAA,EAAOV,cAAAA,CAAAA;QACtCJ,KAAAA,EAAO,IAAA;YACNtF,EAAAA,CAAGuF,aAAa,CAACxF,QAAAA,EAAU4E,WAAAA,EAAa;gBAAEzE,QAAAA,EAAU;AAAO,aAAA,CAAA;AAC5D,QAAA;AACD,KAAA;AACD;AAEA,MAAM4F,mBAAmB,CAACM,KAAAA,GAAAA;AACzB,IAAA,IAAIA,KAAK,CAAC,CAAA,CAAE,KAAK9F,SAAAA,IAAa8F,KAAK,CAAC,CAAA,CAAE,KAAKA,KAAK,CAAC,CAAA,CAAE,EAAE;AACpD,QAAA,OAAOA,KAAK,CAAC,CAAA,CAAE,CAACC,QAAQ,EAAA;AACzB,IAAA;IAEA,OAAO,CAAA,EAAGD,KAAK,CAAC,CAAA,CAAE,CAAC,GAAG,EAAEA,KAAK,CAAC,CAAA,CAAE,CAAA,CAAE;AACnC,CAAA;;;;"}
1
+ {"version":3,"file":"versionFile-DfWPXq6d.mjs","sources":["../../tools.core/build/fs.mjs","../src/lib/git.ts","../src/lib/banner.ts","../src/lib/parseVersion.ts","../src/lib/versionFile.ts"],"sourcesContent":["import * as fs from 'fs';\nimport { isErrorENOENT } from './error.mjs';\n\nconst readStringFromFile = (filePath)=>fs.readFileSync(filePath, {\n encoding: \"utf8\"\n });\nconst readStringFromFileOrUndefined = (filePath)=>{\n try {\n return readStringFromFile(filePath);\n } catch (err) {\n if (!isErrorENOENT(err)) {\n throw err;\n }\n return undefined;\n }\n};\n\nexport { readStringFromFile, readStringFromFileOrUndefined };\n//# sourceMappingURL=fs.mjs.map\n","import simpleGit from \"simple-git\";\nimport * as path from \"path\";\n\nimport { WorkspaceLocation } from \"./workspace\";\nimport { PackageLocation } from \"./package\";\n\nexport const getVersionInformationFromGit = async (\n\tworkspaceLocation: WorkspaceLocation,\n\tpackageLocation: PackageLocation,\n) => {\n\ttry {\n\t\tconst git = simpleGit({\n\t\t\tbaseDir: workspaceLocation.path,\n\t\t});\n\n\t\t// check wether the files for a folder are changed\n\t\t// if so, mark as dirty\n\t\tconst diff = await git.diffSummary();\n\n\t\tconst dirty = diff.files.some((file) => {\n\t\t\tif (\n\t\t\t\tfile.file.toLowerCase().includes(\"releases\") ||\n\t\t\t\tfile.file.toLowerCase().endsWith(\"version.ts\") ||\n\t\t\t\tfile.file.toLowerCase().endsWith(\"package.json\")\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst fullPath = path.resolve(workspaceLocation.path, file.file);\n\t\t\tconst relativePath = path.relative(packageLocation.path, fullPath);\n\n\t\t\treturn !relativePath.startsWith(\"..\");\n\t\t});\n\n\t\tconst log = await git.log({ maxCount: 1 });\n\t\tconst commit = !log.latest?.hash\n\t\t\t? undefined\n\t\t\t: log.latest.hash.substring(0, 7);\n\n\t\treturn {\n\t\t\tcommit,\n\t\t\tdirty,\n\t\t\tcommitDate: log.latest?.date,\n\t\t};\n\t} catch (err) {\n\t\treturn {};\n\t}\n};\n","import { WorkspacePackageJSON } from \"./workspace\";\n\nexport const getWorkspaceBannerText = (manifest: WorkspacePackageJSON) => {\n\tlet bannerText = manifest?.packager?.banner;\n\n\tif (bannerText) {\n\t\tconst match = bannerText.match(/Copyright \\(C\\) (\\d+)( ?- ?(\\d+))?/);\n\n\t\tif (match !== null) {\n\t\t\tconst startYear = parseInt(match[1]);\n\t\t\tconst endYear = new Date().getFullYear();\n\n\t\t\tif (startYear !== endYear) {\n\t\t\t\tbannerText = bannerText.replace(\n\t\t\t\t\tmatch[0],\n\t\t\t\t\t`Copyright (C) ${startYear} - ${endYear}`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbannerText = bannerText.replace(\n\t\t\t\t\tmatch[0],\n\t\t\t\t\t`Copyright (C) ${startYear}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn bannerText;\n};\n","import { PackageVersion } from \"./packageVersion\";\n\nexport const parseVersionFromString = (input: string) => {\n\tif (input === undefined) {\n\t\tthrow new Error(`Can not parse version from undefined`);\n\t}\n\n\tlet match: RegExpMatchArray | null;\n\n\tlet major!: string;\n\tlet minor!: string;\n\tlet patch!: string;\n\tlet build: string | undefined;\n\tlet preReleaseType: string | undefined;\n\tlet preReleaseNumber: string | undefined;\n\n\tif (\n\t\t// first try to find a full match with build number\n\t\t(match = input.match(\n\t\t\t/(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)(-([^\\.]+)\\.(\\d+))?/,\n\t\t)) !== null\n\t) {\n\t\t[, major, minor, patch, build, preReleaseType, preReleaseNumber] =\n\t\t\tmatch;\n\t} else if (\n\t\t(match = input.match(/(\\d+)\\.(\\d+)\\.(\\d+)(-([^\\.]+)\\.(\\d+))?/)) !== null\n\t) {\n\t\t[, major, minor, patch, , preReleaseType, preReleaseNumber] = match;\n\t}\n\n\tif (match === null) {\n\t\tthrow new Error(`Could not parse version from input: ${input}`);\n\t}\n\n\tlet preRelease: PackageVersion[\"preRelease\"] = undefined;\n\tlet buildNumber = 100;\n\n\tif (preReleaseType && preReleaseNumber) {\n\t\tpreRelease = {\n\t\t\ttype: preReleaseType,\n\t\t\tversion: parseInt(preReleaseNumber),\n\t\t};\n\t}\n\n\tif (build) {\n\t\tbuildNumber = Number(build);\n\t} else if (input) {\n\t\tconst descriptionMatch = input.match(/(\\d+)\\)$/);\n\n\t\tif (descriptionMatch) {\n\t\t\tbuildNumber = parseInt(descriptionMatch[1]);\n\t\t}\n\t}\n\n\treturn new PackageVersion(\n\t\tparseInt(major),\n\t\tparseInt(minor),\n\t\tparseInt(patch),\n\t\tpreRelease,\n\t\tbuildNumber,\n\t);\n};\n\n// 1000001001 -> 1.0.1.1\n// 1002017001 -> 1.2.17.1\nexport const parseVersionFromNumericVersion = (\n\tversion: number,\n): PackageVersion => {\n\tconst major = Math.floor(version / 1000000000);\n\tconst minor = Math.floor((version % 1000000000) / 1000000);\n\tconst patch = Math.floor((version % 1000000) / 1000);\n\tconst buildNumber = version % 1000;\n\n\treturn new PackageVersion(major, minor, patch, undefined, buildNumber);\n};\n","import * as fs from \"fs\";\nimport * as path from \"path\";\n\nimport { isErrorENOENT } from \"./error\";\nimport { readStringFromFileOrUndefined } from \"./fs\";\nimport { PackageLocation } from \"./package\";\nimport { PackageVersion } from \"./packageVersion\";\n\n// https://regex101.com/r/LtGAu5/1\nconst logRegex =\n\t/console\\.log\\(\\s*\"([\\w\\s\\.\\(\\)]+)\\ *Copyright[\\w\\s\\(\\)\\.]+(\\d{4}|\\d{4} - \\d{4})([\\w\\s\\(\\)\\.]+)?\",?\\s*\\)/i;\nconst currentYear = new Date(Date.now()).getFullYear();\n\nexport function getVersionFileHandler(location: PackageLocation) {\n\tconst filePath = path.join(location.scriptsDir, \"Version.ts\");\n\n\tfunction invalidVersionFile(\n\t\tversionFile: string | undefined,\n\t\texists: boolean,\n\t) {\n\t\treturn {\n\t\t\texists,\n\t\t\twrite: (name: string, newVersion: PackageVersion) => {\n\t\t\t\tconst scriptsContent = fs.readdirSync(location.scriptsDir);\n\t\t\t\tconst tsFiles = scriptsContent.filter((file) =>\n\t\t\t\t\tfile.endsWith(\".ts\"),\n\t\t\t\t);\n\n\t\t\t\tif (tsFiles.length > 0) {\n\t\t\t\t\treturn createVersionFileWriter([currentYear], \"\")(\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tnewVersion,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\treset: () => {\n\t\t\t\tif (versionFile !== undefined) {\n\t\t\t\t\tfs.writeFileSync(filePath, versionFile, {\n\t\t\t\t\t\tencoding: \"utf8\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfs.rmSync(filePath);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tif (!isErrorENOENT(err)) {\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\ttype CopyrightRange = [number, number?];\n\n\tfunction createVersionFileWriter(\n\t\tcopyright: CopyrightRange = [currentYear],\n\t\tcopyrightStuff: string = \"\",\n\t) {\n\t\treturn (name: string, newVersion: PackageVersion) => {\n\t\t\tconst descriptionText = newVersion.toDescriptionString(name);\n\t\t\tconst copyrightText = createYearString(copyright);\n\n\t\t\tconst result = `console.log(\"${descriptionText}. Copyright (C) ${copyrightText}${copyrightStuff}\");`;\n\n\t\t\tfs.writeFileSync(filePath, result, { encoding: \"utf-8\" });\n\t\t};\n\t}\n\n\tlet rawVersionFile = readStringFromFileOrUndefined(filePath);\n\n\tif (rawVersionFile === undefined) {\n\t\treturn invalidVersionFile(rawVersionFile, false);\n\t}\n\n\tconst versionFile = rawVersionFile.replace(/\\n/g, \"\");\n\n\tconst match = versionFile.match(logRegex);\n\n\tif (!match) {\n\t\treturn invalidVersionFile(versionFile, true);\n\t}\n\n\tconst [_full, _description, copyright, copyrightStuff] = match as [\n\t\tstring,\n\t\tstring,\n\t\tstring,\n\t\tstring?,\n\t];\n\n\tconst copyrightYears = copyright.match(/^(\\d+)( ?- ?(\\d+))?$/);\n\n\tlet years: [number, number?];\n\n\tif (copyrightYears === null) {\n\t\tyears = [currentYear];\n\t} else {\n\t\tyears = [Number(copyrightYears[1]), currentYear];\n\t}\n\n\treturn {\n\t\texists: true,\n\t\twrite: createVersionFileWriter(years, copyrightStuff),\n\t\treset: () => {\n\t\t\tfs.writeFileSync(filePath, versionFile, { encoding: \"utf8\" });\n\t\t},\n\t};\n}\n\nconst createYearString = (years: [number, number?]) => {\n\tif (years[1] === undefined || years[0] === years[1]) {\n\t\treturn years[0].toString();\n\t}\n\n\treturn `${years[0]} - ${years[1]}`;\n};\n"],"names":["readStringFromFile","filePath","fs","readFileSync","encoding","readStringFromFileOrUndefined","err","isErrorENOENT","undefined","getVersionInformationFromGit","workspaceLocation","packageLocation","git","simpleGit","baseDir","path","diff","diffSummary","dirty","files","some","file","toLowerCase","includes","endsWith","fullPath","resolve","relativePath","relative","startsWith","log","maxCount","commit","latest","hash","substring","commitDate","date","getWorkspaceBannerText","manifest","bannerText","packager","banner","match","startYear","parseInt","endYear","Date","getFullYear","replace","parseVersionFromString","input","Error","major","minor","patch","build","preReleaseType","preReleaseNumber","preRelease","buildNumber","type","version","Number","descriptionMatch","PackageVersion","parseVersionFromNumericVersion","Math","floor","logRegex","currentYear","now","getVersionFileHandler","location","join","scriptsDir","invalidVersionFile","versionFile","exists","write","name","newVersion","scriptsContent","readdirSync","tsFiles","filter","length","createVersionFileWriter","reset","writeFileSync","rmSync","copyright","copyrightStuff","descriptionText","toDescriptionString","copyrightText","createYearString","result","rawVersionFile","_full","_description","copyrightYears","years","toString"],"mappings":";;;;;;;;;;MAIaA,kBAAAA,GAAqB,CAACC,QAAAA,GAClCC,EAAAA,CAAGC,YAAY,CAACF,QAAAA,EAAU;AAAEG,QAAAA,QAAAA,EAAU;AAAO,KAAA,CAAA;AAEvC,MAAMC,6BAAAA,GAAgC,CAC5CJ,QAAAA,GAAAA;IAEA,IAAI;QACH,OAAOD,kBAAAA,CAAmBC,QAAAA,CAAAA;IAC3B,CAAA,CAAE,OAAOK,GAAAA,EAAK;AACb,QAAA,IAAI,CAACC,aAAAA,CAAcD,GAAAA,CAAAA,EAAM;AACxB,YAAA,MAAMA,GAAAA;AACP,QAAA;AACA,QAAA,OAAOE,SAAAA;AACR,IAAA;AACD,CAAA;;ACZO,MAAMC,4BAAAA,GAA+B,OAC3CC,iBAAAA,EACAC,eAAAA,GAAAA;IAEA,IAAI;AACH,QAAA,MAAMC,MAAMC,SAAAA,CAAU;AACrBC,YAAAA,OAAAA,EAASJ,kBAAkBK;AAC5B,SAAA,CAAA;;;QAIA,MA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
  import resolve from 'resolve';
9
- import 'write-pkg';
9
+ import 'write-package';
10
10
  import * as glob from 'glob';
11
- import 'write-json-file';
12
11
  import axios, { AxiosError } from 'axios';
13
12
  import EventEmitter from 'events';
14
13
  import { SourceMapGenerator, SourceMapConsumer } from 'source-map-js';
@@ -19,7 +18,7 @@ import { promisify } from 'util';
19
18
  import simpleGit from 'simple-git';
20
19
  import JSZip from 'jszip';
21
20
  import { buffer } from 'node:stream/consumers';
22
- import { resolveNamespaces, resolveNamespaceFullName } from '@intelligentgraphics/declarationbundler';
21
+ import { resolveNamespaces, findNamespaceByMemberSourceFile, resolveNamespaceFullName } from '@intelligentgraphics/declarationbundler';
23
22
 
24
23
  const stripUtf8Bom = (text)=>{
25
24
  // Catches EFBBBF (UTF-8 BOM) because the buffer-to-string
@@ -530,6 +529,7 @@ const createTSCWatchBuildParticipant = (location, outputDir, skipDeclarations)=>
530
529
  }
531
530
  state.diagnostics.push(diagnostic);
532
531
  };
532
+ let currentProgram;
533
533
  const reportWatchStatusChanged = (diagnostic)=>{
534
534
  switch(diagnostic.code){
535
535
  // regular watch mode - https://github.com/microsoft/TypeScript/blob/93e6b9da0c4cb164ca90a5a1b07415e81e97f2b1/src/compiler/diagnosticMessages.json#L4567
@@ -559,7 +559,7 @@ const createTSCWatchBuildParticipant = (location, outputDir, skipDeclarations)=>
559
559
  });
560
560
  return;
561
561
  }
562
- if (emitState.js === undefined || emitState.definitions === undefined) {
562
+ if (emitState.js === undefined) {
563
563
  onBuildEnd({
564
564
  type: "success",
565
565
  artefacts: {
@@ -568,11 +568,14 @@ const createTSCWatchBuildParticipant = (location, outputDir, skipDeclarations)=>
568
568
  });
569
569
  return;
570
570
  }
571
+ if (!currentProgram) {
572
+ throw new Error(`Expected a program to exist`);
573
+ }
571
574
  onBuildEnd({
572
575
  type: "success",
573
576
  artefacts: {
574
577
  js: emitState.js.replace(`//# sourceMappingURL=out.js.map`, ""),
575
- declarations: getDeclarationFileReferences(location, watchProgram.getProgram(), outputDir) + emitState.definitions,
578
+ declarations: emitState.definitions ? getDeclarationFileReferences(location, currentProgram, outputDir) + emitState.definitions : undefined,
576
579
  sourceMap: emitState.sourceMap
577
580
  }
578
581
  });
@@ -580,6 +583,11 @@ const createTSCWatchBuildParticipant = (location, outputDir, skipDeclarations)=>
580
583
  }
581
584
  };
582
585
  const host = ts.createWatchCompilerHost(path.join(location.scriptsDir, "tsconfig.json"), getCompilerOptions(location, outputDir, skipDeclarations), customSys, ts.createSemanticDiagnosticsBuilderProgram, registerDiagnostic, reportWatchStatusChanged);
586
+ const originalAfterProgramCreate = host.afterProgramCreate;
587
+ host.afterProgramCreate = (program)=>{
588
+ currentProgram = program;
589
+ originalAfterProgramCreate == null ? void 0 : originalAfterProgramCreate(program);
590
+ };
583
591
  const formattingHost = {
584
592
  getCanonicalFileName: (path)=>path,
585
593
  getCurrentDirectory: host.getCurrentDirectory,
@@ -660,7 +668,7 @@ const toposort = (packages)=>{
660
668
 
661
669
  class BuildManager extends EventEmitter {
662
670
  constructor(manifest, writer, reporter){
663
- super(), this.manifest = manifest, this.writer = writer, this.reporter = reporter, this.participants = new Map(), this.states = new Map();
671
+ super(), this.manifest = manifest, this.writer = writer, this.reporter = reporter, this.participants = new Map(), this.states = new Map(), this.participantInstances = [];
664
672
  }
665
673
  addParticipant(name, participant) {
666
674
  this.participants.set(name, participant);
@@ -673,7 +681,7 @@ class BuildManager extends EventEmitter {
673
681
  }
674
682
  this.emit("start");
675
683
  for (const [name, participant] of this.participants){
676
- participant({
684
+ const instance = participant({
677
685
  onBuildStart: ()=>{
678
686
  let alreadyBusy = false;
679
687
  for (const [name, state] of this.states){
@@ -695,6 +703,12 @@ class BuildManager extends EventEmitter {
695
703
  },
696
704
  log: (message)=>this.reporter.log(message)
697
705
  });
706
+ this.participantInstances.push(instance);
707
+ }
708
+ }
709
+ destroy() {
710
+ for (const instance of this.participantInstances){
711
+ instance.destroy();
698
712
  }
699
713
  }
700
714
  maybeEmit() {
@@ -1429,10 +1443,12 @@ async function buildFolders(options) {
1429
1443
  }
1430
1444
  if (typescriptFiles.length > 0) {
1431
1445
  if (isScriptPackageModules(tsConfig.options)) {
1432
- const { createRollupBuildParticipant } = await import('./rollup-CpLu1Yc3.mjs');
1433
- manager.addParticipant("rollup", createRollupBuildParticipant(location, data, outputDirectory, options.skipDeclarations ?? false));
1446
+ const { createRollupBuildParticipant } = await import('./rollup-CTNi9TK_.mjs');
1447
+ manager.addParticipant("rollup", createRollupBuildParticipant(location, data, outputDirectory, !tsConfig.options.declaration));
1434
1448
  } else {
1435
- manager.addParticipant("tsc", createTSCBuildParticipant(location, outputDirectory, options.skipDeclarations ?? false));
1449
+ manager.addParticipant("tsc", createTSCBuildParticipant(location, outputDirectory, // in the past we always created declaration files,
1450
+ // so we'll use it as the default for legacy modules
1451
+ tsConfig.options.declaration === false));
1436
1452
  }
1437
1453
  }
1438
1454
  manager.addParticipant("animation", createAnimationBuildParticipant(location, data));
@@ -1467,6 +1483,7 @@ async function buildFoldersWatch(options) {
1467
1483
  }
1468
1484
  const workspace = options.workspace;
1469
1485
  const folders = options.packages;
1486
+ options.reporter ?? consoleReporter;
1470
1487
  let sortedPackages = sortPackagesByBuildOrder(folders);
1471
1488
  let index = 1;
1472
1489
  const manifests = new Map(sortedPackages.map((location)=>[
@@ -1474,11 +1491,12 @@ async function buildFoldersWatch(options) {
1474
1491
  readPackageCreatorManifest(location)
1475
1492
  ]));
1476
1493
  const maxNameLength = Array.from(manifests.values(), (manifest)=>manifest.Package.length).reduce((acc, length)=>Math.max(acc, length), 0);
1494
+ const managers = [];
1477
1495
  for (const location of sortedPackages){
1478
1496
  const tsConfig = await ensureTsConfig(location);
1479
1497
  const baseReporter = options.reporter ?? consoleReporter;
1480
1498
  const data = manifests.get(location);
1481
- const reporter = createPackageScopedReporter(baseReporter, data.Package, index, folders.length, maxNameLength);
1499
+ const reporter = options.preparedReporter ?? createPackageScopedReporter(baseReporter, data.Package, index, folders.length, maxNameLength);
1482
1500
  const outputDirectory = options.outDir || location.scriptsDir;
1483
1501
  await fs$1.mkdir(outputDirectory, {
1484
1502
  recursive: true
@@ -1493,10 +1511,12 @@ async function buildFoldersWatch(options) {
1493
1511
  }
1494
1512
  if (typescriptFiles.length > 0) {
1495
1513
  if (isScriptPackageModules(tsConfig.options)) {
1496
- const { createRollupWatchBuildParticipant } = await import('./rollup-CpLu1Yc3.mjs');
1497
- manager.addParticipant("rollup", createRollupWatchBuildParticipant(location, data, outputDirectory, options.skipDeclarations ?? false));
1514
+ const { createRollupWatchBuildParticipant } = await import('./rollup-CTNi9TK_.mjs');
1515
+ manager.addParticipant("rollup", createRollupWatchBuildParticipant(location, data, outputDirectory, !tsConfig.options.declaration));
1498
1516
  } else {
1499
- manager.addParticipant("tsc", createTSCWatchBuildParticipant(location, outputDirectory, options.skipDeclarations ?? false));
1517
+ manager.addParticipant("tsc", createTSCWatchBuildParticipant(location, outputDirectory, // in the past we always created declaration files,
1518
+ // so we'll use it as the default for legacy modules
1519
+ tsConfig.options.declaration === false));
1500
1520
  }
1501
1521
  }
1502
1522
  manager.addParticipant("animation", createAnimationWatchBuildParticipant(location, data));
@@ -1514,9 +1534,16 @@ async function buildFoldersWatch(options) {
1514
1534
  });
1515
1535
  manager.run();
1516
1536
  });
1537
+ managers.push(manager);
1517
1538
  index++;
1518
1539
  }
1519
- await new Promise(()=>{});
1540
+ return {
1541
+ destroy: ()=>{
1542
+ for (const manager of managers){
1543
+ manager.destroy();
1544
+ }
1545
+ }
1546
+ };
1520
1547
  }
1521
1548
  async function writeBuildResult(buildResult, manifest, location, workspace, outputDirectory, minimize, reporter) {
1522
1549
  let js = buildResult.js;
@@ -1633,7 +1660,7 @@ function applyTsConfigOptions(data) {
1633
1660
  data.compilerOptions = data.compilerOptions ?? {};
1634
1661
  data.compilerOptions.target = "esnext";
1635
1662
  data.compilerOptions.lib = [
1636
- "esnext",
1663
+ "es2024",
1637
1664
  "dom"
1638
1665
  ];
1639
1666
  data.compilerOptions.module = "es2015";
@@ -2356,15 +2383,18 @@ const releaseFolder = async (options)=>{
2356
2383
  * Extracts and returns script array for _Index.json from a src folder
2357
2384
  *
2358
2385
  * @param folderPath path to a src folder
2359
- */ function generateIndex({ location, ignore = [], strictOptional = false }) {
2386
+ */ function generateIndex({ location, ignore = [], strictOptional }) {
2360
2387
  const arr = [];
2361
2388
  const existingIndex = readPackageCreatorIndex(location) ?? [];
2362
2389
  const manifest = readPackageCreatorManifest(location);
2363
2390
  const compilerOptions = readScriptPackageTSConfig(location).options;
2364
2391
  const isModule = compilerOptions.module === ts.ModuleKind.ES2015 || compilerOptions.module === ts.ModuleKind.ESNext;
2392
+ if (strictOptional === undefined) {
2393
+ strictOptional = compilerOptions.strict === true || compilerOptions.strictNullChecks === true;
2394
+ }
2365
2395
  const files = getPackageTypescriptFiles(location).filter((path)=>!ignore.some((suffix)=>path.endsWith(suffix)));
2366
2396
  let program;
2367
- let namespaces;
2397
+ let rootNamespace;
2368
2398
  if (isModule) {
2369
2399
  const entryFilePath = resolveScriptPackageEntryModule(location, manifest);
2370
2400
  if (entryFilePath === undefined) {
@@ -2381,19 +2411,21 @@ const releaseFolder = async (options)=>{
2381
2411
  if (entryFile === undefined) {
2382
2412
  throw new Error(`Failed to find entry module`);
2383
2413
  }
2384
- namespaces = resolveNamespaces(entryFile, program, host, manifest.Scope ?? manifest.Package);
2414
+ rootNamespace = resolveNamespaces(entryFile, program, host, program.getTypeChecker(), manifest.Scope ?? manifest.Package);
2385
2415
  } else {
2386
2416
  program = ts.createProgram(files, {
2387
2417
  allowJs: true
2388
2418
  });
2389
- namespaces = [];
2390
2419
  }
2391
2420
  const typeChecker = program.getTypeChecker();
2392
2421
  files.forEach((file)=>{
2393
2422
  // Create a Program to represent the project, then pull out the
2394
2423
  // source file to parse its AST.
2395
2424
  const sourceFile = program.getSourceFile(file);
2396
- const namespace = namespaces.find((namespace)=>namespace.files.includes(sourceFile));
2425
+ if (sourceFile === undefined) {
2426
+ return;
2427
+ }
2428
+ const namespace = rootNamespace === undefined ? undefined : findNamespaceByMemberSourceFile(rootNamespace, sourceFile);
2397
2429
  // Loop through the root AST nodes of the file
2398
2430
  for (const scriptingClass of findScriptingClasses(sourceFile)){
2399
2431
  if (scriptingClass.node.name === undefined) {
@@ -2406,9 +2438,6 @@ const releaseFolder = async (options)=>{
2406
2438
  } else {
2407
2439
  name = typeChecker.getFullyQualifiedName(typeChecker.getSymbolAtLocation(scriptingClass.node.name));
2408
2440
  }
2409
- if (name.length > 45) {
2410
- throw new Error(`Package name length >45 '${name}'`);
2411
- }
2412
2441
  const parameterDeclaration = getScriptingClassParameterdeclaration(scriptingClass);
2413
2442
  const parametersType = parameterDeclaration === undefined ? undefined : typeChecker.getTypeAtLocation(parameterDeclaration);
2414
2443
  if (parametersType === undefined) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@intelligentgraphics/ig.gfx.packager",
3
- "version": "3.1.0-alpha.6",
4
- "description": "IG.GFX.Packager 3.1.0 Alpha 6 (3.1.0.5)",
3
+ "version": "3.1.0",
4
+ "description": "IG.GFX.Packager 3.1.0 (3.1.0.100)",
5
5
  "author": "Michael Beier <mb@intelligentgraphics.biz>",
6
6
  "main": "lib/lib.mjs",
7
7
  "types": "lib/lib.d.ts",
@@ -31,6 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@intelligentgraphics/declarationbundler": "^0.4.4",
34
+ "@intelligentgraphics/ig.gfx.packager-babel-preset-es5": "^3.1.0",
34
35
  "@rollup/plugin-alias": "^6.0.0",
35
36
  "@rollup/plugin-babel": "^6.1.0",
36
37
  "@rollup/plugin-commonjs": "^29.0.0",
@@ -53,12 +54,10 @@
53
54
  "typedoc": "^0.28.14",
54
55
  "typescript": "~5.9.3",
55
56
  "update-notifier": "^7.3.1",
56
- "v8-compile-cache": "^2.3.0",
57
- "write-pkg": "^7.0.0",
57
+ "write-package": "^7.0.0",
58
58
  "yargs": "^18.0.0"
59
59
  },
60
60
  "devDependencies": {
61
- "@intelligentgraphics/ig.gfx.packager-babel-preset-es5": "^3.1.0-alpha.7",
62
61
  "@intelligentgraphics/ig.gfx.tools.core": "^1.0.0",
63
62
  "@rollup/plugin-swc": "^0.4.0",
64
63
  "@swc/core": "^1.4.6",