@intelligentgraphics/ig.gfx.packager 3.0.27 → 3.1.0-alpha.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.
- package/build/bin.mjs +1 -1
- package/build/{cli-e279c41e.mjs → cli-CuiqZ39_.mjs} +52 -85
- package/build/cli-CuiqZ39_.mjs.map +1 -0
- package/build/{dependencies-9afff33c.mjs → dependencies-BiYItaVS.mjs} +2 -2
- package/build/{dependencies-9afff33c.mjs.map → dependencies-BiYItaVS.mjs.map} +1 -1
- package/build/{generateIndex-9864e722.mjs → generateIndex-hg6jRXQv.mjs} +97 -84
- package/build/generateIndex-hg6jRXQv.mjs.map +1 -0
- package/build/{generateParameterType-32abb018.mjs → generateParameterType-CDjqLM4J.mjs} +3 -4
- package/build/{generateParameterType-32abb018.mjs.map → generateParameterType-CDjqLM4J.mjs.map} +1 -1
- package/build/{index-a87a7800.mjs → index-B2kXo6K7.mjs} +301 -89
- package/build/index-B2kXo6K7.mjs.map +1 -0
- package/build/{index-56178e55.mjs → index-BoGrZubW.mjs} +27 -25
- package/build/index-BoGrZubW.mjs.map +1 -0
- package/build/{postinstall-472e0106.mjs → postinstall-CbMUz2zy.mjs} +3 -4
- package/build/{postinstall-472e0106.mjs.map → postinstall-CbMUz2zy.mjs.map} +1 -1
- package/build/{publishNpm-7d02c52b.mjs → publishNpm-CrnuTwss.mjs} +12 -11
- package/build/publishNpm-CrnuTwss.mjs.map +1 -0
- package/build/rollup-UR3DADp8.mjs +198 -0
- package/build/rollup-UR3DADp8.mjs.map +1 -0
- package/build/scripts-Bfojy_uD.mjs +48 -0
- package/build/scripts-Bfojy_uD.mjs.map +1 -0
- package/build/versionFile-DSqOw-XB.mjs +208 -0
- package/build/versionFile-DSqOw-XB.mjs.map +1 -0
- package/lib/lib.mjs +448 -359
- package/package.json +15 -10
- package/readme.md +91 -10
- package/build/cli-e279c41e.mjs.map +0 -1
- package/build/generateIndex-9864e722.mjs.map +0 -1
- package/build/index-56178e55.mjs.map +0 -1
- package/build/index-a87a7800.mjs.map +0 -1
- package/build/publishNpm-7d02c52b.mjs.map +0 -1
- package/build/scripts-7ed8dff6.mjs +0 -10
- package/build/scripts-7ed8dff6.mjs.map +0 -1
- package/build/versionFile-4b06435d.mjs +0 -384
- package/build/versionFile-4b06435d.mjs.map +0 -1
|
@@ -3,32 +3,31 @@ import * as fs from 'fs';
|
|
|
3
3
|
import { execSync } from 'child_process';
|
|
4
4
|
import 'resolve';
|
|
5
5
|
import 'write-pkg';
|
|
6
|
-
import { b as readWorkspaceNpmManifest, d as getWorkspaceOutputPath, r as readPackageCreatorManifest, q as readPackageNpmManifest, t as writePackageNpmManifest, w as writePackageCreatorManifest, P as PACKAGE_FILE, a as readPackageCreatorIndex, I as INDEX_FILE, v as iterateWorkspacePackages } from './cli-
|
|
7
|
-
import { c as createPackageScopedReporter, a as consoleReporter, b as buildFolders } from './index-
|
|
6
|
+
import { b as readWorkspaceNpmManifest, d as getWorkspaceOutputPath, r as readPackageCreatorManifest, q as readPackageNpmManifest, t as writePackageNpmManifest, w as writePackageCreatorManifest, P as PACKAGE_FILE, a as readPackageCreatorIndex, I as INDEX_FILE, v as iterateWorkspacePackages } from './cli-CuiqZ39_.mjs';
|
|
7
|
+
import { c as createPackageScopedReporter, a as consoleReporter, b as buildFolders } from './index-B2kXo6K7.mjs';
|
|
8
8
|
import 'glob';
|
|
9
9
|
import 'node:path';
|
|
10
10
|
import 'node:fs';
|
|
11
11
|
import 'axios';
|
|
12
|
-
import { a as parseVersionFromString, g as getVersionFileHandler, b as getVersionInformationFromGit, c as getWorkspaceBannerText } from './versionFile-
|
|
12
|
+
import { a as parseVersionFromString, g as getVersionFileHandler, b as getVersionInformationFromGit, c as getWorkspaceBannerText } from './versionFile-DSqOw-XB.mjs';
|
|
13
13
|
import 'update-notifier';
|
|
14
14
|
import 'yargs/yargs';
|
|
15
15
|
import 'url';
|
|
16
16
|
import 'assert';
|
|
17
17
|
import 'events';
|
|
18
|
-
import 'core-js/modules/es.typed-array.set.js';
|
|
19
18
|
import 'util';
|
|
20
19
|
import 'inquirer';
|
|
21
20
|
import 'fs/promises';
|
|
22
21
|
import 'terser';
|
|
22
|
+
import 'os';
|
|
23
23
|
import 'typescript';
|
|
24
|
-
import './scripts-
|
|
24
|
+
import './scripts-Bfojy_uD.mjs';
|
|
25
25
|
import 'typedoc';
|
|
26
26
|
import 'source-map-js';
|
|
27
27
|
import 'ajv';
|
|
28
|
-
import 'os';
|
|
29
28
|
import 'simple-git';
|
|
30
29
|
|
|
31
|
-
const publishToNpm = async ({ workspace
|
|
30
|
+
const publishToNpm = async ({ workspace, location, version: providedVersion, dryRun, reporter: providedReporter })=>{
|
|
32
31
|
let newVersion;
|
|
33
32
|
try {
|
|
34
33
|
newVersion = parseVersionFromString(providedVersion);
|
|
@@ -82,7 +81,10 @@ const publishToNpm = async ({ workspace , location , version: providedVersion ,
|
|
|
82
81
|
buildNumber: true
|
|
83
82
|
});
|
|
84
83
|
writePackageCreatorManifest(location, creatorPackage);
|
|
85
|
-
getVersionFileHandler(location)
|
|
84
|
+
const versionFile = getVersionFileHandler(location);
|
|
85
|
+
if (versionFile.exists) {
|
|
86
|
+
versionFile.write(creatorPackage.Package, newVersion);
|
|
87
|
+
}
|
|
86
88
|
const gitVersionInformation = await getVersionInformationFromGit(workspace, location);
|
|
87
89
|
const bannerText = getWorkspaceBannerText(workspaceManifest);
|
|
88
90
|
await buildFolders({
|
|
@@ -137,9 +139,8 @@ const publishToNpm = async ({ workspace , location , version: providedVersion ,
|
|
|
137
139
|
cwd: publishDir
|
|
138
140
|
});
|
|
139
141
|
for (const packageLocation of iterateWorkspacePackages(workspace)){
|
|
140
|
-
var _manifest_dependencies;
|
|
141
142
|
const manifest = readPackageNpmManifest(packageLocation);
|
|
142
|
-
if (
|
|
143
|
+
if (manifest?.dependencies?.[packageJson.name] !== undefined) {
|
|
143
144
|
manifest.dependencies[packageJson.name] = "^" + packageJson.version;
|
|
144
145
|
writePackageNpmManifest(packageLocation, manifest);
|
|
145
146
|
}
|
|
@@ -168,4 +169,4 @@ const copyImagesDirectory = (source, target)=>{
|
|
|
168
169
|
};
|
|
169
170
|
|
|
170
171
|
export { publishToNpm };
|
|
171
|
-
//# sourceMappingURL=publishNpm-
|
|
172
|
+
//# sourceMappingURL=publishNpm-CrnuTwss.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publishNpm-CrnuTwss.mjs","sources":["../src/commands/publishNpm.ts"],"sourcesContent":["import * as path from \"path\";\nimport * as fs from \"fs\";\nimport { execSync } from \"child_process\";\n\nimport {\n\tconsoleReporter,\n\tcreatePackageScopedReporter,\n\tReporter,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nimport { PackageVersion } from \"../lib/packageVersion\";\nimport {\n\tINDEX_FILE,\n\tPackageLocation,\n\tPACKAGE_FILE,\n\treadPackageCreatorIndex,\n\treadPackageCreatorManifest,\n\treadPackageNpmManifest,\n\twritePackageNpmManifest,\n\twritePackageCreatorManifest,\n} from \"../lib/package\";\nimport {\n\tgetWorkspaceOutputPath,\n\titerateWorkspacePackages,\n\treadWorkspaceNpmManifest,\n\tWorkspaceLocation,\n} from \"../lib/workspace\";\nimport { getVersionInformationFromGit } from \"../lib/git\";\nimport { getWorkspaceBannerText } from \"../lib/banner\";\nimport { parseVersionFromString } from \"../lib/parseVersion\";\nimport { getVersionFileHandler } from \"../lib/versionFile\";\n\nimport { buildFolders } from \"./build\";\n\nexport interface PublishToNpmSettings {\n\tworkspace: WorkspaceLocation;\n\tlocation: PackageLocation;\n\tversion: string;\n\tdryRun?: boolean;\n\treporter?: Reporter;\n}\n\nexport const publishToNpm = async ({\n\tworkspace,\n\tlocation,\n\tversion: providedVersion,\n\tdryRun,\n\treporter: providedReporter,\n}: PublishToNpmSettings) => {\n\tlet newVersion: PackageVersion;\n\ttry {\n\t\tnewVersion = parseVersionFromString(providedVersion);\n\t} catch (err) {\n\t\tthrow new Error(`Please enter a version in this format 1.0.0.100`);\n\t}\n\n\tif (newVersion.buildNumber < 100) {\n\t\tnewVersion.preRelease = {\n\t\t\ttype: \"beta\",\n\t\t\tversion: newVersion.buildNumber,\n\t\t};\n\t} else if (newVersion.buildNumber === 100) {\n\t\tnewVersion.preRelease = undefined;\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Refusing to publish a package with a build version larger than 100.`,\n\t\t);\n\t}\n\n\tconst workspaceManifest = readWorkspaceNpmManifest(workspace);\n\tconst workspaceOutputPath = getWorkspaceOutputPath(workspace);\n\tconst creatorPackage = readPackageCreatorManifest(location);\n\n\tconst reporter =\n\t\tprovidedReporter ??\n\t\tcreatePackageScopedReporter(consoleReporter, creatorPackage.Package);\n\n\tlet packageJson = readPackageNpmManifest(location);\n\n\tif (packageJson === undefined) {\n\t\tpackageJson = {\n\t\t\tname:\n\t\t\t\t\"@intelligentgraphics/3d\" +\n\t\t\t\tcreatorPackage.Package.toLowerCase(),\n\t\t\tversion: \"1.0.0\",\n\t\t\tdescription: creatorPackage.Package,\n\t\t};\n\t}\n\n\tpackageJson.version = newVersion.toVersionString({\n\t\tbuildNumber: false,\n\t});\n\tpackageJson.description = newVersion.toDescriptionString(\n\t\tcreatorPackage.Package,\n\t);\n\tpackageJson.main = `${creatorPackage.Package}.js`;\n\tpackageJson.types = `${creatorPackage.Package}.d.ts`;\n\tpackageJson.publishConfig ??= {};\n\tpackageJson.publishConfig.acccess = \"public\";\n\tpackageJson.ig = {\n\t\tscriptingLibrary: true,\n\t};\n\tpackageJson.files = undefined;\n\n\tconst publishDir = path.join(\n\t\tworkspaceOutputPath,\n\t\t\"publish\",\n\t\tcreatorPackage.Package,\n\t);\n\tfs.rmSync(publishDir, { recursive: true, force: true });\n\tfs.mkdirSync(publishDir, { recursive: true });\n\n\twritePackageNpmManifest(location, packageJson);\n\tcreatorPackage.Version = newVersion.toVersionString({ buildNumber: true });\n\twritePackageCreatorManifest(location, creatorPackage);\n\n\tconst versionFile = getVersionFileHandler(location);\n\tif (versionFile.exists) {\n\t\tversionFile.write(creatorPackage.Package, newVersion);\n\t}\n\n\tconst gitVersionInformation = await getVersionInformationFromGit(\n\t\tworkspace,\n\t\tlocation,\n\t);\n\n\tconst bannerText = getWorkspaceBannerText(workspaceManifest);\n\n\tawait buildFolders({\n\t\tworkspace,\n\t\tpackages: [location],\n\t\tminimize: true,\n\t\toutDir: getWorkspaceOutputPath(workspace),\n\t\tbanner: {\n\t\t\ttext: bannerText,\n\t\t\tcommit: gitVersionInformation.commit,\n\t\t\tcommitDirty: gitVersionInformation.dirty,\n\t\t\tversion: newVersion.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t}),\n\t\t\tdate: new Date(Date.now()),\n\t\t},\n\t});\n\n\tfs.copyFileSync(\n\t\tpath.join(\n\t\t\tgetWorkspaceOutputPath(workspace),\n\t\t\t`${creatorPackage.Package}.d.ts`,\n\t\t),\n\t\tpath.join(publishDir, `${creatorPackage.Package}.d.ts`),\n\t);\n\tfs.copyFileSync(\n\t\tpath.join(\n\t\t\tgetWorkspaceOutputPath(workspace),\n\t\t\t`${creatorPackage.Package}.min.js`,\n\t\t),\n\t\tpath.join(publishDir, `${creatorPackage.Package}.js`),\n\t);\n\n\tfs.copyFileSync(\n\t\tpath.join(location.manifestDir, \"package.json\"),\n\t\tpath.join(publishDir, \"package.json\"),\n\t);\n\n\tfs.writeFileSync(\n\t\tpath.join(publishDir, PACKAGE_FILE),\n\t\tJSON.stringify(creatorPackage, null, 2),\n\t);\n\n\tconst index = readPackageCreatorIndex(location);\n\n\tif (index !== undefined) {\n\t\tfs.writeFileSync(\n\t\t\tpath.join(publishDir, INDEX_FILE),\n\t\t\tJSON.stringify(index),\n\t\t);\n\t}\n\n\tconst readmeName = fs\n\t\t.readdirSync(location.path)\n\t\t.find((name) => name.toLowerCase() === \"readme.md\");\n\n\tif (readmeName !== undefined) {\n\t\tfs.copyFileSync(\n\t\t\tpath.join(location.path, readmeName),\n\t\t\tpath.join(publishDir, readmeName),\n\t\t);\n\t}\n\n\tif (creatorPackage.Package === \"IG.GFX.Standard\") {\n\t\tconst source = path.join(location.path, \"Images\");\n\t\tconst target = path.join(publishDir, \"Images\");\n\t\tcopyImagesDirectory(source, target);\n\t}\n\n\tconst npmPublishArgs: string[] = [];\n\n\tif (dryRun) {\n\t\tnpmPublishArgs.push(\"--dry-run\");\n\t}\n\n\tif (newVersion.preRelease) {\n\t\tnpmPublishArgs.push(\"--tag\", \"next\");\n\t}\n\n\treporter.log(\n\t\t`Publishing to npm with version ${packageJson.version} using tag ${\n\t\t\tnewVersion.preRelease ? \"next\" : \"latest\"\n\t\t}`,\n\t);\n\n\texecSync([\"npm\", \"publish\", ...npmPublishArgs].join(\" \"), {\n\t\tstdio: \"inherit\",\n\t\tencoding: \"utf8\",\n\t\tcwd: publishDir,\n\t});\n\n\tfor (const packageLocation of iterateWorkspacePackages(workspace)) {\n\t\tconst manifest = readPackageNpmManifest(packageLocation);\n\n\t\tif (manifest?.dependencies?.[packageJson.name] !== undefined) {\n\t\t\tmanifest.dependencies[packageJson.name] = \"^\" + packageJson.version;\n\t\t\twritePackageNpmManifest(packageLocation, manifest);\n\t\t}\n\t}\n};\n\nconst copyImagesDirectory = (source: string, target: string) => {\n\tfs.mkdirSync(target, { recursive: true });\n\n\tfor (const name of fs.readdirSync(source)) {\n\t\tconst sourcePath = path.join(source, name);\n\t\tconst targetPath = path.join(target, name);\n\n\t\tif (fs.statSync(sourcePath).isDirectory()) {\n\t\t\tcopyImagesDirectory(sourcePath, targetPath);\n\t\t} else {\n\t\t\tif (\n\t\t\t\t[\".png\", \".jpg\", \".jpeg\", \".gif\"].includes(path.extname(name))\n\t\t\t) {\n\t\t\t\tfs.copyFileSync(sourcePath, targetPath);\n\t\t\t}\n\t\t}\n\t}\n};\n"],"names":["publishToNpm","workspace","location","version","providedVersion","dryRun","reporter","providedReporter","newVersion","parseVersionFromString","err","Error","buildNumber","preRelease","type","undefined","workspaceManifest","readWorkspaceNpmManifest","workspaceOutputPath","getWorkspaceOutputPath","creatorPackage","readPackageCreatorManifest","createPackageScopedReporter","consoleReporter","Package","packageJson","readPackageNpmManifest","name","toLowerCase","description","toVersionString","toDescriptionString","main","types","publishConfig","acccess","ig","scriptingLibrary","files","publishDir","path","join","fs","rmSync","recursive","force","mkdirSync","writePackageNpmManifest","Version","writePackageCreatorManifest","versionFile","getVersionFileHandler","exists","write","gitVersionInformation","getVersionInformationFromGit","bannerText","getWorkspaceBannerText","buildFolders","packages","minimize","outDir","banner","text","commit","commitDirty","dirty","date","Date","now","copyFileSync","manifestDir","writeFileSync","PACKAGE_FILE","JSON","stringify","index","readPackageCreatorIndex","INDEX_FILE","readmeName","readdirSync","find","source","target","copyImagesDirectory","npmPublishArgs","push","log","execSync","stdio","encoding","cwd","packageLocation","iterateWorkspacePackages","manifest","dependencies","sourcePath","targetPath","statSync","isDirectory","includes","extname"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CO,MAAMA,YAAAA,GAAe,OAAO,EAClCC,SAAS,EACTC,QAAQ,EACRC,OAAAA,EAASC,eAAe,EACxBC,MAAM,EACNC,QAAAA,EAAUC,gBAAgB,EACJ,GAAA;IACtB,IAAIC,UAAAA;IACJ,IAAI;AACHA,QAAAA,UAAAA,GAAaC,sBAAAA,CAAuBL,eAAAA,CAAAA;AACrC,IAAA,CAAA,CAAE,OAAOM,GAAAA,EAAK;AACb,QAAA,MAAM,IAAIC,KAAAA,CAAM,CAAC,+CAA+C,CAAC,CAAA;AAClE,IAAA;IAEA,IAAIH,UAAAA,CAAWI,WAAW,GAAG,GAAA,EAAK;AACjCJ,QAAAA,UAAAA,CAAWK,UAAU,GAAG;YACvBC,IAAAA,EAAM,MAAA;AACNX,YAAAA,OAAAA,EAASK,WAAWI;AACrB,SAAA;AACD,IAAA,CAAA,MAAO,IAAIJ,UAAAA,CAAWI,WAAW,KAAK,GAAA,EAAK;AAC1CJ,QAAAA,UAAAA,CAAWK,UAAU,GA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AAAA,EAAYC,UAAAA,CAAAA;QACjC,CAAA,MAAO;YACN,IACC;AAAC,gBAAA,MAAA;AAAQ,gBAAA,MAAA;AAAQ,gBAAA,OAAA;AAAS,gBAAA;AAAO,aAAA,CAACG,QAAQ,CAAC5D,IAAAA,CAAK6D,OAAO,CAAC1E,IAAAA,CAAAA,CAAAA,EACvD;gBACDe,EAAAA,CAAG4B,YAAY,CAAC0B,UAAAA,EAAYC,UAAAA,CAAAA;AAC7B,YAAA;AACD,QAAA;AACD,IAAA;AACD,CAAA;;;;"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
import resolve from 'resolve';
|
|
5
|
+
import { rollup, watch } from 'rollup';
|
|
6
|
+
import rollupPluginNodeResolve from '@rollup/plugin-node-resolve';
|
|
7
|
+
import rollupPluginTypescript from '@rollup/plugin-typescript';
|
|
8
|
+
import rollupPluginBabel from '@rollup/plugin-babel';
|
|
9
|
+
import rollupPluginCommonJs from '@rollup/plugin-commonjs';
|
|
10
|
+
import rollupPluginJson from '@rollup/plugin-json';
|
|
11
|
+
import { bundleFromEntryFile } from '@intelligentgraphics/declarationbundler';
|
|
12
|
+
import { a as resolveScriptPackageEntryModule } from './scripts-Bfojy_uD.mjs';
|
|
13
|
+
import 'glob';
|
|
14
|
+
import 'fs';
|
|
15
|
+
import 'write-pkg';
|
|
16
|
+
import 'node:path';
|
|
17
|
+
import 'node:fs';
|
|
18
|
+
import './cli-CuiqZ39_.mjs';
|
|
19
|
+
import 'update-notifier';
|
|
20
|
+
import 'yargs/yargs';
|
|
21
|
+
import 'url';
|
|
22
|
+
import 'assert';
|
|
23
|
+
import 'events';
|
|
24
|
+
import 'util';
|
|
25
|
+
import 'axios';
|
|
26
|
+
import 'inquirer';
|
|
27
|
+
|
|
28
|
+
function createRollupBuildParticipant(location, manifest, outDir) {
|
|
29
|
+
return (env)=>{
|
|
30
|
+
env.onBuildStart();
|
|
31
|
+
(async ()=>{
|
|
32
|
+
try {
|
|
33
|
+
const rollupConfig = getRollupConfig(location, manifest, outDir);
|
|
34
|
+
const build = await rollup(rollupConfig);
|
|
35
|
+
const output = await build.generate(rollupConfig.output);
|
|
36
|
+
env.onBuildEnd({
|
|
37
|
+
type: "success",
|
|
38
|
+
artefacts: processRollupOutput(output, location, manifest)
|
|
39
|
+
});
|
|
40
|
+
} catch (err) {
|
|
41
|
+
env.onBuildEnd({
|
|
42
|
+
type: "error",
|
|
43
|
+
error: String(err)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
})();
|
|
47
|
+
return {
|
|
48
|
+
destroy: ()=>{}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function createRollupWatchBuildParticipant(location, manifest, outDir) {
|
|
53
|
+
return (env)=>{
|
|
54
|
+
env.onBuildStart();
|
|
55
|
+
const rollupConfig = getRollupConfig(location, manifest, outDir);
|
|
56
|
+
const watcher = watch(rollupConfig);
|
|
57
|
+
watcher.on("event", async (event)=>{
|
|
58
|
+
switch(event.code){
|
|
59
|
+
case "BUNDLE_START":
|
|
60
|
+
env.onBuildStart();
|
|
61
|
+
break;
|
|
62
|
+
case "BUNDLE_END":
|
|
63
|
+
const output = await event.result.generate(rollupConfig.output);
|
|
64
|
+
env.onBuildEnd({
|
|
65
|
+
type: "success",
|
|
66
|
+
artefacts: processRollupOutput(output, location, manifest)
|
|
67
|
+
});
|
|
68
|
+
event.result.close();
|
|
69
|
+
break;
|
|
70
|
+
case "ERROR":
|
|
71
|
+
env.onBuildEnd({
|
|
72
|
+
type: "error",
|
|
73
|
+
error: event.error.message
|
|
74
|
+
});
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
destroy: ()=>watcher.close()
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function getRollupConfig(location, manifest, outDir) {
|
|
84
|
+
const entryModule = resolveScriptPackageEntryModule(location, manifest);
|
|
85
|
+
if (entryModule === undefined) {
|
|
86
|
+
throw new Error(`Could not find an entry module`);
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
input: entryModule,
|
|
90
|
+
plugins: [
|
|
91
|
+
rollupPluginNodeResolve(),
|
|
92
|
+
rollupPluginCommonJs(),
|
|
93
|
+
rollupPluginJson(),
|
|
94
|
+
rollupPluginTypescript({
|
|
95
|
+
compilerOptions: {
|
|
96
|
+
rootDir: location.scriptsDir,
|
|
97
|
+
declaration: true,
|
|
98
|
+
declarationDir: outDir,
|
|
99
|
+
module: "esnext",
|
|
100
|
+
target: "esnext"
|
|
101
|
+
},
|
|
102
|
+
tsconfig: path.join(location.scriptsDir, "tsconfig.json"),
|
|
103
|
+
removeComments: false
|
|
104
|
+
}),
|
|
105
|
+
rollupPluginBabel({
|
|
106
|
+
presets: [
|
|
107
|
+
[
|
|
108
|
+
resolve.sync("@babel/preset-env", {
|
|
109
|
+
basedir: import.meta.dirname
|
|
110
|
+
}),
|
|
111
|
+
{
|
|
112
|
+
corejs: "3",
|
|
113
|
+
useBuiltIns: "usage"
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
],
|
|
117
|
+
targets: {
|
|
118
|
+
ie: "11"
|
|
119
|
+
},
|
|
120
|
+
babelHelpers: "bundled",
|
|
121
|
+
extensions: [
|
|
122
|
+
".ts",
|
|
123
|
+
".js"
|
|
124
|
+
],
|
|
125
|
+
sourceMaps: true,
|
|
126
|
+
exclude: /core-js/
|
|
127
|
+
})
|
|
128
|
+
],
|
|
129
|
+
output: {
|
|
130
|
+
format: "iife",
|
|
131
|
+
name: manifest.Scope ?? manifest.Package,
|
|
132
|
+
dir: outDir,
|
|
133
|
+
sourcemap: "hidden"
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function processRollupOutput(output, location, manifest) {
|
|
138
|
+
const [primaryChunk, ...otherOutputs] = output.output;
|
|
139
|
+
const assets = otherOutputs.filter((chunk)=>chunk.type === "asset");
|
|
140
|
+
const sourceMap = assets.find((asset)=>asset.fileName.endsWith(".js.map"));
|
|
141
|
+
const declarationFileMap = new Map(assets.filter((asset)=>asset.fileName.endsWith(".d.ts")).map((asset)=>{
|
|
142
|
+
return [
|
|
143
|
+
path.resolve(location.scriptsDir, asset.fileName).replaceAll("\\", "/"),
|
|
144
|
+
asset.source
|
|
145
|
+
];
|
|
146
|
+
}));
|
|
147
|
+
const declarations = bundleTSDeclarations(declarationFileMap, declarationFileMap.keys().next().value, manifest.Scope ?? manifest.Package);
|
|
148
|
+
return {
|
|
149
|
+
js: primaryChunk.code,
|
|
150
|
+
declarations: declarations,
|
|
151
|
+
sourceMap: sourceMap?.source
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
const referenceRegex = /(\/\/\/ ?<reference .+\/>$)/;
|
|
155
|
+
function bundleTSDeclarations(files, entryFileName, namespace) {
|
|
156
|
+
const references = [];
|
|
157
|
+
for (const [_fileName, content] of files){
|
|
158
|
+
if (content.indexOf("reference") === -1) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
const lines = content.split(os.EOL);
|
|
162
|
+
for(let index = 0; index < lines.length; index++){
|
|
163
|
+
const line = lines[index];
|
|
164
|
+
const match = line.match(referenceRegex);
|
|
165
|
+
if (match === null) {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (!references.includes(match[1])) {
|
|
169
|
+
references.push(match[1]);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const compilerOptions = {
|
|
174
|
+
removeComments: false
|
|
175
|
+
};
|
|
176
|
+
const host = ts.createCompilerHost(compilerOptions, true);
|
|
177
|
+
host.fileExists = (fileName)=>files.has(fileName);
|
|
178
|
+
host.readFile = (fileName)=>files.get(fileName);
|
|
179
|
+
const program = ts.createProgram({
|
|
180
|
+
host,
|
|
181
|
+
options: compilerOptions,
|
|
182
|
+
rootNames: [
|
|
183
|
+
entryFileName
|
|
184
|
+
]
|
|
185
|
+
});
|
|
186
|
+
const mainFile = program.getSourceFile(entryFileName);
|
|
187
|
+
if (mainFile === undefined) {
|
|
188
|
+
throw new Error(`Unexpected: Failed to find compiled declaration entry module`);
|
|
189
|
+
}
|
|
190
|
+
const result = bundleFromEntryFile(namespace, mainFile, program, host, compilerOptions);
|
|
191
|
+
return [
|
|
192
|
+
...references,
|
|
193
|
+
result
|
|
194
|
+
].join(os.EOL);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export { createRollupBuildParticipant, createRollupWatchBuildParticipant };
|
|
198
|
+
//# sourceMappingURL=rollup-UR3DADp8.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup-UR3DADp8.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\";\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): 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);\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(output, location, manifest),\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\tenv.onBuildEnd({ type: \"error\", error: String(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): BuildParticipant {\n\treturn (env: BuilderEnvironment) => {\n\t\tenv.onBuildStart();\n\n\t\tconst rollupConfig = getRollupConfig(location, manifest, outDir);\n\n\t\tconst watcher = watch(rollupConfig);\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\n\t\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\t\ttype: \"success\",\n\t\t\t\t\t\tartefacts: processRollupOutput(\n\t\t\t\t\t\t\toutput,\n\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\tmanifest,\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: event.error.message,\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) {\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\trollupPluginTypescript({\n\t\t\t\tcompilerOptions: {\n\t\t\t\t\trootDir: location.scriptsDir,\n\t\t\t\t\tdeclaration: true,\n\t\t\t\t\tdeclarationDir: 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}),\n\t\t\trollupPluginBabel({\n\t\t\t\tpresets: [\n\t\t\t\t\t[\n\t\t\t\t\t\tresolve.sync(\"@babel/preset-env\", {\n\t\t\t\t\t\t\tbasedir: import.meta.dirname,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcorejs: \"3\",\n\t\t\t\t\t\t\tuseBuiltIns: \"usage\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t],\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} satisfies RollupOptions;\n}\n\nfunction processRollupOutput(\n\toutput: RollupOutput,\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\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\tconst declarationFileMap = new Map(\n\t\tassets\n\t\t\t.filter((asset) => asset.fileName.endsWith(\".d.ts\"))\n\t\t\t.map((asset) => {\n\t\t\t\treturn [\n\t\t\t\t\tpath\n\t\t\t\t\t\t.resolve(location.scriptsDir, asset.fileName)\n\t\t\t\t\t\t.replaceAll(\"\\\\\", \"/\"),\n\t\t\t\t\tasset.source as string,\n\t\t\t\t];\n\t\t\t}),\n\t);\n\n\tconst declarations = bundleTSDeclarations(\n\t\tdeclarationFileMap,\n\t\tdeclarationFileMap.keys().next().value,\n\t\tmanifest.Scope ?? manifest.Package,\n\t);\n\n\treturn {\n\t\tjs: primaryChunk.code,\n\t\tdeclarations: declarations,\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\tcompilerOptions,\n\t);\n\treturn [...references, result].join(os.EOL);\n}\n"],"names":["createRollupBuildParticipant","location","manifest","outDir","env","onBuildStart","rollupConfig","getRollupConfig","build","rollup","output","generate","onBuildEnd","type","artefacts","processRollupOutput","err","error","String","destroy","createRollupWatchBuildParticipant","watcher","watch","on","event","code","result","close","message","entryModule","resolveScriptPackageEntryModule","undefined","Error","input","plugins","rollupPluginNodeResolve","rollupPluginCommonJs","rollupPluginJson","rollupPluginTypescript","compilerOptions","rootDir","scriptsDir","declaration","declarationDir","module","target","tsconfig","path","join","removeComments","rollupPluginBabel","presets","resolve","sync","basedir","dirname","corejs","useBuiltIns","targets","ie","babelHelpers","extensions","sourceMaps","exclude","format","name","Scope","Package","dir","sourcemap","primaryChunk","otherOutputs","assets","filter","chunk","sourceMap","find","asset","fileName","endsWith","declarationFileMap","Map","map","replaceAll","source","declarations","bundleTSDeclarations","keys","next","value","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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,SAASA,4BAAAA,CACfC,QAAyB,EACzBC,QAAwB,EACxBC,MAAc,EAAA;AAEd,IAAA,OAAO,CAACC,GAAAA,GAAAA;AACPA,QAAAA,GAAAA,CAAIC,YAAY,EAAA;QAEf,CAAA,UAAA;YACA,IAAI;gBACH,MAAMC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
1
|
+
import glob from 'glob';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import ts from 'typescript';
|
|
5
|
+
import 'resolve';
|
|
6
|
+
import 'write-pkg';
|
|
7
|
+
import 'node:path';
|
|
8
|
+
import 'node:fs';
|
|
9
|
+
import './cli-CuiqZ39_.mjs';
|
|
10
|
+
import 'axios';
|
|
11
|
+
|
|
12
|
+
const getPackageTypescriptFiles = (location)=>glob.sync("**/*.ts", {
|
|
13
|
+
absolute: true,
|
|
14
|
+
cwd: location.scriptsDir,
|
|
15
|
+
ignore: "node_modules/**/*"
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
function resolveScriptPackageEntryModule(location, manifest) {
|
|
19
|
+
let candidates = [
|
|
20
|
+
"index.ts"
|
|
21
|
+
];
|
|
22
|
+
if (manifest.Type === "Context") {
|
|
23
|
+
candidates.push("Context.ts");
|
|
24
|
+
}
|
|
25
|
+
for (const candidate of candidates){
|
|
26
|
+
const candidatePath = path.join(location.scriptsDir, candidate);
|
|
27
|
+
if (fs.existsSync(candidatePath)) {
|
|
28
|
+
return candidatePath;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function readScriptPackageTSConfig(location) {
|
|
33
|
+
const { config } = ts.readConfigFile(path.join(location.scriptsDir, "tsconfig.json"), (path)=>{
|
|
34
|
+
try {
|
|
35
|
+
return fs.readFileSync(path, "utf8");
|
|
36
|
+
} catch {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const parsedTsConfig = ts.parseJsonConfigFileContent(config, ts.sys, location.scriptsDir);
|
|
41
|
+
return parsedTsConfig;
|
|
42
|
+
}
|
|
43
|
+
function isScriptPackageModules(options) {
|
|
44
|
+
return options.module === ts.ModuleKind.ES2015;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { resolveScriptPackageEntryModule as a, getPackageTypescriptFiles as g, isScriptPackageModules as i, readScriptPackageTSConfig as r };
|
|
48
|
+
//# sourceMappingURL=scripts-Bfojy_uD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scripts-Bfojy_uD.mjs","sources":["../../tools.core/build/scripts.mjs","../src/lib/scripts.ts"],"sourcesContent":["import 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":";;;;;;;;;;;AAEA,MAAMA,4BAA4B,CAACC,QAAAA,GAAWC,IAAAA,CAAKC,IAAI,CAAC,SAAA,EAAW;QAC3DC,QAAAA,EAAU,IAAA;AACVC,QAAAA,GAAAA,EAAKJ,SAASK,UAAU;QACxBC,MAAAA,EAAQ;AACZ,KAAA;;ACKG,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;;;;"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import simpleGit from 'simple-git';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { P as PackageVersion } from './index-B2kXo6K7.mjs';
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import 'resolve';
|
|
6
|
+
import 'write-pkg';
|
|
7
|
+
import { i as isErrorENOENT } from './cli-CuiqZ39_.mjs';
|
|
8
|
+
import 'glob';
|
|
9
|
+
import 'node:path';
|
|
10
|
+
import 'node:fs';
|
|
11
|
+
import 'axios';
|
|
12
|
+
|
|
13
|
+
const readStringFromFile = (filePath)=>fs.readFileSync(filePath, {
|
|
14
|
+
encoding: "utf8"
|
|
15
|
+
});
|
|
16
|
+
const readStringFromFileOrUndefined = (filePath)=>{
|
|
17
|
+
try {
|
|
18
|
+
return readStringFromFile(filePath);
|
|
19
|
+
} catch (err) {
|
|
20
|
+
if (!isErrorENOENT(err)) {
|
|
21
|
+
throw err;
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const getVersionInformationFromGit = async (workspaceLocation, packageLocation)=>{
|
|
28
|
+
try {
|
|
29
|
+
const git = simpleGit({
|
|
30
|
+
baseDir: workspaceLocation.path
|
|
31
|
+
});
|
|
32
|
+
// check wether the files for a folder are changed
|
|
33
|
+
// if so, mark as dirty
|
|
34
|
+
const diff = await git.diffSummary();
|
|
35
|
+
const dirty = diff.files.some((file)=>{
|
|
36
|
+
if (file.file.toLowerCase().includes("releases") || file.file.toLowerCase().endsWith("version.ts") || file.file.toLowerCase().endsWith("package.json")) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const fullPath = path.resolve(workspaceLocation.path, file.file);
|
|
40
|
+
const relativePath = path.relative(packageLocation.path, fullPath);
|
|
41
|
+
return !relativePath.startsWith("..");
|
|
42
|
+
});
|
|
43
|
+
const log = await git.log({
|
|
44
|
+
maxCount: 1
|
|
45
|
+
});
|
|
46
|
+
const commit = !log.latest?.hash ? undefined : log.latest.hash.substring(0, 7);
|
|
47
|
+
return {
|
|
48
|
+
commit,
|
|
49
|
+
dirty,
|
|
50
|
+
commitDate: log.latest?.date
|
|
51
|
+
};
|
|
52
|
+
} catch (err) {
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const getWorkspaceBannerText = (manifest)=>{
|
|
58
|
+
let bannerText = manifest?.packager?.banner;
|
|
59
|
+
if (bannerText) {
|
|
60
|
+
const match = bannerText.match(/Copyright \(C\) (\d+)( ?- ?(\d+))?/);
|
|
61
|
+
if (match !== null) {
|
|
62
|
+
const startYear = parseInt(match[1]);
|
|
63
|
+
const endYear = new Date().getFullYear();
|
|
64
|
+
if (startYear !== endYear) {
|
|
65
|
+
bannerText = bannerText.replace(match[0], `Copyright (C) ${startYear} - ${endYear}`);
|
|
66
|
+
} else {
|
|
67
|
+
bannerText = bannerText.replace(match[0], `Copyright (C) ${startYear}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return bannerText;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const parseVersionFromString = (input)=>{
|
|
75
|
+
if (input === undefined) {
|
|
76
|
+
throw new Error(`Can not parse version from undefined`);
|
|
77
|
+
}
|
|
78
|
+
let match;
|
|
79
|
+
let major;
|
|
80
|
+
let minor;
|
|
81
|
+
let patch;
|
|
82
|
+
let build;
|
|
83
|
+
let preReleaseType;
|
|
84
|
+
let preReleaseNumber;
|
|
85
|
+
if (// first try to find a full match with build number
|
|
86
|
+
(match = input.match(/(\d+)\.(\d+)\.(\d+)\.(\d+)(-([^\.]+)\.(\d+))?/)) !== null) {
|
|
87
|
+
[, major, minor, patch, build, preReleaseType, preReleaseNumber] = match;
|
|
88
|
+
} else if ((match = input.match(/(\d+)\.(\d+)\.(\d+)(-([^\.]+)\.(\d+))?/)) !== null) {
|
|
89
|
+
[, major, minor, patch, , preReleaseType, preReleaseNumber] = match;
|
|
90
|
+
}
|
|
91
|
+
if (match === null) {
|
|
92
|
+
throw new Error(`Could not parse version from input: ${input}`);
|
|
93
|
+
}
|
|
94
|
+
let preRelease = undefined;
|
|
95
|
+
let buildNumber = 100;
|
|
96
|
+
if (preReleaseType && preReleaseNumber) {
|
|
97
|
+
preRelease = {
|
|
98
|
+
type: preReleaseType,
|
|
99
|
+
version: parseInt(preReleaseNumber)
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (build) {
|
|
103
|
+
buildNumber = Number(build);
|
|
104
|
+
} else if (input) {
|
|
105
|
+
const descriptionMatch = input.match(/(\d+)\)$/);
|
|
106
|
+
if (descriptionMatch) {
|
|
107
|
+
buildNumber = parseInt(descriptionMatch[1]);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return new PackageVersion(parseInt(major), parseInt(minor), parseInt(patch), preRelease, buildNumber);
|
|
111
|
+
};
|
|
112
|
+
// 1000001001 -> 1.0.1.1
|
|
113
|
+
// 1002017001 -> 1.2.17.1
|
|
114
|
+
const parseVersionFromNumericVersion = (version)=>{
|
|
115
|
+
const major = Math.floor(version / 1000000000);
|
|
116
|
+
const minor = Math.floor(version % 1000000000 / 1000000);
|
|
117
|
+
const patch = Math.floor(version % 1000000 / 1000);
|
|
118
|
+
const buildNumber = version % 1000;
|
|
119
|
+
return new PackageVersion(major, minor, patch, undefined, buildNumber);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// https://regex101.com/r/LtGAu5/1
|
|
123
|
+
const logRegex = /console\.log\(\s*"([\w\s\.\(\)]+)\ *Copyright[\w\s\(\)\.]+(\d{4}|\d{4} - \d{4})([\w\s\(\)\.]+)?",?\s*\)/i;
|
|
124
|
+
const currentYear = new Date(Date.now()).getFullYear();
|
|
125
|
+
function getVersionFileHandler(location) {
|
|
126
|
+
const filePath = path.join(location.scriptsDir, "Version.ts");
|
|
127
|
+
function invalidVersionFile(versionFile, exists) {
|
|
128
|
+
return {
|
|
129
|
+
exists,
|
|
130
|
+
write: (name, newVersion)=>{
|
|
131
|
+
const scriptsContent = fs.readdirSync(location.scriptsDir);
|
|
132
|
+
const tsFiles = scriptsContent.filter((file)=>file.endsWith(".ts"));
|
|
133
|
+
if (tsFiles.length > 0) {
|
|
134
|
+
return createVersionFileWriter([
|
|
135
|
+
currentYear
|
|
136
|
+
], "")(name, newVersion);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
reset: ()=>{
|
|
140
|
+
if (versionFile !== undefined) {
|
|
141
|
+
fs.writeFileSync(filePath, versionFile, {
|
|
142
|
+
encoding: "utf8"
|
|
143
|
+
});
|
|
144
|
+
} else {
|
|
145
|
+
try {
|
|
146
|
+
fs.rmSync(filePath);
|
|
147
|
+
} catch (err) {
|
|
148
|
+
if (!isErrorENOENT(err)) {
|
|
149
|
+
throw err;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function createVersionFileWriter(copyright = [
|
|
157
|
+
currentYear
|
|
158
|
+
], copyrightStuff = "") {
|
|
159
|
+
return (name, newVersion)=>{
|
|
160
|
+
const descriptionText = newVersion.toDescriptionString(name);
|
|
161
|
+
const copyrightText = createYearString(copyright);
|
|
162
|
+
const result = `console.log("${descriptionText}. Copyright (C) ${copyrightText}${copyrightStuff}");`;
|
|
163
|
+
fs.writeFileSync(filePath, result, {
|
|
164
|
+
encoding: "utf-8"
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
let rawVersionFile = readStringFromFileOrUndefined(filePath);
|
|
169
|
+
if (rawVersionFile === undefined) {
|
|
170
|
+
return invalidVersionFile(rawVersionFile, false);
|
|
171
|
+
}
|
|
172
|
+
const versionFile = rawVersionFile.replace(/\n/g, "");
|
|
173
|
+
const match = versionFile.match(logRegex);
|
|
174
|
+
if (!match) {
|
|
175
|
+
return invalidVersionFile(versionFile, true);
|
|
176
|
+
}
|
|
177
|
+
const [_full, _description, copyright, copyrightStuff] = match;
|
|
178
|
+
const copyrightYears = copyright.match(/^(\d+)( ?- ?(\d+))?$/);
|
|
179
|
+
let years;
|
|
180
|
+
if (copyrightYears === null) {
|
|
181
|
+
years = [
|
|
182
|
+
currentYear
|
|
183
|
+
];
|
|
184
|
+
} else {
|
|
185
|
+
years = [
|
|
186
|
+
Number(copyrightYears[1]),
|
|
187
|
+
currentYear
|
|
188
|
+
];
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
exists: true,
|
|
192
|
+
write: createVersionFileWriter(years, copyrightStuff),
|
|
193
|
+
reset: ()=>{
|
|
194
|
+
fs.writeFileSync(filePath, versionFile, {
|
|
195
|
+
encoding: "utf8"
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
const createYearString = (years)=>{
|
|
201
|
+
if (years[1] === undefined || years[0] === years[1]) {
|
|
202
|
+
return years[0].toString();
|
|
203
|
+
}
|
|
204
|
+
return `${years[0]} - ${years[1]}`;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export { parseVersionFromString as a, getVersionInformationFromGit as b, getWorkspaceBannerText as c, getVersionFileHandler as g, parseVersionFromNumericVersion as p };
|
|
208
|
+
//# sourceMappingURL=versionFile-DSqOw-XB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versionFile-DSqOw-XB.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":";;;;;;;;;;;;AAGA,MAAMA,qBAAqB,CAACC,QAAAA,GAAWC,EAAAA,CAAGC,YAAY,CAACF,QAAAA,EAAU;QACzDG,QAAAA,EAAU;AACd,KAAA,CAAA;AACJ,MAAMC,gCAAgC,CAACJ,QAAAA,GAAAA;IACnC,IAAI;AACA,QAAA,OAAOD,kBAAAA,CAAmBC,QAAAA,CAAAA;AAC9B,IAAA,CAA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