@normed/bundle 4.8.2 → 4.8.4
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/CHANGELOG.md +4 -0
- package/bundles/bin/cli.js +226 -75
- package/bundles/bin/cli.js.map +3 -3
- package/bundles/esbuild-plugins/load_pug.d.ts +10 -0
- package/bundles/index.js +153 -36
- package/bundles/index.js.map +3 -3
- package/bundles/log.d.ts +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,10 @@ Given a version number MAJOR.MINOR.PATCH, increment the:
|
|
|
6
6
|
2. MINOR version when you add functionality in a backwards compatible manner, and
|
|
7
7
|
3. PATCH version when you make backwards compatible bug fixes.
|
|
8
8
|
|
|
9
|
+
# 4.8.3
|
|
10
|
+
|
|
11
|
+
* PATCH: Add `--short` CLI flag and automatic coding agent detection (`CLAUDECODE`, `CURSOR_AGENT`, `AGENT` env vars) for condensed build output — prints file counts instead of file lists. Respects the `NO_COLOR` convention. Internal warnings in the pug plugin now go through the logger instead of `console.warn`.
|
|
12
|
+
|
|
9
13
|
# 4.8.0
|
|
10
14
|
|
|
11
15
|
* MINOR: Add `webRoot` config for correct asset URL resolution when the web root is a subdirectory of `outdir`. Asset URLs in HTML are computed relative to the web root instead of the output directory. Also promotes `publicPath` and `assetNames` to top-level `bundle` config (old nested location still works but logs a deprecation warning).
|
package/bundles/bin/cli.js
CHANGED
|
@@ -68367,6 +68367,10 @@ var refinePackageJSON = makePartialRefinement({
|
|
|
68367
68367
|
|
|
68368
68368
|
// pnp:/builds/normed/bundle/packages/bundle/src/log.ts
|
|
68369
68369
|
var import_chalk = __toESM(require_source());
|
|
68370
|
+
var isAgent = !!process.env["CLAUDECODE"] || !!process.env["CURSOR_AGENT"] || !!process.env["AGENT"];
|
|
68371
|
+
if (process.env["NO_COLOR"] !== void 0) {
|
|
68372
|
+
import_chalk.default.level = 0;
|
|
68373
|
+
}
|
|
68370
68374
|
function logStdOut(colour, ...message) {
|
|
68371
68375
|
console.log(...message.map((m) => typeof m === "string" ? colour(m) : m));
|
|
68372
68376
|
}
|
|
@@ -68629,7 +68633,9 @@ var NoMatchingBuilder = class extends Error {
|
|
|
68629
68633
|
|
|
68630
68634
|
// pnp:/builds/normed/bundle/packages/bundle/src/builders/copy.ts
|
|
68631
68635
|
var import_chalk2 = __toESM(require_source());
|
|
68632
|
-
|
|
68636
|
+
if (process.env["NO_COLOR"] === void 0) {
|
|
68637
|
+
import_chalk2.default.level = 3;
|
|
68638
|
+
}
|
|
68633
68639
|
var copyBuilder = {
|
|
68634
68640
|
name: "copy",
|
|
68635
68641
|
color: import_chalk2.default.hex("#CDCDCD"),
|
|
@@ -68872,6 +68878,42 @@ function resolvePackagePath(packageSpecifier, fromFile) {
|
|
|
68872
68878
|
return null;
|
|
68873
68879
|
}
|
|
68874
68880
|
}
|
|
68881
|
+
var packageRootCache = /* @__PURE__ */ new Map();
|
|
68882
|
+
function findPackageRoot(filePath) {
|
|
68883
|
+
let dir = path5.dirname(path5.resolve(filePath));
|
|
68884
|
+
const cacheKey = dir;
|
|
68885
|
+
if (packageRootCache.has(cacheKey)) return packageRootCache.get(cacheKey);
|
|
68886
|
+
while (true) {
|
|
68887
|
+
if (fs6.existsSync(path5.join(dir, "package.json"))) {
|
|
68888
|
+
packageRootCache.set(cacheKey, dir);
|
|
68889
|
+
return dir;
|
|
68890
|
+
}
|
|
68891
|
+
const parent = path5.dirname(dir);
|
|
68892
|
+
if (parent === dir) {
|
|
68893
|
+
packageRootCache.set(cacheKey, null);
|
|
68894
|
+
return null;
|
|
68895
|
+
}
|
|
68896
|
+
dir = parent;
|
|
68897
|
+
}
|
|
68898
|
+
}
|
|
68899
|
+
function resolveAssetPath(assetPath, pugDir, srcWebRoot) {
|
|
68900
|
+
if (assetPath.startsWith("/")) {
|
|
68901
|
+
return path5.resolve(srcWebRoot, assetPath.slice(1));
|
|
68902
|
+
}
|
|
68903
|
+
return path5.resolve(pugDir, assetPath);
|
|
68904
|
+
}
|
|
68905
|
+
function assertWithinAllowedRoots(absolutePath, allowedRoots, originalValue, pugFilePath) {
|
|
68906
|
+
const normalizedPath = path5.resolve(absolutePath);
|
|
68907
|
+
const withinARoot = allowedRoots.some((root) => {
|
|
68908
|
+
const normalizedRoot = path5.resolve(root);
|
|
68909
|
+
return normalizedPath === normalizedRoot || normalizedPath.startsWith(normalizedRoot + path5.sep);
|
|
68910
|
+
});
|
|
68911
|
+
if (!withinARoot) {
|
|
68912
|
+
throw new Error(
|
|
68913
|
+
`Security: asset path "${originalValue}" resolves to "${normalizedPath}" which is outside the allowed source directories [${allowedRoots.join(", ")}]. Referenced in ${pugFilePath}. Use the copy: or build: prefix to resolve via Node module resolution.`
|
|
68914
|
+
);
|
|
68915
|
+
}
|
|
68916
|
+
}
|
|
68875
68917
|
var discoveredPugReferences = /* @__PURE__ */ new Map();
|
|
68876
68918
|
var discoveredLessReferences = /* @__PURE__ */ new Map();
|
|
68877
68919
|
var discoveredScriptReferences = /* @__PURE__ */ new Map();
|
|
@@ -68906,7 +68948,7 @@ function computeHtmlAssetPath(opts) {
|
|
|
68906
68948
|
}
|
|
68907
68949
|
return path5.relative(opts.htmlOutputDir, opts.absoluteOutput);
|
|
68908
68950
|
}
|
|
68909
|
-
async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
68951
|
+
async function processHtmlAssets(html, pugFilePath, options2, webRoot, collectedReferences) {
|
|
68910
68952
|
const assets = [];
|
|
68911
68953
|
const pugReferences = [];
|
|
68912
68954
|
const lessReferences = [];
|
|
@@ -68917,30 +68959,43 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
68917
68959
|
const outbase = options2.outbase || path5.dirname(pugFilePath);
|
|
68918
68960
|
const pugDir = path5.dirname(pugFilePath);
|
|
68919
68961
|
const publicPath = options2.publicPath || "";
|
|
68920
|
-
const
|
|
68921
|
-
const
|
|
68922
|
-
|
|
68962
|
+
const srcWebRoot = webRoot ? path5.join(outbase, webRoot) : outbase;
|
|
68963
|
+
const normalizedOutbase = path5.resolve(outbase);
|
|
68964
|
+
const normalizedPug = path5.resolve(pugFilePath);
|
|
68965
|
+
const pugWithinOutbase = normalizedPug === normalizedOutbase || normalizedPug.startsWith(normalizedOutbase + path5.sep);
|
|
68966
|
+
const packageRoot = pugWithinOutbase ? null : findPackageRoot(pugFilePath);
|
|
68967
|
+
const allowedRoots = [outbase, packageRoot].filter(
|
|
68968
|
+
(r) => r != null
|
|
68923
68969
|
);
|
|
68924
|
-
const
|
|
68970
|
+
const processedAssets = /* @__PURE__ */ new Map();
|
|
68925
68971
|
let modifiedHtml = html;
|
|
68926
68972
|
const matches = [];
|
|
68927
|
-
|
|
68928
|
-
|
|
68929
|
-
|
|
68930
|
-
|
|
68931
|
-
|
|
68932
|
-
|
|
68933
|
-
|
|
68934
|
-
|
|
68935
|
-
|
|
68936
|
-
})
|
|
68973
|
+
if (collectedReferences && collectedReferences.length > 0) {
|
|
68974
|
+
for (const ref of collectedReferences) {
|
|
68975
|
+
matches.push({ attr: ref.attr, value: ref.value });
|
|
68976
|
+
}
|
|
68977
|
+
} else {
|
|
68978
|
+
const allAttrs = [...new Set(Object.values(ASSET_ATTRIBUTES).flat())].join(
|
|
68979
|
+
"|"
|
|
68980
|
+
);
|
|
68981
|
+
const attrRegex = new RegExp(
|
|
68982
|
+
`(${allAttrs})\\s*=\\s*["']([^"']+)["']`,
|
|
68983
|
+
"gi"
|
|
68984
|
+
);
|
|
68985
|
+
let match;
|
|
68986
|
+
while ((match = attrRegex.exec(html)) !== null) {
|
|
68987
|
+
const attr = match[1];
|
|
68988
|
+
const value = match[2];
|
|
68989
|
+
if (attr && value) {
|
|
68990
|
+
matches.push({ attr: attr.toLowerCase(), value });
|
|
68991
|
+
}
|
|
68937
68992
|
}
|
|
68938
68993
|
}
|
|
68939
68994
|
const discoveredPugPaths = /* @__PURE__ */ new Set();
|
|
68940
68995
|
const discoveredLessPaths = /* @__PURE__ */ new Set();
|
|
68941
68996
|
const discoveredScriptPaths = /* @__PURE__ */ new Set();
|
|
68942
68997
|
const discoveredPackageCssPaths = /* @__PURE__ */ new Set();
|
|
68943
|
-
for (const {
|
|
68998
|
+
for (const { attr, value } of matches) {
|
|
68944
68999
|
let newValue = value;
|
|
68945
69000
|
if (attr === "srcset") {
|
|
68946
69001
|
const srcsetParts = value.split(",");
|
|
@@ -68953,7 +69008,13 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
68953
69008
|
[getVerbatimPath(assetPath), ...descriptors].filter(Boolean).join(" ")
|
|
68954
69009
|
);
|
|
68955
69010
|
} else if (assetPath && isPugReference(assetPath)) {
|
|
68956
|
-
const absolutePath =
|
|
69011
|
+
const absolutePath = resolveAssetPath(assetPath, pugDir, srcWebRoot);
|
|
69012
|
+
assertWithinAllowedRoots(
|
|
69013
|
+
absolutePath,
|
|
69014
|
+
allowedRoots,
|
|
69015
|
+
assetPath,
|
|
69016
|
+
pugFilePath
|
|
69017
|
+
);
|
|
68957
69018
|
if (!discoveredPugPaths.has(absolutePath)) {
|
|
68958
69019
|
discoveredPugPaths.add(absolutePath);
|
|
68959
69020
|
pugReferences.push({ originalHref: assetPath, absolutePath });
|
|
@@ -68970,6 +69031,8 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
68970
69031
|
publicPath,
|
|
68971
69032
|
assets,
|
|
68972
69033
|
processedAssets,
|
|
69034
|
+
srcWebRoot,
|
|
69035
|
+
allowedRoots,
|
|
68973
69036
|
webRoot
|
|
68974
69037
|
);
|
|
68975
69038
|
if (hashedPath) {
|
|
@@ -68987,19 +69050,22 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
68987
69050
|
} else if (isVerbatimReference(value)) {
|
|
68988
69051
|
newValue = getVerbatimPath(value);
|
|
68989
69052
|
} else if (isPugReference(value)) {
|
|
68990
|
-
const absolutePath =
|
|
69053
|
+
const absolutePath = resolveAssetPath(value, pugDir, srcWebRoot);
|
|
69054
|
+
assertWithinAllowedRoots(absolutePath, allowedRoots, value, pugFilePath);
|
|
68991
69055
|
if (!discoveredPugPaths.has(absolutePath)) {
|
|
68992
69056
|
discoveredPugPaths.add(absolutePath);
|
|
68993
69057
|
pugReferences.push({ originalHref: value, absolutePath });
|
|
68994
69058
|
}
|
|
68995
69059
|
} else if (isLessReference(value)) {
|
|
68996
|
-
const absolutePath =
|
|
69060
|
+
const absolutePath = resolveAssetPath(value, pugDir, srcWebRoot);
|
|
69061
|
+
assertWithinAllowedRoots(absolutePath, allowedRoots, value, pugFilePath);
|
|
68997
69062
|
if (!discoveredLessPaths.has(absolutePath)) {
|
|
68998
69063
|
discoveredLessPaths.add(absolutePath);
|
|
68999
69064
|
lessReferences.push({ originalHref: value, absolutePath });
|
|
69000
69065
|
}
|
|
69001
69066
|
} else if (isScriptReference(value)) {
|
|
69002
|
-
const absolutePath =
|
|
69067
|
+
const absolutePath = resolveAssetPath(value, pugDir, srcWebRoot);
|
|
69068
|
+
assertWithinAllowedRoots(absolutePath, allowedRoots, value, pugFilePath);
|
|
69003
69069
|
if (!discoveredScriptPaths.has(absolutePath)) {
|
|
69004
69070
|
discoveredScriptPaths.add(absolutePath);
|
|
69005
69071
|
scriptReferences.push({ originalHref: value, absolutePath });
|
|
@@ -69008,7 +69074,7 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
69008
69074
|
const specifier = getResolvedSpecifier(value);
|
|
69009
69075
|
const absolutePath = resolvePackagePath(specifier, pugFilePath);
|
|
69010
69076
|
if (!absolutePath) {
|
|
69011
|
-
|
|
69077
|
+
log_default.warn(
|
|
69012
69078
|
`Warning: Cannot resolve build reference: "${specifier}" (from ${value})
|
|
69013
69079
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69014
69080
|
);
|
|
@@ -69036,7 +69102,7 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
69036
69102
|
packageCssReferences.push({ originalHref: value, absolutePath });
|
|
69037
69103
|
}
|
|
69038
69104
|
} else {
|
|
69039
|
-
|
|
69105
|
+
log_default.warn(
|
|
69040
69106
|
`Warning: build: prefix used on non-compilable file "${specifier}" (extension: ${ext}). Did you mean copy:?
|
|
69041
69107
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69042
69108
|
);
|
|
@@ -69046,7 +69112,7 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
69046
69112
|
const specifier = getResolvedSpecifier(value);
|
|
69047
69113
|
const absolutePath = resolvePackagePath(specifier, pugFilePath);
|
|
69048
69114
|
if (!absolutePath) {
|
|
69049
|
-
|
|
69115
|
+
log_default.warn(
|
|
69050
69116
|
`Warning: Cannot resolve copy reference: "${specifier}" (from ${value})
|
|
69051
69117
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69052
69118
|
);
|
|
@@ -69076,14 +69142,14 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
69076
69142
|
}
|
|
69077
69143
|
}
|
|
69078
69144
|
} else if (isPackageCssReference(value)) {
|
|
69079
|
-
|
|
69145
|
+
log_default.warn(
|
|
69080
69146
|
`Warning: pkg: prefix is deprecated, use copy: instead: "${value}"
|
|
69081
69147
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69082
69148
|
);
|
|
69083
69149
|
const packageSpecifier = getPackageSpecifier(value);
|
|
69084
69150
|
const absolutePath = resolvePackagePath(packageSpecifier, pugFilePath);
|
|
69085
69151
|
if (!absolutePath) {
|
|
69086
|
-
|
|
69152
|
+
log_default.warn(
|
|
69087
69153
|
`Warning: Package not found: "${packageSpecifier}" (from ${value})
|
|
69088
69154
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69089
69155
|
);
|
|
@@ -69092,14 +69158,14 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
69092
69158
|
packageCssReferences.push({ originalHref: value, absolutePath });
|
|
69093
69159
|
}
|
|
69094
69160
|
} else if (isPackageReference(value)) {
|
|
69095
|
-
|
|
69161
|
+
log_default.warn(
|
|
69096
69162
|
`Warning: pkg: prefix is deprecated, use copy: instead: "${value}"
|
|
69097
69163
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69098
69164
|
);
|
|
69099
69165
|
const packageSpecifier = getPackageSpecifier(value);
|
|
69100
69166
|
const absolutePath = resolvePackagePath(packageSpecifier, pugFilePath);
|
|
69101
69167
|
if (!absolutePath) {
|
|
69102
|
-
|
|
69168
|
+
log_default.warn(
|
|
69103
69169
|
`Warning: Package not found: "${packageSpecifier}" (from ${value})
|
|
69104
69170
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69105
69171
|
);
|
|
@@ -69131,6 +69197,8 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
69131
69197
|
publicPath,
|
|
69132
69198
|
assets,
|
|
69133
69199
|
processedAssets,
|
|
69200
|
+
srcWebRoot,
|
|
69201
|
+
allowedRoots,
|
|
69134
69202
|
webRoot
|
|
69135
69203
|
);
|
|
69136
69204
|
if (hashedPath) {
|
|
@@ -69138,8 +69206,9 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
69138
69206
|
}
|
|
69139
69207
|
}
|
|
69140
69208
|
if (newValue !== value) {
|
|
69141
|
-
const
|
|
69142
|
-
|
|
69209
|
+
const escapedValue = value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
69210
|
+
const valueRegex = new RegExp(`(["'])${escapedValue}\\1`);
|
|
69211
|
+
modifiedHtml = modifiedHtml.replace(valueRegex, `$1${newValue}$1`);
|
|
69143
69212
|
}
|
|
69144
69213
|
}
|
|
69145
69214
|
return {
|
|
@@ -69151,13 +69220,19 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
69151
69220
|
packageCssReferences
|
|
69152
69221
|
};
|
|
69153
69222
|
}
|
|
69154
|
-
async function processAsset(assetPath, pugDir, pugFilePath, outdir, outbase, assetNames, publicPath, assets, processedAssets, webRoot) {
|
|
69155
|
-
const absoluteSource =
|
|
69223
|
+
async function processAsset(assetPath, pugDir, pugFilePath, outdir, outbase, assetNames, publicPath, assets, processedAssets, srcWebRoot, allowedRoots, webRoot) {
|
|
69224
|
+
const absoluteSource = resolveAssetPath(assetPath, pugDir, srcWebRoot);
|
|
69225
|
+
assertWithinAllowedRoots(
|
|
69226
|
+
absoluteSource,
|
|
69227
|
+
allowedRoots,
|
|
69228
|
+
assetPath,
|
|
69229
|
+
pugFilePath
|
|
69230
|
+
);
|
|
69156
69231
|
if (processedAssets.has(absoluteSource)) {
|
|
69157
69232
|
return processedAssets.get(absoluteSource);
|
|
69158
69233
|
}
|
|
69159
69234
|
if (!fs6.existsSync(absoluteSource)) {
|
|
69160
|
-
|
|
69235
|
+
log_default.warn(
|
|
69161
69236
|
`Warning: Asset not found: "${assetPath}" (resolved to ${absoluteSource})
|
|
69162
69237
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69163
69238
|
);
|
|
@@ -69347,6 +69422,36 @@ function createRebaseAssetsPlugin(entryFilePath) {
|
|
|
69347
69422
|
}
|
|
69348
69423
|
};
|
|
69349
69424
|
}
|
|
69425
|
+
function createAssetCollectorPlugin(collectedReferences) {
|
|
69426
|
+
return {
|
|
69427
|
+
preCodeGen(ast) {
|
|
69428
|
+
const pending = [...ast?.nodes || []];
|
|
69429
|
+
while (pending.length > 0) {
|
|
69430
|
+
const node = pending.shift();
|
|
69431
|
+
if (!node) continue;
|
|
69432
|
+
if (node.block?.nodes) {
|
|
69433
|
+
pending.push(...node.block.nodes);
|
|
69434
|
+
}
|
|
69435
|
+
if (node.nodes) {
|
|
69436
|
+
pending.push(...node.nodes);
|
|
69437
|
+
}
|
|
69438
|
+
const assetAttrs = ASSET_ATTRIBUTES[node.name];
|
|
69439
|
+
if (!assetAttrs) continue;
|
|
69440
|
+
if (!node.attrs) continue;
|
|
69441
|
+
for (const attr of node.attrs) {
|
|
69442
|
+
if (!assetAttrs.includes(attr.name)) continue;
|
|
69443
|
+
const extracted = extractStaticString(attr.val);
|
|
69444
|
+
if (!extracted) continue;
|
|
69445
|
+
collectedReferences.push({
|
|
69446
|
+
attr: attr.name,
|
|
69447
|
+
value: extracted.value
|
|
69448
|
+
});
|
|
69449
|
+
}
|
|
69450
|
+
}
|
|
69451
|
+
return ast;
|
|
69452
|
+
}
|
|
69453
|
+
};
|
|
69454
|
+
}
|
|
69350
69455
|
async function loadAsText2(_filepath) {
|
|
69351
69456
|
return {
|
|
69352
69457
|
loader: "text"
|
|
@@ -69388,12 +69493,14 @@ async function loadAsHtml(filepath, options2) {
|
|
|
69388
69493
|
}
|
|
69389
69494
|
async function loadAsEntrypoint(filepath, options2, webRoot) {
|
|
69390
69495
|
const fileData = await fs6.promises.readFile(filepath, "utf8");
|
|
69496
|
+
const collectedReferences = [];
|
|
69391
69497
|
let contents = import_pug.default.render(fileData, {
|
|
69392
69498
|
filename: filepath,
|
|
69393
69499
|
basedir: options2.outbase,
|
|
69394
69500
|
name: "render",
|
|
69395
69501
|
plugins: [
|
|
69396
69502
|
createRebaseAssetsPlugin(filepath),
|
|
69503
|
+
createAssetCollectorPlugin(collectedReferences),
|
|
69397
69504
|
pugTransformer(isScriptNodeWithSrcAttr, (nodes) => {
|
|
69398
69505
|
nodes;
|
|
69399
69506
|
})
|
|
@@ -69407,7 +69514,13 @@ async function loadAsEntrypoint(filepath, options2, webRoot) {
|
|
|
69407
69514
|
lessReferences,
|
|
69408
69515
|
scriptReferences,
|
|
69409
69516
|
packageCssReferences
|
|
69410
|
-
} = await processHtmlAssets(
|
|
69517
|
+
} = await processHtmlAssets(
|
|
69518
|
+
contents,
|
|
69519
|
+
filepath,
|
|
69520
|
+
options2,
|
|
69521
|
+
webRoot,
|
|
69522
|
+
collectedReferences
|
|
69523
|
+
);
|
|
69411
69524
|
contents = processedHtml;
|
|
69412
69525
|
if (pugReferences.length > 0) {
|
|
69413
69526
|
discoveredPugReferences.set(filepath, pugReferences);
|
|
@@ -69660,7 +69773,9 @@ var import_esbuild_plugin_pnp = __toESM(require_lib15());
|
|
|
69660
69773
|
import * as ts from "typescript";
|
|
69661
69774
|
import path8 from "path";
|
|
69662
69775
|
import fs9 from "fs";
|
|
69663
|
-
|
|
69776
|
+
if (process.env["NO_COLOR"] === void 0) {
|
|
69777
|
+
import_chalk3.default.level = 3;
|
|
69778
|
+
}
|
|
69664
69779
|
function rewritePugReferencesInHtml(html, pugReferences, pugToOutputPath, htmlOutputDir, outdir) {
|
|
69665
69780
|
let result = html;
|
|
69666
69781
|
for (const ref of pugReferences) {
|
|
@@ -70329,7 +70444,9 @@ async function compileToTypeDeclarations(fileNames, options2) {
|
|
|
70329
70444
|
|
|
70330
70445
|
// pnp:/builds/normed/bundle/packages/bundle/src/builders/index.ts
|
|
70331
70446
|
var import_chalk4 = __toESM(require_source());
|
|
70332
|
-
|
|
70447
|
+
if (process.env["NO_COLOR"] === void 0) {
|
|
70448
|
+
import_chalk4.default.level = 3;
|
|
70449
|
+
}
|
|
70333
70450
|
var builders = {
|
|
70334
70451
|
es: esbuilder,
|
|
70335
70452
|
copy: copyBuilder
|
|
@@ -71632,6 +71749,7 @@ var options = {};
|
|
|
71632
71749
|
var parseError = false;
|
|
71633
71750
|
var optClean = false;
|
|
71634
71751
|
var optBuild = false;
|
|
71752
|
+
var optShort = isAgent;
|
|
71635
71753
|
for (let index = 0; index < process.argv.length; index++) {
|
|
71636
71754
|
const arg = process.argv[index];
|
|
71637
71755
|
if (!arg || !arg.startsWith("--")) {
|
|
@@ -71651,6 +71769,9 @@ for (let index = 0; index < process.argv.length; index++) {
|
|
|
71651
71769
|
case "-q":
|
|
71652
71770
|
setMinLogLevel("warn");
|
|
71653
71771
|
break;
|
|
71772
|
+
case "--short":
|
|
71773
|
+
optShort = true;
|
|
71774
|
+
break;
|
|
71654
71775
|
case "--tsc-declartaions":
|
|
71655
71776
|
options.tscDeclarations = true;
|
|
71656
71777
|
continue;
|
|
@@ -71752,48 +71873,76 @@ if (optClean) {
|
|
|
71752
71873
|
tasks.push(clean2(options));
|
|
71753
71874
|
}
|
|
71754
71875
|
if (optBuild) {
|
|
71755
|
-
|
|
71756
|
-
|
|
71757
|
-
|
|
71758
|
-
|
|
71759
|
-
|
|
71760
|
-
([
|
|
71761
|
-
|
|
71762
|
-
builder: { name: a }
|
|
71763
|
-
}
|
|
71764
|
-
], [
|
|
71765
|
-
{
|
|
71766
|
-
builder: { name: b }
|
|
71767
|
-
}
|
|
71768
|
-
]) => {
|
|
71769
|
-
return a.localeCompare(b);
|
|
71876
|
+
if (optShort) {
|
|
71877
|
+
tasks.push(
|
|
71878
|
+
bundle2(options, {
|
|
71879
|
+
preBuild(builderMap) {
|
|
71880
|
+
let totalFiles = 0;
|
|
71881
|
+
for (const [, entrypoints] of builderMap.entries()) {
|
|
71882
|
+
totalFiles += entrypoints.length;
|
|
71770
71883
|
}
|
|
71771
|
-
);
|
|
71772
|
-
for (const [{ builder }, entrypoints] of builders2) {
|
|
71773
71884
|
log_default.info(
|
|
71774
|
-
|
|
71775
|
-
`${builder.name}:
|
|
71776
|
-
${entrypoints.map((i) => i.infile.relative).join("\n ")}`
|
|
71777
|
-
)
|
|
71885
|
+
`Building ${totalFiles} file${totalFiles === 1 ? "" : "s"} with bundle`
|
|
71778
71886
|
);
|
|
71887
|
+
return builderMap;
|
|
71888
|
+
},
|
|
71889
|
+
postBuild(success, { builder, duration_ms }) {
|
|
71890
|
+
if (!success) {
|
|
71891
|
+
const duration = Math.floor(duration_ms / 10) / 100;
|
|
71892
|
+
log_default.error(`${builder.name}: Failed after ${duration} seconds`);
|
|
71893
|
+
exitCode = 1;
|
|
71894
|
+
}
|
|
71895
|
+
return success;
|
|
71779
71896
|
}
|
|
71780
|
-
|
|
71781
|
-
}
|
|
71782
|
-
|
|
71783
|
-
|
|
71784
|
-
|
|
71785
|
-
|
|
71786
|
-
|
|
71787
|
-
|
|
71788
|
-
|
|
71897
|
+
}).then(() => {
|
|
71898
|
+
})
|
|
71899
|
+
);
|
|
71900
|
+
} else {
|
|
71901
|
+
log_default.info(`Building`);
|
|
71902
|
+
tasks.push(
|
|
71903
|
+
bundle2(options, {
|
|
71904
|
+
preBuild(builderMap) {
|
|
71905
|
+
const builders2 = [...builderMap.entries()].sort(
|
|
71906
|
+
([
|
|
71907
|
+
{
|
|
71908
|
+
builder: { name: a }
|
|
71909
|
+
}
|
|
71910
|
+
], [
|
|
71911
|
+
{
|
|
71912
|
+
builder: { name: b }
|
|
71913
|
+
}
|
|
71914
|
+
]) => {
|
|
71915
|
+
return a.localeCompare(b);
|
|
71916
|
+
}
|
|
71789
71917
|
);
|
|
71790
|
-
|
|
71918
|
+
for (const [{ builder }, entrypoints] of builders2) {
|
|
71919
|
+
log_default.info(
|
|
71920
|
+
builder.color(
|
|
71921
|
+
`${builder.name}:
|
|
71922
|
+
${entrypoints.map((i) => i.infile.relative).join("\n ")}`
|
|
71923
|
+
)
|
|
71924
|
+
);
|
|
71925
|
+
}
|
|
71926
|
+
return builderMap;
|
|
71927
|
+
},
|
|
71928
|
+
postBuild(success, { builder, duration_ms }) {
|
|
71929
|
+
const duration = Math.floor(duration_ms / 10) / 100;
|
|
71930
|
+
if (success) {
|
|
71931
|
+
log_default.info(builder.color(`${builder.name}: ${duration} seconds`));
|
|
71932
|
+
} else {
|
|
71933
|
+
log_default.error(
|
|
71934
|
+
builder.color(
|
|
71935
|
+
`${builder.name}: Failed after ${duration} seconds`
|
|
71936
|
+
)
|
|
71937
|
+
);
|
|
71938
|
+
exitCode = 1;
|
|
71939
|
+
}
|
|
71940
|
+
return success;
|
|
71791
71941
|
}
|
|
71792
|
-
|
|
71793
|
-
}
|
|
71794
|
-
|
|
71795
|
-
|
|
71796
|
-
);
|
|
71942
|
+
}).then(() => {
|
|
71943
|
+
})
|
|
71944
|
+
);
|
|
71945
|
+
}
|
|
71797
71946
|
}
|
|
71798
71947
|
function errorPrinter(error, index) {
|
|
71799
71948
|
if (Array.isArray(error)) {
|
|
@@ -71832,9 +71981,11 @@ Promise.all(tasks).catch((_errors) => {
|
|
|
71832
71981
|
errorPrinter(errors, 1);
|
|
71833
71982
|
exitCode = 1;
|
|
71834
71983
|
}).finally(() => {
|
|
71835
|
-
|
|
71836
|
-
|
|
71837
|
-
|
|
71984
|
+
if (!optShort) {
|
|
71985
|
+
const endTime = Date.now();
|
|
71986
|
+
const duration = Math.floor((endTime - startTime) / 10) / 100;
|
|
71987
|
+
log_default.info(`Ran in ${duration} seconds!`);
|
|
71988
|
+
}
|
|
71838
71989
|
process.exitCode = exitCode;
|
|
71839
71990
|
});
|
|
71840
71991
|
/*! Bundled license information:
|