@intelligentgraphics/ig.gfx.packager 3.1.4 → 3.2.1
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.js +8 -0
- package/build/bin.js.map +1 -0
- package/build/build-CMbCj7x-.js +945 -0
- package/build/build-CMbCj7x-.js.map +1 -0
- package/build/build-kkMVBBJL.js +408 -0
- package/build/build-kkMVBBJL.js.map +1 -0
- package/build/cli-Co1DhAmx.js +405 -0
- package/build/cli-Co1DhAmx.js.map +1 -0
- package/build/docs-BkGeoYY2.js +30 -0
- package/build/docs-BkGeoYY2.js.map +1 -0
- package/build/generateIndex-C_DxQ2R4.js +209 -0
- package/build/generateIndex-C_DxQ2R4.js.map +1 -0
- package/build/generateParameterType-CdCi5BWM.js +46 -0
- package/build/generateParameterType-CdCi5BWM.js.map +1 -0
- package/build/package-DHx2bvVO.js +1 -0
- package/build/postinstall-DHTlEmNr.js +35 -0
- package/build/postinstall-DHTlEmNr.js.map +1 -0
- package/build/prompter-DONgUlzS.js +20 -0
- package/build/prompter-DONgUlzS.js.map +1 -0
- package/build/publish-E5zcQAo0.js +348 -0
- package/build/publish-E5zcQAo0.js.map +1 -0
- package/build/publishNpm-CBT1819u.js +115 -0
- package/build/publishNpm-CBT1819u.js.map +1 -0
- package/build/publishedPackage-D-KiU0FG.js +1 -0
- package/build/rollup-Csyght27.js +179 -0
- package/build/rollup-Csyght27.js.map +1 -0
- package/build/scripts-CBblHIL1.js +29 -0
- package/build/scripts-CBblHIL1.js.map +1 -0
- package/build/versionFile-DViDwgCa.js +123 -0
- package/build/versionFile-DViDwgCa.js.map +1 -0
- package/build/workspace-D0XY2EMu.js +1 -0
- package/lib/lib.js +1595 -0
- package/package.json +30 -30
- package/readme.md +7 -0
- package/build/bin.mjs +0 -5
- package/build/bin.mjs.map +0 -1
- package/build/cli-CTqQeYIu.mjs +0 -768
- package/build/cli-CTqQeYIu.mjs.map +0 -1
- package/build/dependencies-CCIr5dgH.mjs +0 -129
- package/build/dependencies-CCIr5dgH.mjs.map +0 -1
- package/build/docs-DvFV9WXA.mjs +0 -37
- package/build/docs-DvFV9WXA.mjs.map +0 -1
- package/build/generateIndex-COnAgsMM.mjs +0 -306
- package/build/generateIndex-COnAgsMM.mjs.map +0 -1
- package/build/generateParameterType-BFVUv72F.mjs +0 -71
- package/build/generateParameterType-BFVUv72F.mjs.map +0 -1
- package/build/index-Ck4_b8Wk.mjs +0 -1400
- package/build/index-Ck4_b8Wk.mjs.map +0 -1
- package/build/index-DHSUlJia.mjs +0 -477
- package/build/index-DHSUlJia.mjs.map +0 -1
- package/build/postinstall-BTuIhY_F.mjs +0 -61
- package/build/postinstall-BTuIhY_F.mjs.map +0 -1
- package/build/publishNpm-A02qW1UY.mjs +0 -167
- package/build/publishNpm-A02qW1UY.mjs.map +0 -1
- package/build/rollup-BeQ0dM8U.mjs +0 -221
- package/build/rollup-BeQ0dM8U.mjs.map +0 -1
- package/build/scripts-B3noxiX3.mjs +0 -45
- package/build/scripts-B3noxiX3.mjs.map +0 -1
- package/build/versionFile-B9z_qwQL.mjs +0 -206
- package/build/versionFile-B9z_qwQL.mjs.map +0 -1
- package/lib/lib.mjs +0 -2706
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import { execSync } from 'child_process';
|
|
4
|
-
import 'resolve';
|
|
5
|
-
import 'write-package';
|
|
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-CTqQeYIu.mjs';
|
|
7
|
-
import { c as createPackageScopedReporter, a as consoleReporter, b as buildFolders } from './index-Ck4_b8Wk.mjs';
|
|
8
|
-
import 'glob';
|
|
9
|
-
import 'axios';
|
|
10
|
-
import { a as parseVersionFromString, g as getVersionFileHandler, b as getVersionInformationFromGit, c as getWorkspaceBannerText } from './versionFile-B9z_qwQL.mjs';
|
|
11
|
-
import 'update-notifier';
|
|
12
|
-
import 'yargs/yargs';
|
|
13
|
-
import 'url';
|
|
14
|
-
import '@inquirer/prompts';
|
|
15
|
-
import 'fs/promises';
|
|
16
|
-
import 'terser';
|
|
17
|
-
import 'os';
|
|
18
|
-
import 'typescript';
|
|
19
|
-
import './scripts-B3noxiX3.mjs';
|
|
20
|
-
import 'events';
|
|
21
|
-
import 'source-map-js';
|
|
22
|
-
import 'ajv';
|
|
23
|
-
import 'simple-git';
|
|
24
|
-
|
|
25
|
-
const publishToNpm = async ({ workspace, location, version: providedVersion, dryRun, reporter: providedReporter })=>{
|
|
26
|
-
let newVersion;
|
|
27
|
-
try {
|
|
28
|
-
newVersion = parseVersionFromString(providedVersion);
|
|
29
|
-
} catch (err) {
|
|
30
|
-
throw new Error(`Please enter a version in this format 1.0.0.100`);
|
|
31
|
-
}
|
|
32
|
-
if (newVersion.buildNumber < 100) {
|
|
33
|
-
newVersion.preRelease = {
|
|
34
|
-
type: "beta",
|
|
35
|
-
version: newVersion.buildNumber
|
|
36
|
-
};
|
|
37
|
-
} else if (newVersion.buildNumber === 100) {
|
|
38
|
-
newVersion.preRelease = undefined;
|
|
39
|
-
} else {
|
|
40
|
-
throw new Error(`Refusing to publish a package with a build version larger than 100.`);
|
|
41
|
-
}
|
|
42
|
-
const workspaceManifest = readWorkspaceNpmManifest(workspace);
|
|
43
|
-
const workspaceOutputPath = getWorkspaceOutputPath(workspace);
|
|
44
|
-
const creatorPackage = readPackageCreatorManifest(location);
|
|
45
|
-
const reporter = providedReporter ?? createPackageScopedReporter(consoleReporter, creatorPackage.Package);
|
|
46
|
-
let packageJson = readPackageNpmManifest(location);
|
|
47
|
-
if (packageJson === undefined) {
|
|
48
|
-
packageJson = {
|
|
49
|
-
name: "@intelligentgraphics/3d" + creatorPackage.Package.toLowerCase(),
|
|
50
|
-
version: "1.0.0",
|
|
51
|
-
description: creatorPackage.Package
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
packageJson.version = newVersion.toVersionString({
|
|
55
|
-
buildNumber: false
|
|
56
|
-
});
|
|
57
|
-
packageJson.description = newVersion.toDescriptionString(creatorPackage.Package);
|
|
58
|
-
packageJson.main = `${creatorPackage.Package}.js`;
|
|
59
|
-
packageJson.types = `${creatorPackage.Package}.d.ts`;
|
|
60
|
-
packageJson.publishConfig ??= {};
|
|
61
|
-
packageJson.publishConfig.acccess = "public";
|
|
62
|
-
packageJson.ig = {
|
|
63
|
-
scriptingLibrary: true
|
|
64
|
-
};
|
|
65
|
-
packageJson.files = undefined;
|
|
66
|
-
const publishDir = path.join(workspaceOutputPath, "publish", creatorPackage.Package);
|
|
67
|
-
fs.rmSync(publishDir, {
|
|
68
|
-
recursive: true,
|
|
69
|
-
force: true
|
|
70
|
-
});
|
|
71
|
-
fs.mkdirSync(publishDir, {
|
|
72
|
-
recursive: true
|
|
73
|
-
});
|
|
74
|
-
writePackageNpmManifest(location, packageJson);
|
|
75
|
-
creatorPackage.Version = newVersion.toVersionString({
|
|
76
|
-
buildNumber: true
|
|
77
|
-
});
|
|
78
|
-
writePackageCreatorManifest(location, creatorPackage);
|
|
79
|
-
const versionFile = getVersionFileHandler(location);
|
|
80
|
-
if (versionFile.exists) {
|
|
81
|
-
versionFile.write(creatorPackage.Package, newVersion);
|
|
82
|
-
}
|
|
83
|
-
const gitVersionInformation = await getVersionInformationFromGit(workspace, location);
|
|
84
|
-
const bannerText = getWorkspaceBannerText(workspaceManifest);
|
|
85
|
-
await buildFolders({
|
|
86
|
-
workspace,
|
|
87
|
-
packages: [
|
|
88
|
-
location
|
|
89
|
-
],
|
|
90
|
-
minimize: true,
|
|
91
|
-
outDir: getWorkspaceOutputPath(workspace),
|
|
92
|
-
banner: {
|
|
93
|
-
text: bannerText,
|
|
94
|
-
commit: gitVersionInformation.commit,
|
|
95
|
-
commitDirty: gitVersionInformation.dirty,
|
|
96
|
-
version: newVersion.toVersionString({
|
|
97
|
-
buildNumber: true
|
|
98
|
-
}),
|
|
99
|
-
date: new Date(Date.now())
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
fs.copyFileSync(path.join(getWorkspaceOutputPath(workspace), `${creatorPackage.Package}.d.ts`), path.join(publishDir, `${creatorPackage.Package}.d.ts`));
|
|
103
|
-
fs.copyFileSync(path.join(getWorkspaceOutputPath(workspace), `${creatorPackage.Package}.min.js`), path.join(publishDir, `${creatorPackage.Package}.js`));
|
|
104
|
-
fs.copyFileSync(path.join(location.manifestDir, "package.json"), path.join(publishDir, "package.json"));
|
|
105
|
-
fs.writeFileSync(path.join(publishDir, PACKAGE_FILE), JSON.stringify(creatorPackage, null, 2));
|
|
106
|
-
const index = readPackageCreatorIndex(location);
|
|
107
|
-
if (index !== undefined) {
|
|
108
|
-
fs.writeFileSync(path.join(publishDir, INDEX_FILE), JSON.stringify(index));
|
|
109
|
-
}
|
|
110
|
-
const readmeName = fs.readdirSync(location.path).find((name)=>name.toLowerCase() === "readme.md");
|
|
111
|
-
if (readmeName !== undefined) {
|
|
112
|
-
fs.copyFileSync(path.join(location.path, readmeName), path.join(publishDir, readmeName));
|
|
113
|
-
}
|
|
114
|
-
if (creatorPackage.Package === "IG.GFX.Standard") {
|
|
115
|
-
const source = path.join(location.path, "Images");
|
|
116
|
-
const target = path.join(publishDir, "Images");
|
|
117
|
-
copyImagesDirectory(source, target);
|
|
118
|
-
}
|
|
119
|
-
const npmPublishArgs = [];
|
|
120
|
-
if (dryRun) {
|
|
121
|
-
npmPublishArgs.push("--dry-run");
|
|
122
|
-
}
|
|
123
|
-
if (newVersion.preRelease) {
|
|
124
|
-
npmPublishArgs.push("--tag", "next");
|
|
125
|
-
}
|
|
126
|
-
reporter.log(`Publishing to npm with version ${packageJson.version} using tag ${newVersion.preRelease ? "next" : "latest"}`);
|
|
127
|
-
execSync([
|
|
128
|
-
"npm",
|
|
129
|
-
"publish",
|
|
130
|
-
...npmPublishArgs
|
|
131
|
-
].join(" "), {
|
|
132
|
-
stdio: "inherit",
|
|
133
|
-
encoding: "utf8",
|
|
134
|
-
cwd: publishDir
|
|
135
|
-
});
|
|
136
|
-
for (const packageLocation of iterateWorkspacePackages(workspace)){
|
|
137
|
-
const manifest = readPackageNpmManifest(packageLocation);
|
|
138
|
-
if (manifest?.dependencies?.[packageJson.name] !== undefined) {
|
|
139
|
-
manifest.dependencies[packageJson.name] = "^" + packageJson.version;
|
|
140
|
-
writePackageNpmManifest(packageLocation, manifest);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
const copyImagesDirectory = (source, target)=>{
|
|
145
|
-
fs.mkdirSync(target, {
|
|
146
|
-
recursive: true
|
|
147
|
-
});
|
|
148
|
-
for (const name of fs.readdirSync(source)){
|
|
149
|
-
const sourcePath = path.join(source, name);
|
|
150
|
-
const targetPath = path.join(target, name);
|
|
151
|
-
if (fs.statSync(sourcePath).isDirectory()) {
|
|
152
|
-
copyImagesDirectory(sourcePath, targetPath);
|
|
153
|
-
} else {
|
|
154
|
-
if ([
|
|
155
|
-
".png",
|
|
156
|
-
".jpg",
|
|
157
|
-
".jpeg",
|
|
158
|
-
".gif"
|
|
159
|
-
].includes(path.extname(name))) {
|
|
160
|
-
fs.copyFileSync(sourcePath, targetPath);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
export { publishToNpm };
|
|
167
|
-
//# sourceMappingURL=publishNpm-A02qW1UY.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"publishNpm-A02qW1UY.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,GAAGE,SAAAA;IACzB,CAAA,MAAO;AACN,QAAA,MAAM,IAAIJ,KAAAA,CACT,CAAC,mEAAmE,CAAC,CAAA;AAEvE,IAAA;AAEA,IAAA,MAAMK,oBAAoBC,wBAAAA,CAAyBhB,SAAAA,CAAAA;AACnD,IAAA,MAAMiB,sBAAsBC,sBAAAA,CAAuBlB,SAAAA,CAAAA;AACnD,IAAA,MAAMmB,iBAAiBC,0BAAAA,CAA2BnB,QAAAA,CAAAA;AAElD,IAAA,MAAMI,QAAAA,GACLC,gBAAAA,IACAe,2BAAAA,CAA4BC,eAAAA,EAAiBH,eAAeI,OAAO,CAAA;AAEpE,IAAA,IAAIC,cAAcC,sBAAAA,CAAuBxB,QAAAA,CAAAA;AAEzC,IAAA,IAAIuB,gBAA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{ 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 rollupPluginAlias from '@rollup/plugin-alias';
|
|
12
|
-
import babelPresetEs5 from '@intelligentgraphics/ig.gfx.packager-babel-preset-es5';
|
|
13
|
-
import { bundleFromEntryFile } from '@intelligentgraphics/declarationbundler';
|
|
14
|
-
import { a as resolveScriptPackageEntryModule } from './scripts-B3noxiX3.mjs';
|
|
15
|
-
import 'glob';
|
|
16
|
-
import 'fs';
|
|
17
|
-
import 'write-package';
|
|
18
|
-
import 'axios';
|
|
19
|
-
|
|
20
|
-
function createRollupBuildParticipant(location, manifest, outDir, skipDeclarations) {
|
|
21
|
-
return (env)=>{
|
|
22
|
-
env.onBuildStart();
|
|
23
|
-
(async ()=>{
|
|
24
|
-
try {
|
|
25
|
-
const rollupConfig = getRollupConfig(location, manifest, outDir, skipDeclarations, env);
|
|
26
|
-
const build = await rollup(rollupConfig);
|
|
27
|
-
const output = await build.generate(rollupConfig.output);
|
|
28
|
-
env.onBuildEnd({
|
|
29
|
-
type: "success",
|
|
30
|
-
artefacts: processRollupOutput(output, location, manifest, rollupConfig.input, skipDeclarations)
|
|
31
|
-
});
|
|
32
|
-
} catch (err) {
|
|
33
|
-
env.onBuildEnd({
|
|
34
|
-
type: "error",
|
|
35
|
-
error: err
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
})();
|
|
39
|
-
return {
|
|
40
|
-
destroy: ()=>{}
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function createRollupWatchBuildParticipant(location, manifest, outDir, skipDeclarations) {
|
|
45
|
-
return (env)=>{
|
|
46
|
-
env.onBuildStart();
|
|
47
|
-
const rollupConfig = getRollupConfig(location, manifest, outDir, skipDeclarations, env);
|
|
48
|
-
const watcher = watch({
|
|
49
|
-
...rollupConfig,
|
|
50
|
-
watch: {
|
|
51
|
-
skipWrite: true
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
watcher.on("event", async (event)=>{
|
|
55
|
-
switch(event.code){
|
|
56
|
-
case "BUNDLE_START":
|
|
57
|
-
env.onBuildStart();
|
|
58
|
-
break;
|
|
59
|
-
case "BUNDLE_END":
|
|
60
|
-
const output = await event.result.generate(rollupConfig.output);
|
|
61
|
-
try {
|
|
62
|
-
env.onBuildEnd({
|
|
63
|
-
type: "success",
|
|
64
|
-
artefacts: processRollupOutput(output, location, manifest, rollupConfig.input, skipDeclarations)
|
|
65
|
-
});
|
|
66
|
-
} catch (err) {
|
|
67
|
-
env.onBuildEnd({
|
|
68
|
-
type: "error",
|
|
69
|
-
error: err
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
event.result.close();
|
|
73
|
-
break;
|
|
74
|
-
case "ERROR":
|
|
75
|
-
env.onBuildEnd({
|
|
76
|
-
type: "error",
|
|
77
|
-
error: Object.assign(new Error(event.error.message), event.error)
|
|
78
|
-
});
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
return {
|
|
83
|
-
destroy: ()=>watcher.close()
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
function getRollupConfig(location, manifest, outDir, skipDeclarations, env) {
|
|
88
|
-
const entryModule = resolveScriptPackageEntryModule(location, manifest);
|
|
89
|
-
if (entryModule === undefined) {
|
|
90
|
-
throw new Error(`Could not find an entry module`);
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
input: entryModule,
|
|
94
|
-
plugins: [
|
|
95
|
-
rollupPluginNodeResolve(),
|
|
96
|
-
rollupPluginCommonJs(),
|
|
97
|
-
rollupPluginJson(),
|
|
98
|
-
rollupPluginAlias({
|
|
99
|
-
entries: [
|
|
100
|
-
{
|
|
101
|
-
find: /^core-js(.*)/,
|
|
102
|
-
replacement: path.join(path.dirname(resolve.sync("core-js", {
|
|
103
|
-
basedir: import.meta.dirname
|
|
104
|
-
})), "/$1")
|
|
105
|
-
}
|
|
106
|
-
]
|
|
107
|
-
}),
|
|
108
|
-
rollupPluginTypescript({
|
|
109
|
-
compilerOptions: {
|
|
110
|
-
rootDir: skipDeclarations ? undefined : location.scriptsDir,
|
|
111
|
-
declaration: !skipDeclarations,
|
|
112
|
-
declarationDir: skipDeclarations ? undefined : outDir,
|
|
113
|
-
module: "esnext",
|
|
114
|
-
target: "esnext"
|
|
115
|
-
},
|
|
116
|
-
tsconfig: path.join(location.scriptsDir, "tsconfig.json"),
|
|
117
|
-
removeComments: false,
|
|
118
|
-
filterRoot: skipDeclarations ? false : undefined,
|
|
119
|
-
incremental: false,
|
|
120
|
-
noEmitOnError: false
|
|
121
|
-
}),
|
|
122
|
-
rollupPluginBabel({
|
|
123
|
-
presets: [
|
|
124
|
-
[
|
|
125
|
-
babelPresetEs5,
|
|
126
|
-
{}
|
|
127
|
-
]
|
|
128
|
-
],
|
|
129
|
-
targets: {
|
|
130
|
-
ie: "11"
|
|
131
|
-
},
|
|
132
|
-
babelHelpers: "bundled",
|
|
133
|
-
extensions: [
|
|
134
|
-
".ts",
|
|
135
|
-
".js"
|
|
136
|
-
],
|
|
137
|
-
sourceMaps: true,
|
|
138
|
-
exclude: /core-js/
|
|
139
|
-
})
|
|
140
|
-
],
|
|
141
|
-
output: {
|
|
142
|
-
format: "iife",
|
|
143
|
-
name: manifest.Scope ?? manifest.Package,
|
|
144
|
-
dir: outDir,
|
|
145
|
-
sourcemap: "hidden",
|
|
146
|
-
extend: true
|
|
147
|
-
},
|
|
148
|
-
onLog: createLogger(env)
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
function createLogger(env) {
|
|
152
|
-
return (level, log, _handler)=>{
|
|
153
|
-
env.log(log.message);
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
function processRollupOutput(output, location, manifest, entryModulePath, skipDeclarations) {
|
|
157
|
-
const [primaryChunk, ...otherOutputs] = output.output;
|
|
158
|
-
const assets = otherOutputs.filter((chunk)=>chunk.type === "asset");
|
|
159
|
-
const sourceMap = assets.find((asset)=>asset.fileName.endsWith(".js.map"));
|
|
160
|
-
let declarations;
|
|
161
|
-
if (!skipDeclarations) {
|
|
162
|
-
const declarationFileMap = new Map(assets.filter((asset)=>asset.fileName.endsWith(".d.ts")).map((asset)=>{
|
|
163
|
-
return [
|
|
164
|
-
path.resolve(location.scriptsDir, asset.fileName).replaceAll("\\", "/"),
|
|
165
|
-
asset.source
|
|
166
|
-
];
|
|
167
|
-
}));
|
|
168
|
-
const entryModulePathWithDts = path.join(path.dirname(entryModulePath), path.basename(entryModulePath, path.extname(entryModulePath)) + ".d.ts");
|
|
169
|
-
declarations = bundleTSDeclarations(declarationFileMap, entryModulePathWithDts, manifest.Scope ?? manifest.Package);
|
|
170
|
-
}
|
|
171
|
-
return {
|
|
172
|
-
js: primaryChunk.code,
|
|
173
|
-
declarations,
|
|
174
|
-
sourceMap: sourceMap?.source
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
const referenceRegex = /(\/\/\/ ?<reference .+\/>$)/;
|
|
178
|
-
function bundleTSDeclarations(files, entryFileName, namespace) {
|
|
179
|
-
const references = [];
|
|
180
|
-
for (const [_fileName, content] of files){
|
|
181
|
-
if (content.indexOf("reference") === -1) {
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
const lines = content.split(os.EOL);
|
|
185
|
-
for(let index = 0; index < lines.length; index++){
|
|
186
|
-
const line = lines[index];
|
|
187
|
-
const match = line.match(referenceRegex);
|
|
188
|
-
if (match === null) {
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
if (!references.includes(match[1])) {
|
|
192
|
-
references.push(match[1]);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
const compilerOptions = {
|
|
197
|
-
removeComments: false
|
|
198
|
-
};
|
|
199
|
-
const host = ts.createCompilerHost(compilerOptions, true);
|
|
200
|
-
host.fileExists = (fileName)=>files.has(fileName);
|
|
201
|
-
host.readFile = (fileName)=>files.get(fileName);
|
|
202
|
-
const program = ts.createProgram({
|
|
203
|
-
host,
|
|
204
|
-
options: compilerOptions,
|
|
205
|
-
rootNames: [
|
|
206
|
-
entryFileName
|
|
207
|
-
]
|
|
208
|
-
});
|
|
209
|
-
const mainFile = program.getSourceFile(entryFileName);
|
|
210
|
-
if (mainFile === undefined) {
|
|
211
|
-
throw new Error(`Unexpected: Failed to find compiled declaration entry module`);
|
|
212
|
-
}
|
|
213
|
-
const result = bundleFromEntryFile(namespace, mainFile, program, host, program.getTypeChecker(), compilerOptions);
|
|
214
|
-
return [
|
|
215
|
-
...references,
|
|
216
|
-
result
|
|
217
|
-
].join(os.EOL);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export { createRollupBuildParticipant, createRollupWatchBuildParticipant };
|
|
221
|
-
//# sourceMappingURL=rollup-BeQ0dM8U.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-BeQ0dM8U.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\textend: true,\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","extend","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"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBO,SAASA,6BACfC,QAAyB,EACzBC,QAAwB,EACxBC,MAAc,EACdC,gBAAyB,EAAA;AAEzB,IAAA,OAAO,CAACC,GAAAA,GAAAA;AACPA,QAAAA,GAAAA,CAAIC,YAAY,EAAA;QAEf,CAAA,UAAA;YACA,IAAI;AACH,gBAAA,MAAMC,YAAAA,GAAeC,eAAAA,CACpBP,QAAAA,EACAC,QAAAA,EACAC,QACAC,gBAAAA,EACAC,GAAAA,CAAAA;gBAGD,MAAMI,KAAAA,GAAQ,MAAMC,MAAAA,CAAOH,YAAAA,CAAAA;AAE3B,gBAAA,MAAMI,SAAS,MAAMF,KAAAA,CAAMG,QAAQ,CAACL,aAAaI,MAAM,CAAA;AAEvDN,gBAAAA,GAAAA,CAAIQ,UAAU,CAAC;oBACdC,IAAAA,EAAM,SAAA;AACNC,oBAAAA,SAAAA,EAAWC,oBACVL,MAAAA,EACAV,QAAAA,EACAC,QAAAA,EACAK,YAAAA,CAAaU,KAAK,EAClBb,gBAAAA;AAEF,iBAAA,CAAA;AACD,YAAA,CAAA,CAAE,OAAOc,GAAAA,EAAK;AACbb,gBAAAA,GAAAA,CAAIQ,UAAU,CAAC;oBAAEC,IAAAA,EAAM,OAAA;oBAASK,KAAAA,EAAOD;AAAI,iBAAA,CAAA;AAC5C,YAAA;QACD,CAAA,GAAA;QAEA,OAAO;AACNE,YAAAA,OA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A,IAAAA,CAAKK,QAAQ,GAAG,CAACpC,QAAAA,GAAac,KAAAA,CAAMuB,GAAG,CAACrC,QAAAA,CAAAA;IAExC,MAAMsC,OAAAA,GAAUN,EAAAA,CAAGO,aAAa,CAAC;AAChCR,QAAAA,IAAAA;QACAS,OAAAA,EAASjF,eAAAA;QACTkF,SAAAA,EAAW;AAAC1B,YAAAA;AAAc;AAC3B,KAAA,CAAA;IAEA,MAAM2B,QAAAA,GAAWJ,OAAAA,CAAQK,aAAa,CAAC5B,aAAAA,CAAAA;AAEvC,IAAA,IAAI2B,aAAanG,SAAAA,EAAW;AAC3B,QAAA,MAAM,IAAIJ,KAAAA,CACT,CAAC,4DAA4D,CAAC,CAAA;AAEhE,IAAA;IAEA,MAAMJ,MAAAA,GAAS6G,oBACd5B,SAAAA,EACA0B,QAAAA,EACAJ,SACAP,IAAAA,EACAO,OAAAA,CAAQO,cAAc,EAAA,EACtBtF,eAAAA,CAAAA;IAED,OAAO;AAAI0D,QAAAA,GAAAA,UAAAA;AAAYlF,QAAAA;KAAO,CAACkB,IAAI,CAACsE,EAAAA,CAAGC,GAAG,CAAA;AAC3C;;;;"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as 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-package';
|
|
7
|
-
import 'axios';
|
|
8
|
-
|
|
9
|
-
const getPackageTypescriptFiles = (location)=>glob.sync("**/*.ts", {
|
|
10
|
-
absolute: true,
|
|
11
|
-
cwd: location.scriptsDir,
|
|
12
|
-
ignore: "node_modules/**/*"
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
function resolveScriptPackageEntryModule(location, manifest) {
|
|
16
|
-
let candidates = [
|
|
17
|
-
"index.ts"
|
|
18
|
-
];
|
|
19
|
-
if (manifest.Type === "Context") {
|
|
20
|
-
candidates.push("Context.ts");
|
|
21
|
-
}
|
|
22
|
-
for (const candidate of candidates){
|
|
23
|
-
const candidatePath = path.join(location.scriptsDir, candidate);
|
|
24
|
-
if (fs.existsSync(candidatePath)) {
|
|
25
|
-
return candidatePath;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function readScriptPackageTSConfig(location) {
|
|
30
|
-
const { config } = ts.readConfigFile(path.join(location.scriptsDir, "tsconfig.json"), (path)=>{
|
|
31
|
-
try {
|
|
32
|
-
return fs.readFileSync(path, "utf8");
|
|
33
|
-
} catch {
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const parsedTsConfig = ts.parseJsonConfigFileContent(config, ts.sys, location.scriptsDir);
|
|
38
|
-
return parsedTsConfig;
|
|
39
|
-
}
|
|
40
|
-
function isScriptPackageModules(options) {
|
|
41
|
-
return options.module === ts.ModuleKind.ES2015;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { resolveScriptPackageEntryModule as a, getPackageTypescriptFiles as g, isScriptPackageModules as i, readScriptPackageTSConfig as r };
|
|
45
|
-
//# sourceMappingURL=scripts-B3noxiX3.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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,SAA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