@intelligentgraphics/ig.gfx.packager 3.0.8 → 3.0.10
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/cli-cb85e4b5.js +1393 -0
- package/build/cli-cb85e4b5.js.map +1 -0
- package/build/dependencies-2565d80c.js +133 -0
- package/build/dependencies-2565d80c.js.map +1 -0
- package/build/generateIndex-f386d332.js +257 -0
- package/build/generateIndex-f386d332.js.map +1 -0
- package/build/generateParameterType-151ab313.js +75 -0
- package/build/generateParameterType-151ab313.js.map +1 -0
- package/build/index-67a112b8.js +312 -0
- package/build/index-67a112b8.js.map +1 -0
- package/build/index-7a955335.js +479 -0
- package/build/{index-66de4fea.js.map → index-7a955335.js.map} +1 -1
- package/build/index.mjs +1 -1
- package/build/index.mjs.map +1 -1
- package/build/postinstall-962af586.js +67 -0
- package/build/{postinstall-ecbdcf37.js.map → postinstall-962af586.js.map} +1 -1
- package/build/publishNpm-1838e45c.js +134 -0
- package/build/{publishNpm-5ea951b3.js.map → publishNpm-1838e45c.js.map} +1 -1
- package/build/versionFile-cf6657c8.js +384 -0
- package/build/versionFile-cf6657c8.js.map +1 -0
- package/package.json +4 -6
- package/readme.md +86 -2
- package/build/cli-fbbf208b.js +0 -2530
- package/build/cli-fbbf208b.js.map +0 -1
- package/build/dependencies-435193d1.js +0 -133
- package/build/dependencies-435193d1.js.map +0 -1
- package/build/generateIndex-eb975b01.js +0 -265
- package/build/generateIndex-eb975b01.js.map +0 -1
- package/build/generateParameterType-e49e4ba0.js +0 -74
- package/build/generateParameterType-e49e4ba0.js.map +0 -1
- package/build/index-66de4fea.js +0 -480
- package/build/index-c1b42e4c.js +0 -308
- package/build/index-c1b42e4c.js.map +0 -1
- package/build/postinstall-ecbdcf37.js +0 -64
- package/build/publishNpm-5ea951b3.js +0 -133
- package/build/versionFile-13099b85.js +0 -370
- package/build/versionFile-13099b85.js.map +0 -1
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as terser from 'terser';
|
|
4
|
+
import 'resolve';
|
|
5
|
+
import 'write-pkg';
|
|
6
|
+
import { h as getPackageTypescriptFiles, r as readPackageCreatorManifest, o as readPackageNpmManifest } from './cli-cb85e4b5.js';
|
|
7
|
+
import 'node:path';
|
|
8
|
+
import 'node:fs';
|
|
9
|
+
import 'axios';
|
|
10
|
+
import ts from 'typescript';
|
|
11
|
+
import typedoc from 'typedoc';
|
|
12
|
+
import glob from 'glob';
|
|
13
|
+
|
|
14
|
+
const logPackageMessage = (name, step, index, total)=>{
|
|
15
|
+
const numLength = total === undefined ? undefined : total.toString().length;
|
|
16
|
+
const indexString = total === undefined || total < 2 ? "" : `${index.toString().padStart(numLength, "0")}/${total} `;
|
|
17
|
+
const identifierString = `${indexString}${name.padEnd(15)}`;
|
|
18
|
+
console.log(`${identifierString} >> ${step}`);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const tryReadTsConfig = (location)=>{
|
|
22
|
+
const { config } = ts.readConfigFile(path.join(location.scriptsDir, "tsconfig.json"), (path)=>{
|
|
23
|
+
try {
|
|
24
|
+
return fs.readFileSync(path, "utf8");
|
|
25
|
+
} catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return config;
|
|
30
|
+
};
|
|
31
|
+
const build = async (location, outputDir)=>{
|
|
32
|
+
const config = tryReadTsConfig(location);
|
|
33
|
+
config.compilerOptions.lib = [
|
|
34
|
+
"es5",
|
|
35
|
+
"dom"
|
|
36
|
+
];
|
|
37
|
+
const result = ts.convertCompilerOptionsFromJson(config.compilerOptions, location.scriptsDir);
|
|
38
|
+
const compilerOptions = {
|
|
39
|
+
...result.options,
|
|
40
|
+
removeComments: false,
|
|
41
|
+
declaration: true,
|
|
42
|
+
sourceMap: false,
|
|
43
|
+
// We don't use tsc to actually emit the files, but we still need to set the correct
|
|
44
|
+
// output directory so the compiler can rewrite the `reference path` directives.
|
|
45
|
+
outFile: path.join(outputDir, "out.js"),
|
|
46
|
+
target: ts.ScriptTarget.ES5,
|
|
47
|
+
noEmitOnError: true
|
|
48
|
+
};
|
|
49
|
+
const host = ts.createCompilerHost(compilerOptions);
|
|
50
|
+
host.getCurrentDirectory = ()=>location.scriptsDir;
|
|
51
|
+
let js;
|
|
52
|
+
let definitions;
|
|
53
|
+
host.writeFile = (fileName, data, writeByteOrderMark)=>{
|
|
54
|
+
if (fileName.endsWith(".js")) {
|
|
55
|
+
js = data;
|
|
56
|
+
} else if (fileName.endsWith(".d.ts")) {
|
|
57
|
+
definitions = data;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const files = getPackageTypescriptFiles(location);
|
|
61
|
+
if (files.length === 0) {
|
|
62
|
+
throw new Error(`Expected typescript files to exist when building a package. Packages only consisting of animation jsons do not need to be built.`);
|
|
63
|
+
}
|
|
64
|
+
const programOptions = {
|
|
65
|
+
rootNames: files,
|
|
66
|
+
options: compilerOptions,
|
|
67
|
+
host
|
|
68
|
+
};
|
|
69
|
+
const program = ts.createProgram(programOptions);
|
|
70
|
+
const emitResult = program.emit();
|
|
71
|
+
const allDiagnostics = ts.getPreEmitDiagnostics(program);
|
|
72
|
+
if (!emitResult.emitSkipped) {
|
|
73
|
+
if (allDiagnostics.length > 0) {
|
|
74
|
+
console.log(allDiagnostics.map(createErrorMessage).join("\n"));
|
|
75
|
+
}
|
|
76
|
+
if (js === undefined || definitions === undefined) {
|
|
77
|
+
throw new Error(`Unexpected: no js or definitions were created`);
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
js,
|
|
81
|
+
definitions
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const error = allDiagnostics.map(createErrorMessage).join("\n");
|
|
85
|
+
throw new Error(error);
|
|
86
|
+
};
|
|
87
|
+
const createErrorMessage = (diagnostic)=>{
|
|
88
|
+
if (!diagnostic.file) {
|
|
89
|
+
return `${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`;
|
|
90
|
+
}
|
|
91
|
+
const { line , character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
92
|
+
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
93
|
+
return `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const generateDocs = async (location, declarationFile, outFolder, name)=>{
|
|
97
|
+
const app = new typedoc.Application();
|
|
98
|
+
const mediaDir = path.join(location.manifestDir, "Media");
|
|
99
|
+
app.bootstrap({
|
|
100
|
+
entryPoints: [
|
|
101
|
+
declarationFile
|
|
102
|
+
],
|
|
103
|
+
media: mediaDir,
|
|
104
|
+
out: outFolder,
|
|
105
|
+
tsconfig: path.join(location.scriptsDir, "tsconfig.json"),
|
|
106
|
+
skipErrorChecking: true
|
|
107
|
+
});
|
|
108
|
+
app.options.setCompilerOptions([
|
|
109
|
+
declarationFile
|
|
110
|
+
], {
|
|
111
|
+
target: ts.ScriptTarget.ES5
|
|
112
|
+
}, undefined);
|
|
113
|
+
app.options.setValue("name", name);
|
|
114
|
+
const [readmePath] = glob.sync("**/readme.md", {
|
|
115
|
+
absolute: true,
|
|
116
|
+
cwd: location.manifestDir
|
|
117
|
+
});
|
|
118
|
+
if (readmePath) {
|
|
119
|
+
app.options.setValue("readme", readmePath);
|
|
120
|
+
}
|
|
121
|
+
const project = app.convert();
|
|
122
|
+
if (project) {
|
|
123
|
+
await app.generateDocs(project, outFolder);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// Stolen from ig.tools.core
|
|
128
|
+
const toposort = (packages)=>{
|
|
129
|
+
const queue = Object.getOwnPropertyNames(packages);
|
|
130
|
+
const result = [];
|
|
131
|
+
let index = 0;
|
|
132
|
+
while(queue.length > 0){
|
|
133
|
+
if (index >= queue.length) {
|
|
134
|
+
throw new Error("Packages can not have cyclic dependencies");
|
|
135
|
+
}
|
|
136
|
+
const queueEntry = queue[index];
|
|
137
|
+
const dependencies = packages[queueEntry];
|
|
138
|
+
const dependencyQueued = dependencies.some((dependency)=>queue.includes(dependency));
|
|
139
|
+
if (dependencyQueued) {
|
|
140
|
+
index++;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
queue.splice(index, 1);
|
|
144
|
+
index = 0;
|
|
145
|
+
result.push(queueEntry);
|
|
146
|
+
}
|
|
147
|
+
return result;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const buildFolders = async (options)=>{
|
|
151
|
+
if (options.outDir !== undefined && options.clean) {
|
|
152
|
+
fs.rmSync(options.outDir, {
|
|
153
|
+
recursive: true
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
const workspace = options.workspace;
|
|
157
|
+
const folders = options.packages;
|
|
158
|
+
const sortedPackages = sortPackagesByBuildOrder(folders);
|
|
159
|
+
let index = 1;
|
|
160
|
+
for (const location of sortedPackages){
|
|
161
|
+
if (options.skipPackagesWithoutTsFiles && getPackageTypescriptFiles(location).length === 0) {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
ensureTsConfig(location);
|
|
165
|
+
const data = readPackageCreatorManifest(location);
|
|
166
|
+
const logStep = (step)=>logPackageMessage(data.Package, step, index, folders.length);
|
|
167
|
+
logStep("Compiling typescript to javascript");
|
|
168
|
+
const outputDirectory = options.outDir || location.scriptsDir;
|
|
169
|
+
fs.mkdirSync(outputDirectory, {
|
|
170
|
+
recursive: true
|
|
171
|
+
});
|
|
172
|
+
const buildResult = await build(location, outputDirectory);
|
|
173
|
+
const banner = options.banner ? createBannerComment(options.banner) : undefined;
|
|
174
|
+
if (banner) {
|
|
175
|
+
buildResult.js = banner + "\n" + buildResult.js;
|
|
176
|
+
buildResult.definitions = banner + "\n" + buildResult.definitions;
|
|
177
|
+
}
|
|
178
|
+
fs.writeFileSync(path.join(outputDirectory, `${data.Package}.js`), buildResult.js, {
|
|
179
|
+
encoding: "utf8"
|
|
180
|
+
});
|
|
181
|
+
fs.writeFileSync(path.join(outputDirectory, `${data.Package}.d.ts`), buildResult.definitions, {
|
|
182
|
+
encoding: "utf8"
|
|
183
|
+
});
|
|
184
|
+
if (options.minimize) {
|
|
185
|
+
const minifyResult = await terser.minify(buildResult.js, {
|
|
186
|
+
ecma: 5
|
|
187
|
+
});
|
|
188
|
+
const minifiedPath = path.join(outputDirectory, `${data.Package}.min.js`);
|
|
189
|
+
fs.writeFileSync(minifiedPath, minifyResult.code, {
|
|
190
|
+
encoding: "utf8"
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
if (location.path.includes("Basics")) {
|
|
194
|
+
fs.mkdirSync(path.join(workspace.path, "lib"), {
|
|
195
|
+
recursive: true
|
|
196
|
+
});
|
|
197
|
+
logStep("Copying basics definition file to the lib folder");
|
|
198
|
+
fs.writeFileSync(path.join(workspace.path, "lib", `${data.Package}.d.ts`), buildResult.definitions, {
|
|
199
|
+
encoding: "utf8"
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (options.docs) {
|
|
203
|
+
logStep("Generating typedoc documentation");
|
|
204
|
+
await generateDocs(location, path.join(outputDirectory, `${data.Package}.d.ts`), path.join(workspace.path, "docs", data.Package), data.Package);
|
|
205
|
+
}
|
|
206
|
+
index++;
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
const ensureTsConfig = (location)=>{
|
|
210
|
+
const tsconfigPath = path.join(location.scriptsDir, "tsconfig.json");
|
|
211
|
+
if (!fs.existsSync(tsconfigPath)) {
|
|
212
|
+
const content = {};
|
|
213
|
+
applyTsConfigOption(content);
|
|
214
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify(content, undefined, "\t"), "utf8");
|
|
215
|
+
} else {
|
|
216
|
+
const content = JSON.parse(fs.readFileSync(tsconfigPath, "utf8"));
|
|
217
|
+
applyTsConfigOption(content);
|
|
218
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify(content, undefined, "\t"), "utf8");
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const applyTsConfigOption = (data)=>{
|
|
222
|
+
data.compilerOptions = data.compilerOptions ?? {};
|
|
223
|
+
data.compilerOptions.target = "es5";
|
|
224
|
+
data.compilerOptions.lib = [
|
|
225
|
+
"es5",
|
|
226
|
+
"dom"
|
|
227
|
+
];
|
|
228
|
+
};
|
|
229
|
+
const sortPackagesByBuildOrder = (folders)=>{
|
|
230
|
+
const packages = Array.from(folders).reduce((acc, location)=>{
|
|
231
|
+
const data = readPackageNpmManifest(location);
|
|
232
|
+
if (data !== undefined) {
|
|
233
|
+
acc[data.name] = {
|
|
234
|
+
data,
|
|
235
|
+
location
|
|
236
|
+
};
|
|
237
|
+
} else {
|
|
238
|
+
acc[location.path] = {
|
|
239
|
+
data: undefined,
|
|
240
|
+
location
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
return acc;
|
|
244
|
+
}, {});
|
|
245
|
+
const packageDependencies = Object.getOwnPropertyNames(packages).reduce((acc, packageName)=>{
|
|
246
|
+
const packageData = packages[packageName];
|
|
247
|
+
if (packageData.data === undefined) {
|
|
248
|
+
acc[packageName] = [];
|
|
249
|
+
} else {
|
|
250
|
+
acc[packageName] = Object.getOwnPropertyNames({
|
|
251
|
+
...packageData.data.devDependencies,
|
|
252
|
+
...packageData.data.dependencies,
|
|
253
|
+
...packageData.data.peerDependencies
|
|
254
|
+
}).filter((packageName)=>packages[packageName] !== undefined);
|
|
255
|
+
}
|
|
256
|
+
return acc;
|
|
257
|
+
}, {});
|
|
258
|
+
const sortedPackages = toposort(packageDependencies);
|
|
259
|
+
const result = [];
|
|
260
|
+
for (const packageName of sortedPackages){
|
|
261
|
+
const location = packages[packageName].location;
|
|
262
|
+
if (readPackageCreatorManifest(location).Package.endsWith(".Basics")) {
|
|
263
|
+
result.unshift(location);
|
|
264
|
+
} else {
|
|
265
|
+
result.push(location);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return result;
|
|
269
|
+
};
|
|
270
|
+
const createBannerComment = (banner)=>{
|
|
271
|
+
const bannerParts = [];
|
|
272
|
+
if (banner.text) {
|
|
273
|
+
bannerParts.push(" * " + banner.text);
|
|
274
|
+
}
|
|
275
|
+
{
|
|
276
|
+
const details = [];
|
|
277
|
+
if (banner.version) {
|
|
278
|
+
details.push(`Version: ${banner.version}`);
|
|
279
|
+
}
|
|
280
|
+
if (banner.commit) {
|
|
281
|
+
if (banner.commitDirty) {
|
|
282
|
+
details.push(`Commit: ${banner.commit} (dirty)`);
|
|
283
|
+
} else {
|
|
284
|
+
details.push(`Commit: ${banner.commit}`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (banner.date) {
|
|
288
|
+
details.push(`Date: ${banner.date.toISOString()}`);
|
|
289
|
+
}
|
|
290
|
+
const detailsText = details.map((line)=>` * ${line}`).join("\n");
|
|
291
|
+
if (detailsText) {
|
|
292
|
+
bannerParts.push(detailsText);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
const bannerText = bannerParts.join("\n\n");
|
|
296
|
+
if (bannerText) {
|
|
297
|
+
return `/*
|
|
298
|
+
${bannerText}
|
|
299
|
+
*
|
|
300
|
+
* @preserve
|
|
301
|
+
*/`;
|
|
302
|
+
}
|
|
303
|
+
return undefined;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
307
|
+
__proto__: null,
|
|
308
|
+
buildFolders: buildFolders
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
export { buildFolders as b, index as i, logPackageMessage as l };
|
|
312
|
+
//# sourceMappingURL=index-67a112b8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-67a112b8.js","sources":["../../tools.core/build/log.mjs","../src/commands/build/tsc.ts","../src/commands/build/docs.ts","../src/lib/toposort.ts","../src/commands/build/index.ts"],"sourcesContent":["const logPackageMessage = (name, step, index, total)=>{\n const numLength = total === undefined ? undefined : total.toString().length;\n const indexString = total === undefined || total < 2 ? \"\" : `${index.toString().padStart(numLength, \"0\")}/${total} `;\n const identifierString = `${indexString}${name.padEnd(15)}`;\n console.log(`${identifierString} >> ${step}`);\n};\n\nexport { logPackageMessage };\n//# sourceMappingURL=log.mjs.map\n","import ts from \"typescript\";\nimport * as path from \"path\";\nimport * as fs from \"fs\";\n\nimport { PackageLocation } from \"../../lib/package\";\n\nimport { FolderBuilder } from \".\";\nimport { getPackageTypescriptFiles } from \"../../lib/scripts\";\n\nexport const tryReadTsConfig = (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\treturn config as {\n\t\tcompilerOptions: ts.CompilerOptions;\n\t};\n};\n\nexport const build: FolderBuilder = async (\n\tlocation: PackageLocation,\n\toutputDir: string,\n) => {\n\tconst config = tryReadTsConfig(location);\n\n\tconfig.compilerOptions.lib = [\"es5\", \"dom\"];\n\n\tconst result = ts.convertCompilerOptionsFromJson(\n\t\tconfig.compilerOptions,\n\t\tlocation.scriptsDir,\n\t);\n\n\tconst compilerOptions: ts.CompilerOptions = {\n\t\t...result.options,\n\t\tremoveComments: false,\n\t\tdeclaration: true,\n\t\tsourceMap: false,\n\t\t// We don't use tsc to actually emit the files, but we still need to set the correct\n\t\t// output directory so the compiler can rewrite the `reference path` directives.\n\t\toutFile: path.join(outputDir, \"out.js\"),\n\t\ttarget: ts.ScriptTarget.ES5,\n\t\tnoEmitOnError: true,\n\t};\n\n\tconst host = ts.createCompilerHost(compilerOptions);\n\thost.getCurrentDirectory = () => location.scriptsDir;\n\n\tlet js: string | undefined;\n\tlet definitions: string | undefined;\n\n\thost.writeFile = (fileName, data, writeByteOrderMark) => {\n\t\tif (fileName.endsWith(\".js\")) {\n\t\t\tjs = data;\n\t\t} else if (fileName.endsWith(\".d.ts\")) {\n\t\t\tdefinitions = data;\n\t\t}\n\t};\n\n\tconst files = getPackageTypescriptFiles(location);\n\n\tif (files.length === 0) {\n\t\tthrow new Error(\n\t\t\t`Expected typescript files to exist when building a package. Packages only consisting of animation jsons do not need to be built.`,\n\t\t);\n\t}\n\n\tconst programOptions: ts.CreateProgramOptions = {\n\t\trootNames: files,\n\t\toptions: compilerOptions,\n\t\thost,\n\t};\n\n\tconst program = ts.createProgram(programOptions);\n\tconst emitResult = program.emit();\n\tconst allDiagnostics = ts.getPreEmitDiagnostics(program);\n\n\tif (!emitResult.emitSkipped) {\n\t\tif (allDiagnostics.length > 0) {\n\t\t\tconsole.log(allDiagnostics.map(createErrorMessage).join(\"\\n\"));\n\t\t}\n\n\t\tif (js === undefined || definitions === undefined) {\n\t\t\tthrow new Error(`Unexpected: no js or definitions were created`);\n\t\t}\n\n\t\treturn { js, definitions };\n\t}\n\n\tconst error = allDiagnostics.map(createErrorMessage).join(\"\\n\");\n\n\tthrow new Error(error);\n};\n\nconst createErrorMessage = (diagnostic: ts.Diagnostic) => {\n\tif (!diagnostic.file) {\n\t\treturn `${ts.flattenDiagnosticMessageText(\n\t\t\tdiagnostic.messageText,\n\t\t\t\"\\n\",\n\t\t)}`;\n\t}\n\n\tconst { line, character } = diagnostic.file.getLineAndCharacterOfPosition(\n\t\tdiagnostic.start!,\n\t);\n\n\tconst message = ts.flattenDiagnosticMessageText(\n\t\tdiagnostic.messageText,\n\t\t\"\\n\",\n\t);\n\n\treturn `${diagnostic.file.fileName} (${line + 1},${\n\t\tcharacter + 1\n\t}): ${message}`;\n};\n","import typedoc from \"typedoc\";\nimport glob from \"glob\";\nimport ts from \"typescript\";\nimport * as path from \"path\";\nimport { PackageLocation } from \"../../lib/package\";\n\nexport const generateDocs = async (\n\tlocation: PackageLocation,\n\tdeclarationFile: string,\n\toutFolder: string,\n\tname: string,\n) => {\n\tconst app = new typedoc.Application();\n\n\tconst mediaDir = path.join(location.manifestDir, \"Media\");\n\n\tapp.bootstrap({\n\t\tentryPoints: [declarationFile],\n\t\tmedia: mediaDir,\n\t\tout: outFolder,\n\t\ttsconfig: path.join(location.scriptsDir, \"tsconfig.json\"),\n\t\tskipErrorChecking: true,\n\t});\n\n\tapp.options.setCompilerOptions(\n\t\t[declarationFile],\n\t\t{\n\t\t\ttarget: ts.ScriptTarget.ES5,\n\t\t},\n\t\tundefined,\n\t);\n\n\tapp.options.setValue(\"name\", name);\n\n\tconst [readmePath] = glob.sync(\"**/readme.md\", {\n\t\tabsolute: true,\n\t\tcwd: location.manifestDir,\n\t});\n\n\tif (readmePath) {\n\t\tapp.options.setValue(\"readme\", readmePath);\n\t}\n\n\tconst project = app.convert();\n\n\tif (project) {\n\t\tawait app.generateDocs(project, outFolder);\n\t}\n};\n","// Stolen from ig.tools.core\n\nexport const toposort = (packages: Record<string, string[]>) => {\n\tconst queue = Object.getOwnPropertyNames(packages);\n\tconst result: string[] = [];\n\n\tlet index = 0;\n\n\twhile (queue.length > 0) {\n\t\tif (index >= queue.length) {\n\t\t\tthrow new Error(\"Packages can not have cyclic dependencies\");\n\t\t}\n\n\t\tconst queueEntry = queue[index];\n\n\t\tconst dependencies = packages[queueEntry];\n\t\tconst dependencyQueued = dependencies.some((dependency) =>\n\t\t\tqueue.includes(dependency),\n\t\t);\n\n\t\tif (dependencyQueued) {\n\t\t\tindex++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tqueue.splice(index, 1);\n\t\tindex = 0;\n\t\tresult.push(queueEntry);\n\t}\n\n\treturn result;\n};\n","import * as path from \"path\";\nimport * as fs from \"fs\";\nimport * as terser from \"terser\";\n\nimport { logPackageMessage } from \"../../lib/log\";\nimport { build as tscBuild } from \"./tsc\";\nimport { generateDocs } from \"./docs\";\nimport {\n\tPackageLocation,\n\treadPackageCreatorManifest,\n\treadPackageNpmManifest,\n} from \"../../lib/package\";\nimport { WorkspaceLocation } from \"../../lib/workspace\";\nimport { getPackageTypescriptFiles } from \"../../lib/scripts\";\nimport { toposort } from \"../../lib/toposort\";\nimport { PackageJSON } from \"../../lib/packageJSON\";\n\nexport interface BannerOptions {\n\ttext: string | undefined;\n\tversion: string | undefined;\n\tcommit: string | undefined;\n\tcommitDirty: boolean | undefined;\n\tdate: Date | undefined;\n}\n\nexport interface BuildFoldersOptions {\n\tworkspace: WorkspaceLocation;\n\tpackages: PackageLocation[];\n\toutDir?: string;\n\tminimize: boolean;\n\tbanner?: BannerOptions;\n\tclean?: boolean;\n\tdocs?: boolean;\n\tskipPackagesWithoutTsFiles?: boolean;\n}\n\nexport interface BuildFolderOptions extends BuildFoldersOptions {\n\toutFile: string;\n}\n\nexport interface FolderBuilderResult {\n\tjs: string;\n\tdefinitions: string;\n}\n\nexport type FolderBuilder = (\n\tlocation: PackageLocation,\n\toutputDir: string,\n) => Promise<FolderBuilderResult>;\n\ntype FolderData = {\n\tlocation: PackageLocation;\n\tdata?: PackageJSON;\n};\n\nexport const buildFolders = async (options: BuildFoldersOptions) => {\n\tif (options.outDir !== undefined && options.clean) {\n\t\tfs.rmSync(options.outDir, { recursive: true });\n\t}\n\n\tconst workspace = options.workspace;\n\tconst folders = options.packages;\n\n\tconst sortedPackages = sortPackagesByBuildOrder(folders);\n\n\tlet index = 1;\n\n\tfor (const location of sortedPackages) {\n\t\tif (\n\t\t\toptions.skipPackagesWithoutTsFiles &&\n\t\t\tgetPackageTypescriptFiles(location).length === 0\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tensureTsConfig(location);\n\n\t\tconst data = readPackageCreatorManifest(location);\n\n\t\tconst logStep = (step: string) =>\n\t\t\tlogPackageMessage(data.Package, step, index, folders.length);\n\n\t\tlogStep(\"Compiling typescript to javascript\");\n\n\t\tconst outputDirectory = options.outDir || location.scriptsDir;\n\t\tfs.mkdirSync(outputDirectory, { recursive: true });\n\n\t\tconst buildResult = await tscBuild(location, outputDirectory);\n\t\tconst banner = options.banner\n\t\t\t? createBannerComment(options.banner)\n\t\t\t: undefined;\n\n\t\tif (banner) {\n\t\t\tbuildResult.js = banner + \"\\n\" + buildResult.js;\n\t\t\tbuildResult.definitions = banner + \"\\n\" + buildResult.definitions;\n\t\t}\n\n\t\tfs.writeFileSync(\n\t\t\tpath.join(outputDirectory, `${data.Package}.js`),\n\t\t\tbuildResult.js,\n\t\t\t{ encoding: \"utf8\" },\n\t\t);\n\t\tfs.writeFileSync(\n\t\t\tpath.join(outputDirectory, `${data.Package}.d.ts`),\n\t\t\tbuildResult.definitions,\n\t\t\t{ encoding: \"utf8\" },\n\t\t);\n\n\t\tif (options.minimize) {\n\t\t\tconst minifyResult = await terser.minify(buildResult.js, {\n\t\t\t\tecma: 5,\n\t\t\t});\n\n\t\t\tconst minifiedPath = path.join(\n\t\t\t\toutputDirectory,\n\t\t\t\t`${data.Package}.min.js`,\n\t\t\t);\n\t\t\tfs.writeFileSync(minifiedPath, minifyResult.code!, {\n\t\t\t\tencoding: \"utf8\",\n\t\t\t});\n\t\t}\n\n\t\tif (location.path.includes(\"Basics\")) {\n\t\t\tfs.mkdirSync(path.join(workspace.path, \"lib\"), {\n\t\t\t\trecursive: true,\n\t\t\t});\n\n\t\t\tlogStep(\"Copying basics definition file to the lib folder\");\n\t\t\tfs.writeFileSync(\n\t\t\t\tpath.join(workspace.path, \"lib\", `${data.Package}.d.ts`),\n\t\t\t\tbuildResult.definitions,\n\t\t\t\t{ encoding: \"utf8\" },\n\t\t\t);\n\t\t}\n\n\t\tif (options.docs) {\n\t\t\tlogStep(\"Generating typedoc documentation\");\n\t\t\tawait generateDocs(\n\t\t\t\tlocation,\n\t\t\t\tpath.join(outputDirectory, `${data.Package}.d.ts`),\n\t\t\t\tpath.join(workspace.path, \"docs\", data.Package),\n\t\t\t\tdata.Package,\n\t\t\t);\n\t\t}\n\n\t\tindex++;\n\t}\n};\n\nconst ensureTsConfig = (location: PackageLocation) => {\n\tconst tsconfigPath = path.join(location.scriptsDir, \"tsconfig.json\");\n\n\tif (!fs.existsSync(tsconfigPath)) {\n\t\tconst content = {};\n\t\tapplyTsConfigOption(content);\n\n\t\tfs.writeFileSync(\n\t\t\ttsconfigPath,\n\t\t\tJSON.stringify(content, undefined, \"\\t\"),\n\t\t\t\"utf8\",\n\t\t);\n\t} else {\n\t\tconst content = JSON.parse(fs.readFileSync(tsconfigPath, \"utf8\"));\n\t\tapplyTsConfigOption(content);\n\t\tfs.writeFileSync(\n\t\t\ttsconfigPath,\n\t\t\tJSON.stringify(content, undefined, \"\\t\"),\n\t\t\t\"utf8\",\n\t\t);\n\t}\n};\n\nconst applyTsConfigOption = (data: {\n\tcompilerOptions?: { target?: string; lib?: string[] };\n}) => {\n\tdata.compilerOptions = data.compilerOptions ?? {};\n\tdata.compilerOptions.target = \"es5\";\n\tdata.compilerOptions.lib = [\"es5\", \"dom\"];\n};\n\nconst sortPackagesByBuildOrder = (\n\tfolders: PackageLocation[],\n): PackageLocation[] => {\n\tconst packages = Array.from(folders).reduce(\n\t\t(\n\t\t\tacc: Record<string, FolderData>,\n\t\t\tlocation,\n\t\t): Record<string, FolderData> => {\n\t\t\tconst data = readPackageNpmManifest(location);\n\n\t\t\tif (data !== undefined) {\n\t\t\t\tacc[data.name] = {\n\t\t\t\t\tdata,\n\t\t\t\t\tlocation,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tacc[location.path] = {\n\t\t\t\t\tdata: undefined,\n\t\t\t\t\tlocation,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn acc;\n\t\t},\n\t\t{},\n\t);\n\n\tconst packageDependencies = Object.getOwnPropertyNames(packages).reduce(\n\t\t(acc, packageName) => {\n\t\t\tconst packageData = packages[packageName];\n\n\t\t\tif (packageData.data === undefined) {\n\t\t\t\tacc[packageName] = [];\n\t\t\t} else {\n\t\t\t\tacc[packageName] = Object.getOwnPropertyNames({\n\t\t\t\t\t...packageData.data.devDependencies,\n\t\t\t\t\t...packageData.data.dependencies,\n\t\t\t\t\t...packageData.data.peerDependencies,\n\t\t\t\t}).filter((packageName) => packages[packageName] !== undefined);\n\t\t\t}\n\n\t\t\treturn acc;\n\t\t},\n\t\t{},\n\t);\n\n\tconst sortedPackages = toposort(packageDependencies);\n\tconst result: PackageLocation[] = [];\n\n\tfor (const packageName of sortedPackages) {\n\t\tconst location = packages[packageName].location;\n\n\t\tif (readPackageCreatorManifest(location).Package.endsWith(\".Basics\")) {\n\t\t\tresult.unshift(location);\n\t\t} else {\n\t\t\tresult.push(location);\n\t\t}\n\t}\n\n\treturn result;\n};\n\nconst createBannerComment = (banner: BannerOptions) => {\n\tconst bannerParts: string[] = [];\n\n\tif (banner.text) {\n\t\tbannerParts.push(\" * \" + banner.text);\n\t}\n\n\t{\n\t\tconst details: string[] = [];\n\n\t\tif (banner.version) {\n\t\t\tdetails.push(`Version: ${banner.version}`);\n\t\t}\n\t\tif (banner.commit) {\n\t\t\tif (banner.commitDirty) {\n\t\t\t\tdetails.push(`Commit: ${banner.commit} (dirty)`);\n\t\t\t} else {\n\t\t\t\tdetails.push(`Commit: ${banner.commit}`);\n\t\t\t}\n\t\t}\n\t\tif (banner.date) {\n\t\t\tdetails.push(`Date: ${banner.date.toISOString()}`);\n\t\t}\n\n\t\tconst detailsText = details.map((line) => ` * ${line}`).join(\"\\n\");\n\t\tif (detailsText) {\n\t\t\tbannerParts.push(detailsText);\n\t\t}\n\t}\n\n\tconst bannerText = bannerParts.join(\"\\n\\n\");\n\n\tif (bannerText) {\n\t\treturn `/*\n${bannerText}\n*\n* @preserve\t\t\t\n*/`;\n\t}\n\n\treturn undefined;\n};\n"],"names":["logPackageMessage","name","step","index","total","numLength","undefined","toString","length","indexString","padStart","identifierString","padEnd","console","log","tryReadTsConfig","location","config","ts","readConfigFile","path","join","scriptsDir","fs","readFileSync","build","outputDir","compilerOptions","lib","result","convertCompilerOptionsFromJson","options","removeComments","declaration","sourceMap","outFile","target","ScriptTarget","ES5","noEmitOnError","host","createCompilerHost","getCurrentDirectory","js","definitions","writeFile","fileName","data","writeByteOrderMark","endsWith","files","getPackageTypescriptFiles","Error","programOptions","rootNames","program","createProgram","emitResult","emit","allDiagnostics","getPreEmitDiagnostics","emitSkipped","map","createErrorMessage","error","diagnostic","file","flattenDiagnosticMessageText","messageText","line","character","getLineAndCharacterOfPosition","start","message","generateDocs","declarationFile","outFolder","app","typedoc","Application","mediaDir","manifestDir","bootstrap","entryPoints","media","out","tsconfig","skipErrorChecking","setCompilerOptions","setValue","readmePath","glob","sync","absolute","cwd","project","convert","toposort","packages","queue","Object","getOwnPropertyNames","queueEntry","dependencies","dependencyQueued","some","dependency","includes","splice","push","buildFolders","outDir","clean","rmSync","recursive","workspace","folders","sortedPackages","sortPackagesByBuildOrder","skipPackagesWithoutTsFiles","ensureTsConfig","readPackageCreatorManifest","logStep","Package","outputDirectory","mkdirSync","buildResult","tscBuild","banner","createBannerComment","writeFileSync","encoding","minimize","minifyResult","terser","minify","ecma","minifiedPath","code","docs","tsconfigPath","existsSync","content","applyTsConfigOption","JSON","stringify","parse","Array","from","reduce","acc","readPackageNpmManifest","packageDependencies","packageName","packageData","devDependencies","peerDependencies","filter","unshift","bannerParts","text","details","version","commit","commitDirty","date","toISOString","detailsText","bannerText"],"mappings":";;;;;;;;;;;;;AAAA,MAAMA,iBAAoB,GAAA,CAACC,IAAMC,EAAAA,IAAAA,EAAMC,OAAOC,KAAQ,GAAA;AAClD,IAAA,MAAMC,YAAYD,KAAUE,KAAAA,SAAAA,GAAYA,YAAYF,KAAMG,CAAAA,QAAQ,GAAGC,MAAM,CAAA;AAC3E,IAAA,MAAMC,cAAcL,KAAUE,KAAAA,SAAAA,IAAaF,QAAQ,CAAI,GAAA,EAAA,GAAK,CAAC,EAAED,KAAAA,CAAMI,QAAQ,EAAGG,CAAAA,QAAQ,CAACL,SAAW,EAAA,GAAA,CAAA,CAAK,CAAC,EAAED,KAAAA,CAAM,CAAC,CAAC,CAAA;IACpH,MAAMO,gBAAAA,GAAmB,CAAC,EAAEF,WAAAA,CAAY,EAAER,IAAKW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