@normed/bundle 4.8.0 → 4.8.3
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 +94 -50
- package/bundles/bin/cli.js.map +3 -3
- package/bundles/index.js +21 -11
- package/bundles/index.js.map +3 -3
- package/bundles/log.d.ts +6 -0
- package/package.json +2 -2
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"),
|
|
@@ -69008,7 +69014,7 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
69008
69014
|
const specifier = getResolvedSpecifier(value);
|
|
69009
69015
|
const absolutePath = resolvePackagePath(specifier, pugFilePath);
|
|
69010
69016
|
if (!absolutePath) {
|
|
69011
|
-
|
|
69017
|
+
log_default.warn(
|
|
69012
69018
|
`Warning: Cannot resolve build reference: "${specifier}" (from ${value})
|
|
69013
69019
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69014
69020
|
);
|
|
@@ -69036,7 +69042,7 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
69036
69042
|
packageCssReferences.push({ originalHref: value, absolutePath });
|
|
69037
69043
|
}
|
|
69038
69044
|
} else {
|
|
69039
|
-
|
|
69045
|
+
log_default.warn(
|
|
69040
69046
|
`Warning: build: prefix used on non-compilable file "${specifier}" (extension: ${ext}). Did you mean copy:?
|
|
69041
69047
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69042
69048
|
);
|
|
@@ -69046,7 +69052,7 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
69046
69052
|
const specifier = getResolvedSpecifier(value);
|
|
69047
69053
|
const absolutePath = resolvePackagePath(specifier, pugFilePath);
|
|
69048
69054
|
if (!absolutePath) {
|
|
69049
|
-
|
|
69055
|
+
log_default.warn(
|
|
69050
69056
|
`Warning: Cannot resolve copy reference: "${specifier}" (from ${value})
|
|
69051
69057
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69052
69058
|
);
|
|
@@ -69076,14 +69082,14 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
69076
69082
|
}
|
|
69077
69083
|
}
|
|
69078
69084
|
} else if (isPackageCssReference(value)) {
|
|
69079
|
-
|
|
69085
|
+
log_default.warn(
|
|
69080
69086
|
`Warning: pkg: prefix is deprecated, use copy: instead: "${value}"
|
|
69081
69087
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69082
69088
|
);
|
|
69083
69089
|
const packageSpecifier = getPackageSpecifier(value);
|
|
69084
69090
|
const absolutePath = resolvePackagePath(packageSpecifier, pugFilePath);
|
|
69085
69091
|
if (!absolutePath) {
|
|
69086
|
-
|
|
69092
|
+
log_default.warn(
|
|
69087
69093
|
`Warning: Package not found: "${packageSpecifier}" (from ${value})
|
|
69088
69094
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69089
69095
|
);
|
|
@@ -69092,14 +69098,14 @@ async function processHtmlAssets(html, pugFilePath, options2, webRoot) {
|
|
|
69092
69098
|
packageCssReferences.push({ originalHref: value, absolutePath });
|
|
69093
69099
|
}
|
|
69094
69100
|
} else if (isPackageReference(value)) {
|
|
69095
|
-
|
|
69101
|
+
log_default.warn(
|
|
69096
69102
|
`Warning: pkg: prefix is deprecated, use copy: instead: "${value}"
|
|
69097
69103
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69098
69104
|
);
|
|
69099
69105
|
const packageSpecifier = getPackageSpecifier(value);
|
|
69100
69106
|
const absolutePath = resolvePackagePath(packageSpecifier, pugFilePath);
|
|
69101
69107
|
if (!absolutePath) {
|
|
69102
|
-
|
|
69108
|
+
log_default.warn(
|
|
69103
69109
|
`Warning: Package not found: "${packageSpecifier}" (from ${value})
|
|
69104
69110
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69105
69111
|
);
|
|
@@ -69157,7 +69163,7 @@ async function processAsset(assetPath, pugDir, pugFilePath, outdir, outbase, ass
|
|
|
69157
69163
|
return processedAssets.get(absoluteSource);
|
|
69158
69164
|
}
|
|
69159
69165
|
if (!fs6.existsSync(absoluteSource)) {
|
|
69160
|
-
|
|
69166
|
+
log_default.warn(
|
|
69161
69167
|
`Warning: Asset not found: "${assetPath}" (resolved to ${absoluteSource})
|
|
69162
69168
|
Referenced in rendered HTML of ${pugFilePath}`
|
|
69163
69169
|
);
|
|
@@ -69660,7 +69666,9 @@ var import_esbuild_plugin_pnp = __toESM(require_lib15());
|
|
|
69660
69666
|
import * as ts from "typescript";
|
|
69661
69667
|
import path8 from "path";
|
|
69662
69668
|
import fs9 from "fs";
|
|
69663
|
-
|
|
69669
|
+
if (process.env["NO_COLOR"] === void 0) {
|
|
69670
|
+
import_chalk3.default.level = 3;
|
|
69671
|
+
}
|
|
69664
69672
|
function rewritePugReferencesInHtml(html, pugReferences, pugToOutputPath, htmlOutputDir, outdir) {
|
|
69665
69673
|
let result = html;
|
|
69666
69674
|
for (const ref of pugReferences) {
|
|
@@ -70329,7 +70337,9 @@ async function compileToTypeDeclarations(fileNames, options2) {
|
|
|
70329
70337
|
|
|
70330
70338
|
// pnp:/builds/normed/bundle/packages/bundle/src/builders/index.ts
|
|
70331
70339
|
var import_chalk4 = __toESM(require_source());
|
|
70332
|
-
|
|
70340
|
+
if (process.env["NO_COLOR"] === void 0) {
|
|
70341
|
+
import_chalk4.default.level = 3;
|
|
70342
|
+
}
|
|
70333
70343
|
var builders = {
|
|
70334
70344
|
es: esbuilder,
|
|
70335
70345
|
copy: copyBuilder
|
|
@@ -71632,6 +71642,7 @@ var options = {};
|
|
|
71632
71642
|
var parseError = false;
|
|
71633
71643
|
var optClean = false;
|
|
71634
71644
|
var optBuild = false;
|
|
71645
|
+
var optShort = isAgent;
|
|
71635
71646
|
for (let index = 0; index < process.argv.length; index++) {
|
|
71636
71647
|
const arg = process.argv[index];
|
|
71637
71648
|
if (!arg || !arg.startsWith("--")) {
|
|
@@ -71651,6 +71662,9 @@ for (let index = 0; index < process.argv.length; index++) {
|
|
|
71651
71662
|
case "-q":
|
|
71652
71663
|
setMinLogLevel("warn");
|
|
71653
71664
|
break;
|
|
71665
|
+
case "--short":
|
|
71666
|
+
optShort = true;
|
|
71667
|
+
break;
|
|
71654
71668
|
case "--tsc-declartaions":
|
|
71655
71669
|
options.tscDeclarations = true;
|
|
71656
71670
|
continue;
|
|
@@ -71752,48 +71766,76 @@ if (optClean) {
|
|
|
71752
71766
|
tasks.push(clean2(options));
|
|
71753
71767
|
}
|
|
71754
71768
|
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);
|
|
71769
|
+
if (optShort) {
|
|
71770
|
+
tasks.push(
|
|
71771
|
+
bundle2(options, {
|
|
71772
|
+
preBuild(builderMap) {
|
|
71773
|
+
let totalFiles = 0;
|
|
71774
|
+
for (const [, entrypoints] of builderMap.entries()) {
|
|
71775
|
+
totalFiles += entrypoints.length;
|
|
71770
71776
|
}
|
|
71771
|
-
);
|
|
71772
|
-
for (const [{ builder }, entrypoints] of builders2) {
|
|
71773
71777
|
log_default.info(
|
|
71774
|
-
|
|
71775
|
-
`${builder.name}:
|
|
71776
|
-
${entrypoints.map((i) => i.infile.relative).join("\n ")}`
|
|
71777
|
-
)
|
|
71778
|
+
`Building ${totalFiles} file${totalFiles === 1 ? "" : "s"} with bundle`
|
|
71778
71779
|
);
|
|
71780
|
+
return builderMap;
|
|
71781
|
+
},
|
|
71782
|
+
postBuild(success, { builder, duration_ms }) {
|
|
71783
|
+
if (!success) {
|
|
71784
|
+
const duration = Math.floor(duration_ms / 10) / 100;
|
|
71785
|
+
log_default.error(`${builder.name}: Failed after ${duration} seconds`);
|
|
71786
|
+
exitCode = 1;
|
|
71787
|
+
}
|
|
71788
|
+
return success;
|
|
71779
71789
|
}
|
|
71780
|
-
|
|
71781
|
-
}
|
|
71782
|
-
|
|
71783
|
-
|
|
71784
|
-
|
|
71785
|
-
|
|
71786
|
-
|
|
71787
|
-
|
|
71788
|
-
|
|
71790
|
+
}).then(() => {
|
|
71791
|
+
})
|
|
71792
|
+
);
|
|
71793
|
+
} else {
|
|
71794
|
+
log_default.info(`Building`);
|
|
71795
|
+
tasks.push(
|
|
71796
|
+
bundle2(options, {
|
|
71797
|
+
preBuild(builderMap) {
|
|
71798
|
+
const builders2 = [...builderMap.entries()].sort(
|
|
71799
|
+
([
|
|
71800
|
+
{
|
|
71801
|
+
builder: { name: a }
|
|
71802
|
+
}
|
|
71803
|
+
], [
|
|
71804
|
+
{
|
|
71805
|
+
builder: { name: b }
|
|
71806
|
+
}
|
|
71807
|
+
]) => {
|
|
71808
|
+
return a.localeCompare(b);
|
|
71809
|
+
}
|
|
71789
71810
|
);
|
|
71790
|
-
|
|
71811
|
+
for (const [{ builder }, entrypoints] of builders2) {
|
|
71812
|
+
log_default.info(
|
|
71813
|
+
builder.color(
|
|
71814
|
+
`${builder.name}:
|
|
71815
|
+
${entrypoints.map((i) => i.infile.relative).join("\n ")}`
|
|
71816
|
+
)
|
|
71817
|
+
);
|
|
71818
|
+
}
|
|
71819
|
+
return builderMap;
|
|
71820
|
+
},
|
|
71821
|
+
postBuild(success, { builder, duration_ms }) {
|
|
71822
|
+
const duration = Math.floor(duration_ms / 10) / 100;
|
|
71823
|
+
if (success) {
|
|
71824
|
+
log_default.info(builder.color(`${builder.name}: ${duration} seconds`));
|
|
71825
|
+
} else {
|
|
71826
|
+
log_default.error(
|
|
71827
|
+
builder.color(
|
|
71828
|
+
`${builder.name}: Failed after ${duration} seconds`
|
|
71829
|
+
)
|
|
71830
|
+
);
|
|
71831
|
+
exitCode = 1;
|
|
71832
|
+
}
|
|
71833
|
+
return success;
|
|
71791
71834
|
}
|
|
71792
|
-
|
|
71793
|
-
}
|
|
71794
|
-
|
|
71795
|
-
|
|
71796
|
-
);
|
|
71835
|
+
}).then(() => {
|
|
71836
|
+
})
|
|
71837
|
+
);
|
|
71838
|
+
}
|
|
71797
71839
|
}
|
|
71798
71840
|
function errorPrinter(error, index) {
|
|
71799
71841
|
if (Array.isArray(error)) {
|
|
@@ -71832,9 +71874,11 @@ Promise.all(tasks).catch((_errors) => {
|
|
|
71832
71874
|
errorPrinter(errors, 1);
|
|
71833
71875
|
exitCode = 1;
|
|
71834
71876
|
}).finally(() => {
|
|
71835
|
-
|
|
71836
|
-
|
|
71837
|
-
|
|
71877
|
+
if (!optShort) {
|
|
71878
|
+
const endTime = Date.now();
|
|
71879
|
+
const duration = Math.floor((endTime - startTime) / 10) / 100;
|
|
71880
|
+
log_default.info(`Ran in ${duration} seconds!`);
|
|
71881
|
+
}
|
|
71838
71882
|
process.exitCode = exitCode;
|
|
71839
71883
|
});
|
|
71840
71884
|
/*! Bundled license information:
|