@trebired/bundler 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +94 -11
- package/dist/backend/utils/normalize.d.ts +2 -0
- package/dist/backend/utils/normalize.d.ts.map +1 -0
- package/dist/backend/utils/normalize.js +4 -0
- package/dist/backend/utils/normalize.js.map +1 -0
- package/dist/backend/utils/object.d.ts +3 -0
- package/dist/backend/utils/object.d.ts.map +1 -0
- package/dist/backend/utils/object.js +12 -0
- package/dist/backend/utils/object.js.map +1 -0
- package/dist/backend/utils/time.d.ts +3 -0
- package/dist/backend/utils/time.d.ts.map +1 -0
- package/dist/backend/utils/time.js +7 -0
- package/dist/backend/utils/time.js.map +1 -0
- package/dist/cli/run-cli.d.ts +1 -13
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +1 -103
- package/dist/cli/run-cli.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/core/asset-manifest.d.ts +1 -4
- package/dist/core/asset-manifest.d.ts.map +1 -1
- package/dist/core/asset-manifest.js +1 -254
- package/dist/core/asset-manifest.js.map +1 -1
- package/dist/core/build.d.ts +1 -3
- package/dist/core/build.d.ts.map +1 -1
- package/dist/core/build.js +1 -48
- package/dist/core/build.js.map +1 -1
- package/dist/core/derive-manifest.d.ts +1 -9
- package/dist/core/derive-manifest.d.ts.map +1 -1
- package/dist/core/derive-manifest.js +1 -153
- package/dist/core/derive-manifest.js.map +1 -1
- package/dist/core/discovery-watch.d.ts +1 -8
- package/dist/core/discovery-watch.d.ts.map +1 -1
- package/dist/core/discovery-watch.js +1 -100
- package/dist/core/discovery-watch.js.map +1 -1
- package/dist/core/discovery.d.ts +1 -31
- package/dist/core/discovery.d.ts.map +1 -1
- package/dist/core/discovery.js +1 -468
- package/dist/core/discovery.js.map +1 -1
- package/dist/core/esbuild-options.d.ts +1 -29
- package/dist/core/esbuild-options.d.ts.map +1 -1
- package/dist/core/esbuild-options.js +1 -92
- package/dist/core/esbuild-options.js.map +1 -1
- package/dist/core/import-graph.d.ts +1 -3
- package/dist/core/import-graph.d.ts.map +1 -1
- package/dist/core/import-graph.js +1 -409
- package/dist/core/import-graph.js.map +1 -1
- package/dist/core/manifest.d.ts +1 -14
- package/dist/core/manifest.d.ts.map +1 -1
- package/dist/core/manifest.js +1 -28
- package/dist/core/manifest.js.map +1 -1
- package/dist/core/shared.d.ts +1 -15
- package/dist/core/shared.d.ts.map +1 -1
- package/dist/core/shared.js +1 -62
- package/dist/core/shared.js.map +1 -1
- package/dist/core/watch.d.ts +1 -3
- package/dist/core/watch.d.ts.map +1 -1
- package/dist/core/watch.js +1 -176
- package/dist/core/watch.js.map +1 -1
- package/dist/frontend/js/utils/text.d.ts +2 -0
- package/dist/frontend/js/utils/text.d.ts.map +1 -0
- package/dist/frontend/js/utils/text.js +4 -0
- package/dist/frontend/js/utils/text.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/cli/run-cli.d.ts +14 -0
- package/dist/internal/cli/run-cli.d.ts.map +1 -0
- package/dist/internal/cli/run-cli.js +108 -0
- package/dist/internal/cli/run-cli.js.map +1 -0
- package/dist/internal/core/asset-manifest.d.ts +2 -0
- package/dist/internal/core/asset-manifest.d.ts.map +1 -0
- package/dist/internal/core/asset-manifest.js +2 -0
- package/dist/internal/core/asset-manifest.js.map +1 -0
- package/dist/internal/core/asset_manifest/runtime.d.ts +5 -0
- package/dist/internal/core/asset_manifest/runtime.d.ts.map +1 -0
- package/dist/internal/core/asset_manifest/runtime.js +252 -0
- package/dist/internal/core/asset_manifest/runtime.js.map +1 -0
- package/dist/internal/core/build.d.ts +4 -0
- package/dist/internal/core/build.d.ts.map +1 -0
- package/dist/internal/core/build.js +49 -0
- package/dist/internal/core/build.js.map +1 -0
- package/dist/internal/core/derive-manifest.d.ts +3 -0
- package/dist/internal/core/derive-manifest.d.ts.map +1 -0
- package/dist/internal/core/derive-manifest.js +2 -0
- package/dist/internal/core/derive-manifest.js.map +1 -0
- package/dist/internal/core/derive_manifest/runtime.d.ts +10 -0
- package/dist/internal/core/derive_manifest/runtime.d.ts.map +1 -0
- package/dist/internal/core/derive_manifest/runtime.js +133 -0
- package/dist/internal/core/derive_manifest/runtime.js.map +1 -0
- package/dist/internal/core/discovery/aggregate.d.ts +32 -0
- package/dist/internal/core/discovery/aggregate.d.ts.map +1 -0
- package/dist/internal/core/discovery/aggregate.js +124 -0
- package/dist/internal/core/discovery/aggregate.js.map +1 -0
- package/dist/internal/core/discovery/emit.d.ts +22 -0
- package/dist/internal/core/discovery/emit.d.ts.map +1 -0
- package/dist/internal/core/discovery/emit.js +37 -0
- package/dist/internal/core/discovery/emit.js.map +1 -0
- package/dist/internal/core/discovery/normalize.d.ts +8 -0
- package/dist/internal/core/discovery/normalize.d.ts.map +1 -0
- package/dist/internal/core/discovery/normalize.js +130 -0
- package/dist/internal/core/discovery/normalize.js.map +1 -0
- package/dist/internal/core/discovery/public.d.ts +5 -0
- package/dist/internal/core/discovery/public.d.ts.map +1 -0
- package/dist/internal/core/discovery/public.js +25 -0
- package/dist/internal/core/discovery/public.js.map +1 -0
- package/dist/internal/core/discovery/resolve.d.ts +9 -0
- package/dist/internal/core/discovery/resolve.d.ts.map +1 -0
- package/dist/internal/core/discovery/resolve.js +235 -0
- package/dist/internal/core/discovery/resolve.js.map +1 -0
- package/dist/internal/core/discovery/scan.d.ts +29 -0
- package/dist/internal/core/discovery/scan.d.ts.map +1 -0
- package/dist/internal/core/discovery/scan.js +105 -0
- package/dist/internal/core/discovery/scan.js.map +1 -0
- package/dist/internal/core/discovery/shared.d.ts +100 -0
- package/dist/internal/core/discovery/shared.d.ts.map +1 -0
- package/dist/internal/core/discovery/shared.js +187 -0
- package/dist/internal/core/discovery/shared.js.map +1 -0
- package/dist/internal/core/discovery-watch.d.ts +2 -0
- package/dist/internal/core/discovery-watch.d.ts.map +1 -0
- package/dist/internal/core/discovery-watch.js +2 -0
- package/dist/internal/core/discovery-watch.js.map +1 -0
- package/dist/internal/core/discovery.d.ts +5 -0
- package/dist/internal/core/discovery.d.ts.map +1 -0
- package/dist/internal/core/discovery.js +4 -0
- package/dist/internal/core/discovery.js.map +1 -0
- package/dist/internal/core/discovery_watch/runtime.d.ts +9 -0
- package/dist/internal/core/discovery_watch/runtime.d.ts.map +1 -0
- package/dist/internal/core/discovery_watch/runtime.js +127 -0
- package/dist/internal/core/discovery_watch/runtime.js.map +1 -0
- package/dist/internal/core/esbuild-options.d.ts +30 -0
- package/dist/internal/core/esbuild-options.d.ts.map +1 -0
- package/dist/internal/core/esbuild-options.js +93 -0
- package/dist/internal/core/esbuild-options.js.map +1 -0
- package/dist/internal/core/import-graph.d.ts +2 -0
- package/dist/internal/core/import-graph.d.ts.map +1 -0
- package/dist/internal/core/import-graph.js +2 -0
- package/dist/internal/core/import-graph.js.map +1 -0
- package/dist/internal/core/import_graph/parse.d.ts +6 -0
- package/dist/internal/core/import_graph/parse.d.ts.map +1 -0
- package/dist/internal/core/import_graph/parse.js +134 -0
- package/dist/internal/core/import_graph/parse.js.map +1 -0
- package/dist/internal/core/import_graph/resolve.d.ts +4 -0
- package/dist/internal/core/import_graph/resolve.d.ts.map +1 -0
- package/dist/internal/core/import_graph/resolve.js +105 -0
- package/dist/internal/core/import_graph/resolve.js.map +1 -0
- package/dist/internal/core/import_graph/shared.d.ts +21 -0
- package/dist/internal/core/import_graph/shared.d.ts.map +1 -0
- package/dist/internal/core/import_graph/shared.js +27 -0
- package/dist/internal/core/import_graph/shared.js.map +1 -0
- package/dist/internal/core/import_graph/tsconfig.d.ts +7 -0
- package/dist/internal/core/import_graph/tsconfig.d.ts.map +1 -0
- package/dist/internal/core/import_graph/tsconfig.js +111 -0
- package/dist/internal/core/import_graph/tsconfig.js.map +1 -0
- package/dist/internal/core/manifest.d.ts +15 -0
- package/dist/internal/core/manifest.d.ts.map +1 -0
- package/dist/internal/core/manifest.js +29 -0
- package/dist/internal/core/manifest.js.map +1 -0
- package/dist/internal/core/shared.d.ts +17 -0
- package/dist/internal/core/shared.d.ts.map +1 -0
- package/dist/internal/core/shared.js +63 -0
- package/dist/internal/core/shared.js.map +1 -0
- package/dist/internal/core/watch.d.ts +4 -0
- package/dist/internal/core/watch.d.ts.map +1 -0
- package/dist/internal/core/watch.js +185 -0
- package/dist/internal/core/watch.js.map +1 -0
- package/dist/internal/types/discovery.d.ts +91 -0
- package/dist/internal/types/discovery.d.ts.map +1 -0
- package/dist/internal/types/discovery.js +2 -0
- package/dist/internal/types/discovery.js.map +1 -0
- package/dist/internal/types/import_graph.d.ts +29 -0
- package/dist/internal/types/import_graph.d.ts.map +1 -0
- package/dist/internal/types/import_graph.js +2 -0
- package/dist/internal/types/import_graph.js.map +1 -0
- package/dist/internal/types/logging.d.ts +9 -0
- package/dist/internal/types/logging.d.ts.map +1 -0
- package/dist/internal/types/logging.js +2 -0
- package/dist/internal/types/logging.js.map +1 -0
- package/dist/internal/types/manifest.d.ts +106 -0
- package/dist/internal/types/manifest.d.ts.map +1 -0
- package/dist/internal/types/manifest.js +2 -0
- package/dist/internal/types/manifest.js.map +1 -0
- package/dist/internal/types/runtime.d.ts +47 -0
- package/dist/internal/types/runtime.d.ts.map +1 -0
- package/dist/internal/types/runtime.js +2 -0
- package/dist/internal/types/runtime.js.map +1 -0
- package/dist/internal/types.d.ts +6 -0
- package/dist/internal/types.d.ts.map +1 -0
- package/dist/internal/types.js +2 -0
- package/dist/internal/types.js.map +1 -0
- package/dist/logging.d.ts.map +1 -1
- package/dist/logging.js.map +1 -1
- package/dist/plugins/scss.d.ts +1 -1
- package/dist/plugins/scss.d.ts.map +1 -1
- package/dist/plugins/scss.js.map +1 -1
- package/dist/plugins/source-annotations.d.ts +1 -1
- package/dist/plugins/source-annotations.d.ts.map +1 -1
- package/dist/plugins/source-annotations.js.map +1 -1
- package/dist/plugins/virtual-entries.d.ts +1 -1
- package/dist/plugins/virtual-entries.d.ts.map +1 -1
- package/dist/plugins/virtual-entries.js +1 -1
- package/dist/plugins/virtual-entries.js.map +1 -1
- package/dist/src/backend/utils/normalize.d.ts +2 -0
- package/dist/src/backend/utils/normalize.d.ts.map +1 -0
- package/dist/src/backend/utils/normalize.js +4 -0
- package/dist/src/backend/utils/normalize.js.map +1 -0
- package/dist/src/backend/utils/object.d.ts +3 -0
- package/dist/src/backend/utils/object.d.ts.map +1 -0
- package/dist/src/backend/utils/object.js +12 -0
- package/dist/src/backend/utils/object.js.map +1 -0
- package/dist/src/backend/utils/time.d.ts +3 -0
- package/dist/src/backend/utils/time.d.ts.map +1 -0
- package/dist/src/backend/utils/time.js +7 -0
- package/dist/src/backend/utils/time.js.map +1 -0
- package/dist/src/cli/run-cli.d.ts +2 -0
- package/dist/src/cli/run-cli.d.ts.map +1 -0
- package/dist/src/cli/run-cli.js +2 -0
- package/dist/src/cli/run-cli.js.map +1 -0
- package/dist/src/cli.d.ts +5 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +10 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/config/index.d.ts +5 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +32 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/constants.d.ts +4 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +4 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/core/asset-manifest.d.ts +2 -0
- package/dist/src/core/asset-manifest.d.ts.map +1 -0
- package/dist/src/core/asset-manifest.js +2 -0
- package/dist/src/core/asset-manifest.js.map +1 -0
- package/dist/src/core/build.d.ts +2 -0
- package/dist/src/core/build.d.ts.map +1 -0
- package/dist/src/core/build.js +2 -0
- package/dist/src/core/build.js.map +1 -0
- package/dist/src/core/derive-manifest.d.ts +2 -0
- package/dist/src/core/derive-manifest.d.ts.map +1 -0
- package/dist/src/core/derive-manifest.js +2 -0
- package/dist/src/core/derive-manifest.js.map +1 -0
- package/dist/src/core/discovery-watch.d.ts +2 -0
- package/dist/src/core/discovery-watch.d.ts.map +1 -0
- package/dist/src/core/discovery-watch.js +2 -0
- package/dist/src/core/discovery-watch.js.map +1 -0
- package/dist/src/core/discovery.d.ts +2 -0
- package/dist/src/core/discovery.d.ts.map +1 -0
- package/dist/src/core/discovery.js +2 -0
- package/dist/src/core/discovery.js.map +1 -0
- package/dist/src/core/esbuild-options.d.ts +2 -0
- package/dist/src/core/esbuild-options.d.ts.map +1 -0
- package/dist/src/core/esbuild-options.js +2 -0
- package/dist/src/core/esbuild-options.js.map +1 -0
- package/dist/src/core/import-graph.d.ts +2 -0
- package/dist/src/core/import-graph.d.ts.map +1 -0
- package/dist/src/core/import-graph.js +2 -0
- package/dist/src/core/import-graph.js.map +1 -0
- package/dist/src/core/manifest.d.ts +2 -0
- package/dist/src/core/manifest.d.ts.map +1 -0
- package/dist/src/core/manifest.js +2 -0
- package/dist/src/core/manifest.js.map +1 -0
- package/dist/src/core/shared.d.ts +2 -0
- package/dist/src/core/shared.d.ts.map +1 -0
- package/dist/src/core/shared.js +2 -0
- package/dist/src/core/shared.js.map +1 -0
- package/dist/src/core/watch.d.ts +2 -0
- package/dist/src/core/watch.d.ts.map +1 -0
- package/dist/src/core/watch.js +2 -0
- package/dist/src/core/watch.js.map +1 -0
- package/dist/src/frontend/js/utils/text.d.ts +2 -0
- package/dist/src/frontend/js/utils/text.d.ts.map +1 -0
- package/dist/src/frontend/js/utils/text.js +4 -0
- package/dist/src/frontend/js/utils/text.js.map +1 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +13 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/logging.d.ts +5 -0
- package/dist/src/logging.d.ts.map +1 -0
- package/dist/src/logging.js +35 -0
- package/dist/src/logging.js.map +1 -0
- package/dist/src/plugins/scss.d.ts +11 -0
- package/dist/src/plugins/scss.d.ts.map +1 -0
- package/dist/src/plugins/scss.js +44 -0
- package/dist/src/plugins/scss.js.map +1 -0
- package/dist/src/plugins/source-annotations.d.ts +17 -0
- package/dist/src/plugins/source-annotations.d.ts.map +1 -0
- package/dist/src/plugins/source-annotations.js +78 -0
- package/dist/src/plugins/source-annotations.js.map +1 -0
- package/dist/src/plugins/virtual-entries.d.ts +11 -0
- package/dist/src/plugins/virtual-entries.d.ts.map +1 -0
- package/dist/src/plugins/virtual-entries.js +39 -0
- package/dist/src/plugins/virtual-entries.js.map +1 -0
- package/dist/src/types.d.ts +2 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/types.d.ts +1 -216
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +108 -41
|
@@ -1,255 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { deriveManifest } from "./derive-manifest.js";
|
|
3
|
-
import { toPosixPath } from "./discovery.js";
|
|
4
|
-
function normalizeKey(value) {
|
|
5
|
-
return toPosixPath(String(value || "").trim()).replace(/^\.\/+/, "").replace(/^\/+|\/+$/g, "");
|
|
6
|
-
}
|
|
7
|
-
function normalizeSourcePath(value, rootDir) {
|
|
8
|
-
const raw = String(value || "").trim();
|
|
9
|
-
if (!raw)
|
|
10
|
-
return "";
|
|
11
|
-
if (raw.startsWith("virtual:"))
|
|
12
|
-
return normalizeKey(raw);
|
|
13
|
-
const absolute = path.isAbsolute(raw) ? raw : path.resolve(rootDir, raw);
|
|
14
|
-
return normalizeKey(path.relative(rootDir, absolute));
|
|
15
|
-
}
|
|
16
|
-
function normalizeOutputPath(value, rootDir, outDir) {
|
|
17
|
-
const raw = String(value || "").trim();
|
|
18
|
-
if (!raw)
|
|
19
|
-
return "";
|
|
20
|
-
if (path.isAbsolute(raw)) {
|
|
21
|
-
return normalizeKey(path.relative(outDir, raw));
|
|
22
|
-
}
|
|
23
|
-
const normalized = normalizeKey(raw);
|
|
24
|
-
if (!normalized)
|
|
25
|
-
return "";
|
|
26
|
-
const outDirRel = normalizeKey(path.relative(rootDir, outDir));
|
|
27
|
-
if (outDirRel && normalized.startsWith(`${outDirRel}/`)) {
|
|
28
|
-
return normalized.slice(outDirRel.length + 1);
|
|
29
|
-
}
|
|
30
|
-
return normalized;
|
|
31
|
-
}
|
|
32
|
-
function toStableList(values) {
|
|
33
|
-
return Array.from(new Set(Array.from(values).filter(Boolean))).sort();
|
|
34
|
-
}
|
|
35
|
-
function toEntryPointLookupKey(entry) {
|
|
36
|
-
return entry.source === "internal"
|
|
37
|
-
? `virtual:${normalizeKey(entry.name)}`
|
|
38
|
-
: normalizeKey(entry.entrySource || "");
|
|
39
|
-
}
|
|
40
|
-
function collectReachableOutputs(args) {
|
|
41
|
-
const seen = new Set();
|
|
42
|
-
const stack = [args.entryOutput];
|
|
43
|
-
while (stack.length) {
|
|
44
|
-
const current = stack.pop();
|
|
45
|
-
if (!current || seen.has(current))
|
|
46
|
-
continue;
|
|
47
|
-
seen.add(current);
|
|
48
|
-
const output = args.outputs[current];
|
|
49
|
-
if (!output)
|
|
50
|
-
continue;
|
|
51
|
-
for (const imported of output.imports) {
|
|
52
|
-
if (args.outputs[imported]) {
|
|
53
|
-
stack.push(imported);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
for (const css of output.css) {
|
|
57
|
-
if (args.outputs[css]) {
|
|
58
|
-
stack.push(css);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return Array.from(seen).sort();
|
|
63
|
-
}
|
|
64
|
-
function createEntryRecord(args) {
|
|
65
|
-
const js = toStableList(args.js);
|
|
66
|
-
const css = toStableList(args.outputs.filter((value) => value.endsWith(".css")));
|
|
67
|
-
const outputs = toStableList(args.outputs);
|
|
68
|
-
const jsSet = new Set(js);
|
|
69
|
-
const cssSet = new Set(css);
|
|
70
|
-
return {
|
|
71
|
-
key: args.entry.key,
|
|
72
|
-
kind: args.entry.kind,
|
|
73
|
-
ruleKey: args.entry.ruleKey,
|
|
74
|
-
strategy: args.entry.strategy,
|
|
75
|
-
entrySource: args.entry.entrySource,
|
|
76
|
-
sources: args.entry.ownedSources.slice().sort(),
|
|
77
|
-
file: args.entryOutput,
|
|
78
|
-
entryOutput: args.entryOutput,
|
|
79
|
-
outputs,
|
|
80
|
-
js,
|
|
81
|
-
css,
|
|
82
|
-
assets: outputs.filter((value) => !jsSet.has(value) && !cssSet.has(value)),
|
|
83
|
-
imports: toStableList(args.imports),
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
function buildAssetManifest(options) {
|
|
87
|
-
const rootDir = path.resolve(options.rootDir);
|
|
88
|
-
const outDir = path.resolve(rootDir, options.outDir);
|
|
89
|
-
const derived = deriveManifest(options.metafile, {
|
|
90
|
-
outDir,
|
|
91
|
-
rootDir,
|
|
92
|
-
});
|
|
93
|
-
const resolvedDiscovery = options.resolvedDiscovery || {
|
|
94
|
-
entries: [],
|
|
95
|
-
rules: {},
|
|
96
|
-
sourceOwners: {},
|
|
97
|
-
};
|
|
98
|
-
const entries = {};
|
|
99
|
-
const sources = {};
|
|
100
|
-
const entryOutputs = {};
|
|
101
|
-
const outputs = {};
|
|
102
|
-
const rules = Object.fromEntries(Object.entries(resolvedDiscovery.rules).map(([ruleKey, rule]) => [
|
|
103
|
-
ruleKey,
|
|
104
|
-
{
|
|
105
|
-
entryKeys: rule.entryKeys.slice().sort(),
|
|
106
|
-
ignoredSources: rule.ignoredSources.slice().sort(),
|
|
107
|
-
ruleKey: rule.ruleKey,
|
|
108
|
-
strategy: rule.strategy,
|
|
109
|
-
},
|
|
110
|
-
]));
|
|
111
|
-
const entryByLookupKey = new Map(resolvedDiscovery.entries
|
|
112
|
-
.map((entry) => [toEntryPointLookupKey(entry), entry])
|
|
113
|
-
.filter(([lookupKey]) => Boolean(lookupKey)));
|
|
114
|
-
const entryKeyByOutput = new Map();
|
|
115
|
-
for (const output of Object.values(derived.allOutputs)) {
|
|
116
|
-
const lookupKey = output.entryPoint ? normalizeSourcePath(output.entryPoint, rootDir) : "";
|
|
117
|
-
const entry = lookupKey ? entryByLookupKey.get(lookupKey) : undefined;
|
|
118
|
-
const outputKey = normalizeOutputPath(output.output, rootDir, outDir);
|
|
119
|
-
if (!outputKey)
|
|
120
|
-
continue;
|
|
121
|
-
if (entry && output.kind === "entry") {
|
|
122
|
-
entryKeyByOutput.set(output.output, entry.key);
|
|
123
|
-
}
|
|
124
|
-
outputs[outputKey] = {
|
|
125
|
-
output: outputKey,
|
|
126
|
-
kind: output.kind,
|
|
127
|
-
entryKey: entry?.key,
|
|
128
|
-
entryPoint: entry?.entrySource,
|
|
129
|
-
inputs: output.inputs.map((value) => normalizeSourcePath(value, rootDir)).filter(Boolean),
|
|
130
|
-
css: output.css.map((value) => normalizeOutputPath(value, rootDir, outDir)).filter(Boolean),
|
|
131
|
-
imports: output.imports.map((value) => normalizeOutputPath(value, rootDir, outDir)).filter(Boolean),
|
|
132
|
-
bytes: output.bytes,
|
|
133
|
-
ruleKey: entry?.ruleKey,
|
|
134
|
-
strategy: entry?.strategy,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
for (const entry of resolvedDiscovery.entries) {
|
|
138
|
-
const lookupKey = toEntryPointLookupKey(entry);
|
|
139
|
-
const derivedEntry = Object.values(derived.entries).find((item) => {
|
|
140
|
-
const output = derived.allOutputs[item.entryOutput];
|
|
141
|
-
return output?.entryPoint && normalizeSourcePath(output.entryPoint, rootDir) === lookupKey;
|
|
142
|
-
});
|
|
143
|
-
if (!derivedEntry)
|
|
144
|
-
continue;
|
|
145
|
-
const entryOutput = normalizeOutputPath(derivedEntry.entryOutput, rootDir, outDir);
|
|
146
|
-
if (!entryOutput)
|
|
147
|
-
continue;
|
|
148
|
-
const reachableOutputs = collectReachableOutputs({
|
|
149
|
-
entryOutput: derivedEntry.entryOutput,
|
|
150
|
-
outputs: derived.allOutputs,
|
|
151
|
-
}).map((value) => normalizeOutputPath(value, rootDir, outDir)).filter(Boolean);
|
|
152
|
-
entries[entry.key] = createEntryRecord({
|
|
153
|
-
entry,
|
|
154
|
-
entryOutput,
|
|
155
|
-
outputs: reachableOutputs,
|
|
156
|
-
js: derivedEntry.js.map((value) => normalizeOutputPath(value, rootDir, outDir)).filter(Boolean),
|
|
157
|
-
imports: derivedEntry.imports.map((value) => normalizeOutputPath(value, rootDir, outDir)).filter(Boolean),
|
|
158
|
-
});
|
|
159
|
-
entryOutputs[entryOutput] = entry.key;
|
|
160
|
-
for (const sourcePath of entry.ownedSources) {
|
|
161
|
-
sources[sourcePath] = {
|
|
162
|
-
source: sourcePath,
|
|
163
|
-
entryKey: entry.key,
|
|
164
|
-
ruleKey: entry.ruleKey,
|
|
165
|
-
strategy: entry.strategy,
|
|
166
|
-
outputs: reachableOutputs,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return {
|
|
171
|
-
entries: Object.fromEntries(Object.entries(entries).sort(([a], [b]) => a.localeCompare(b))),
|
|
172
|
-
sources: Object.fromEntries(Object.entries(sources).sort(([a], [b]) => a.localeCompare(b))),
|
|
173
|
-
entryOutputs: Object.fromEntries(Object.entries(entryOutputs).sort(([a], [b]) => a.localeCompare(b))),
|
|
174
|
-
outputs: Object.fromEntries(Object.entries(outputs).sort(([a], [b]) => a.localeCompare(b))),
|
|
175
|
-
rules: Object.fromEntries(Object.entries(rules).sort(([a], [b]) => a.localeCompare(b))),
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
function toPublicPath(publicPath, value) {
|
|
179
|
-
const normalizedValue = normalizeKey(value);
|
|
180
|
-
const base = String(publicPath || "").trim();
|
|
181
|
-
if (!base)
|
|
182
|
-
return normalizedValue;
|
|
183
|
-
if (base === "/")
|
|
184
|
-
return normalizedValue ? `/${normalizedValue}` : "/";
|
|
185
|
-
return `${base.replace(/\/+$/g, "")}/${normalizedValue.replace(/^\/+/g, "")}`;
|
|
186
|
-
}
|
|
187
|
-
function resolveEntryKey(manifest, entryId, from) {
|
|
188
|
-
const normalizedId = normalizeKey(entryId);
|
|
189
|
-
if (!normalizedId)
|
|
190
|
-
return "";
|
|
191
|
-
if (from === "entryKey") {
|
|
192
|
-
return manifest.entries[normalizedId] ? normalizedId : "";
|
|
193
|
-
}
|
|
194
|
-
if (from === "source") {
|
|
195
|
-
return manifest.sources[normalizedId]?.entryKey || "";
|
|
196
|
-
}
|
|
197
|
-
if (from === "entryOutput") {
|
|
198
|
-
return manifest.entryOutputs[normalizedId] || "";
|
|
199
|
-
}
|
|
200
|
-
return manifest.entries[normalizedId]
|
|
201
|
-
? normalizedId
|
|
202
|
-
: manifest.sources[normalizedId]?.entryKey
|
|
203
|
-
|| manifest.entryOutputs[normalizedId]
|
|
204
|
-
|| "";
|
|
205
|
-
}
|
|
206
|
-
function collectAssetLinks(manifest, entryIds, options = {}) {
|
|
207
|
-
const from = options.from || "auto";
|
|
208
|
-
const publicPath = options.publicPath;
|
|
209
|
-
const entryKeys = [];
|
|
210
|
-
const missing = [];
|
|
211
|
-
const scripts = new Set();
|
|
212
|
-
const styles = new Set();
|
|
213
|
-
const assets = new Set();
|
|
214
|
-
const outputs = new Set();
|
|
215
|
-
const seenKeys = new Set();
|
|
216
|
-
for (const entryId of entryIds || []) {
|
|
217
|
-
const entryKey = resolveEntryKey(manifest, entryId, from);
|
|
218
|
-
if (!entryKey) {
|
|
219
|
-
const normalizedId = normalizeKey(entryId);
|
|
220
|
-
if (normalizedId && !missing.includes(normalizedId)) {
|
|
221
|
-
missing.push(normalizedId);
|
|
222
|
-
}
|
|
223
|
-
continue;
|
|
224
|
-
}
|
|
225
|
-
if (seenKeys.has(entryKey))
|
|
226
|
-
continue;
|
|
227
|
-
seenKeys.add(entryKey);
|
|
228
|
-
entryKeys.push(entryKey);
|
|
229
|
-
const entry = manifest.entries[entryKey];
|
|
230
|
-
if (!entry)
|
|
231
|
-
continue;
|
|
232
|
-
for (const output of entry.outputs) {
|
|
233
|
-
outputs.add(toPublicPath(publicPath, output));
|
|
234
|
-
}
|
|
235
|
-
for (const asset of entry.assets) {
|
|
236
|
-
assets.add(toPublicPath(publicPath, asset));
|
|
237
|
-
}
|
|
238
|
-
for (const style of entry.css) {
|
|
239
|
-
styles.add(toPublicPath(publicPath, style));
|
|
240
|
-
}
|
|
241
|
-
if (/\.(?:[mc]?js)$/i.test(entry.file)) {
|
|
242
|
-
scripts.add(toPublicPath(publicPath, entry.file));
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
return {
|
|
246
|
-
entryKeys,
|
|
247
|
-
scripts: Array.from(scripts),
|
|
248
|
-
styles: Array.from(styles),
|
|
249
|
-
assets: Array.from(assets),
|
|
250
|
-
outputs: Array.from(outputs),
|
|
251
|
-
missing,
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
export { buildAssetManifest, collectAssetLinks };
|
|
1
|
+
export * from "../internal/core/asset-manifest.js";
|
|
255
2
|
//# sourceMappingURL=asset-manifest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-manifest.js","sourceRoot":"","sources":["../../src/core/asset-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAW7B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,WAAW,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACjG,CAAC;AAED,SA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,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACvC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED,OAAO;QACL,SAAS;QACT,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;QAC5B,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QAC1B,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QAC1B,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;QAC5B,OAAO;KACR,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"asset-manifest.js","sourceRoot":"","sources":["../../../src/core/asset-manifest.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
package/dist/core/build.d.ts
CHANGED
package/dist/core/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/core/build.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
package/dist/core/build.js
CHANGED
|
@@ -1,49 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { logPackageInitialized } from "@trebired/logger-adapter";
|
|
3
|
-
import { BUNDLER_LOG_GROUP, BUNDLER_PACKAGE_NAME } from "../constants.js";
|
|
4
|
-
import { resolveLogger } from "../logging.js";
|
|
5
|
-
import { createEsbuildOptions, normalizeBundlerOptions } from "./esbuild-options.js";
|
|
6
|
-
import { resolveBundlerEntries } from "./discovery.js";
|
|
7
|
-
import { cleanOutDir, formatFailure, logWarnings, toBuildResult } from "./shared.js";
|
|
8
|
-
async function bundle(options) {
|
|
9
|
-
const normalized = normalizeBundlerOptions(options || {});
|
|
10
|
-
const logger = resolveLogger(normalized.logger, normalized.loggerAdapter);
|
|
11
|
-
logPackageInitialized({
|
|
12
|
-
adapter: normalized.loggerAdapter,
|
|
13
|
-
fallback: "console",
|
|
14
|
-
group: BUNDLER_LOG_GROUP,
|
|
15
|
-
logger: normalized.logger,
|
|
16
|
-
source: BUNDLER_PACKAGE_NAME,
|
|
17
|
-
});
|
|
18
|
-
if (normalized.clean) {
|
|
19
|
-
logger.info("build", `clean :: ${normalized.outDir}`);
|
|
20
|
-
await cleanOutDir(normalized.outDir);
|
|
21
|
-
}
|
|
22
|
-
logger.info("build", "start");
|
|
23
|
-
const startedAt = Date.now();
|
|
24
|
-
try {
|
|
25
|
-
const resolvedDiscovery = await resolveBundlerEntries(options || {}, normalized.rootDir);
|
|
26
|
-
logger.info("build", `entries :: count=${resolvedDiscovery.entries.length}`);
|
|
27
|
-
const result = await runEsbuild(createEsbuildOptions({
|
|
28
|
-
...normalized,
|
|
29
|
-
entryRecords: resolvedDiscovery.entries,
|
|
30
|
-
}, logger));
|
|
31
|
-
logWarnings(logger, result.warnings);
|
|
32
|
-
const summary = await toBuildResult({
|
|
33
|
-
manifest: normalized.manifest,
|
|
34
|
-
outDir: normalized.outDir,
|
|
35
|
-
resolvedDiscovery,
|
|
36
|
-
result,
|
|
37
|
-
rootDir: normalized.rootDir,
|
|
38
|
-
startedAt,
|
|
39
|
-
});
|
|
40
|
-
logger.info("build", `complete :: outputs=${summary.outputs.length} warnings=${summary.warnings}`);
|
|
41
|
-
return summary;
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
logger.fail("build", `failed :: ${formatFailure(error)}`);
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
export { bundle };
|
|
1
|
+
export * from "../internal/core/build.js";
|
|
49
2
|
//# sourceMappingURL=build.js.map
|
package/dist/core/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/core/build.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { BundlerDerivedManifest } from "../types.js";
|
|
3
|
-
type DeriveManifestOptions = {
|
|
4
|
-
outDir: string;
|
|
5
|
-
rootDir: string;
|
|
6
|
-
};
|
|
7
|
-
declare function deriveManifest(metafile: Metafile, options: DeriveManifestOptions): BundlerDerivedManifest;
|
|
8
|
-
export { deriveManifest };
|
|
9
|
-
export type { DeriveManifestOptions };
|
|
1
|
+
export * from "../internal/core/derive-manifest.d.ts";
|
|
10
2
|
//# sourceMappingURL=derive-manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive-manifest.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"derive-manifest.d.ts","sourceRoot":"","sources":["../../../src/core/derive-manifest.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -1,154 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { VIRTUAL_ENTRY_NAMESPACE } from "../plugins/virtual-entries.js";
|
|
3
|
-
import { toPosixPath } from "./discovery.js";
|
|
4
|
-
import { VIRTUAL_ENTRY_PREFIX } from "./discovery.js";
|
|
5
|
-
function normalizeFilePath(filePath, rootDir) {
|
|
6
|
-
if (filePath.startsWith(VIRTUAL_ENTRY_PREFIX)) {
|
|
7
|
-
return `virtual:${filePath.slice(VIRTUAL_ENTRY_PREFIX.length)}`;
|
|
8
|
-
}
|
|
9
|
-
if (filePath.startsWith(`${VIRTUAL_ENTRY_NAMESPACE}:`)) {
|
|
10
|
-
return `virtual:${filePath.slice(VIRTUAL_ENTRY_NAMESPACE.length + 1)}`;
|
|
11
|
-
}
|
|
12
|
-
const absolute = path.isAbsolute(filePath) ? filePath : path.resolve(rootDir, filePath);
|
|
13
|
-
return toPosixPath(path.relative(rootDir, absolute));
|
|
14
|
-
}
|
|
15
|
-
function normalizeInputPaths(inputs, rootDir) {
|
|
16
|
-
return Object.keys(inputs)
|
|
17
|
-
.map((value) => normalizeFilePath(value, rootDir))
|
|
18
|
-
.sort();
|
|
19
|
-
}
|
|
20
|
-
function normalizeImportedOutputPaths(metafile, outputPath, rootDir) {
|
|
21
|
-
const output = metafile.outputs[outputPath];
|
|
22
|
-
if (!output)
|
|
23
|
-
return [];
|
|
24
|
-
return output.imports
|
|
25
|
-
.filter((item) => !item.external && Boolean(metafile.outputs[item.path]))
|
|
26
|
-
.map((item) => normalizeFilePath(item.path, rootDir))
|
|
27
|
-
.sort();
|
|
28
|
-
}
|
|
29
|
-
function resolveOutputKind(args) {
|
|
30
|
-
if (args.outputValue.entryPoint)
|
|
31
|
-
return "entry";
|
|
32
|
-
if (args.importedOutputs.has(args.outputRel) || /\.(?:[mc]?js)$/i.test(args.outputRel))
|
|
33
|
-
return "chunk";
|
|
34
|
-
return "asset";
|
|
35
|
-
}
|
|
36
|
-
function deriveEntryName(args) {
|
|
37
|
-
if (args.outputValue.entryPoint) {
|
|
38
|
-
const entryRel = normalizeFilePath(args.outputValue.entryPoint, args.rootDir);
|
|
39
|
-
const ext = path.extname(entryRel);
|
|
40
|
-
return toPosixPath(ext ? entryRel.slice(0, -ext.length) : entryRel);
|
|
41
|
-
}
|
|
42
|
-
const absoluteOutDir = path.resolve(args.rootDir, args.outDir);
|
|
43
|
-
const absoluteOutput = path.resolve(args.rootDir, args.entryOutput);
|
|
44
|
-
const relOut = toPosixPath(path.relative(absoluteOutDir, absoluteOutput));
|
|
45
|
-
if (!relOut || relOut.startsWith(".."))
|
|
46
|
-
return undefined;
|
|
47
|
-
const ext = path.extname(relOut);
|
|
48
|
-
return ext ? relOut.slice(0, -ext.length) : relOut;
|
|
49
|
-
}
|
|
50
|
-
function collectReachableOutputs(args) {
|
|
51
|
-
const seen = new Set();
|
|
52
|
-
const stack = [args.outputPath];
|
|
53
|
-
while (stack.length) {
|
|
54
|
-
const current = stack.pop();
|
|
55
|
-
if (seen.has(current))
|
|
56
|
-
continue;
|
|
57
|
-
seen.add(current);
|
|
58
|
-
const currentOutput = args.metafile.outputs[current];
|
|
59
|
-
if (!currentOutput)
|
|
60
|
-
continue;
|
|
61
|
-
for (const imported of currentOutput.imports) {
|
|
62
|
-
if (imported.external || !args.metafile.outputs[imported.path])
|
|
63
|
-
continue;
|
|
64
|
-
stack.push(imported.path);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return Array.from(seen).sort().map((value) => normalizeFilePath(value, args.rootDir));
|
|
68
|
-
}
|
|
69
|
-
function deriveManifest(metafile, options) {
|
|
70
|
-
const outputs = Object.entries(metafile.outputs).sort(([a], [b]) => a.localeCompare(b));
|
|
71
|
-
const importedOutputs = new Set();
|
|
72
|
-
for (const [, output] of outputs) {
|
|
73
|
-
for (const imported of output.imports) {
|
|
74
|
-
if (!imported.external && metafile.outputs[imported.path]) {
|
|
75
|
-
importedOutputs.add(normalizeFilePath(imported.path, options.rootDir));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const entries = {};
|
|
80
|
-
const chunks = {};
|
|
81
|
-
const allOutputs = {};
|
|
82
|
-
for (const [outputPath, outputValue] of outputs) {
|
|
83
|
-
const outputRel = normalizeFilePath(outputPath, options.rootDir);
|
|
84
|
-
const imports = normalizeImportedOutputPaths(metafile, outputPath, options.rootDir);
|
|
85
|
-
const css = outputValue.cssBundle
|
|
86
|
-
? [normalizeFilePath(outputValue.cssBundle, options.rootDir)]
|
|
87
|
-
: outputRel.endsWith(".css")
|
|
88
|
-
? [outputRel]
|
|
89
|
-
: [];
|
|
90
|
-
const outputInfo = {
|
|
91
|
-
output: outputRel,
|
|
92
|
-
kind: resolveOutputKind({
|
|
93
|
-
importedOutputs,
|
|
94
|
-
outputPath,
|
|
95
|
-
outputRel,
|
|
96
|
-
outputValue,
|
|
97
|
-
}),
|
|
98
|
-
entryPoint: outputValue.entryPoint ? normalizeFilePath(outputValue.entryPoint, options.rootDir) : undefined,
|
|
99
|
-
entryName: deriveEntryName({
|
|
100
|
-
entryOutput: outputPath,
|
|
101
|
-
outputValue,
|
|
102
|
-
outDir: options.outDir,
|
|
103
|
-
rootDir: options.rootDir,
|
|
104
|
-
}),
|
|
105
|
-
inputs: normalizeInputPaths(outputValue.inputs, options.rootDir),
|
|
106
|
-
css,
|
|
107
|
-
imports,
|
|
108
|
-
bytes: outputValue.bytes,
|
|
109
|
-
};
|
|
110
|
-
allOutputs[outputRel] = outputInfo;
|
|
111
|
-
}
|
|
112
|
-
for (const [outputPath] of outputs) {
|
|
113
|
-
const outputRel = normalizeFilePath(outputPath, options.rootDir);
|
|
114
|
-
const outputInfo = allOutputs[outputRel];
|
|
115
|
-
if (!outputInfo)
|
|
116
|
-
continue;
|
|
117
|
-
if (outputInfo.kind === "entry") {
|
|
118
|
-
const reachable = collectReachableOutputs({
|
|
119
|
-
metafile,
|
|
120
|
-
outputPath,
|
|
121
|
-
rootDir: options.rootDir,
|
|
122
|
-
});
|
|
123
|
-
const js = reachable.filter((value) => /\.(?:[mc]?js)$/i.test(value));
|
|
124
|
-
const reachableCss = Array.from(new Set(reachable.flatMap((value) => {
|
|
125
|
-
const info = allOutputs[value];
|
|
126
|
-
return info ? info.css : value.endsWith(".css") ? [value] : [];
|
|
127
|
-
}))).sort();
|
|
128
|
-
entries[outputRel] = {
|
|
129
|
-
entryOutput: outputRel,
|
|
130
|
-
entryName: outputInfo.entryName,
|
|
131
|
-
inputs: outputInfo.inputs,
|
|
132
|
-
js,
|
|
133
|
-
css: reachableCss,
|
|
134
|
-
imports: outputInfo.imports,
|
|
135
|
-
};
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
if (outputInfo.kind === "chunk") {
|
|
139
|
-
chunks[outputRel] = {
|
|
140
|
-
output: outputRel,
|
|
141
|
-
inputs: outputInfo.inputs,
|
|
142
|
-
css: outputInfo.css,
|
|
143
|
-
imports: outputInfo.imports,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return {
|
|
148
|
-
entries: Object.fromEntries(Object.entries(entries).sort(([a], [b]) => a.localeCompare(b))),
|
|
149
|
-
chunks: Object.fromEntries(Object.entries(chunks).sort(([a], [b]) => a.localeCompare(b))),
|
|
150
|
-
allOutputs: Object.fromEntries(Object.entries(allOutputs).sort(([a], [b]) => a.localeCompare(b))),
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
export { deriveManifest };
|
|
1
|
+
export * from "../internal/core/derive-manifest.js";
|
|
154
2
|
//# sourceMappingURL=derive-manifest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive-manifest.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"derive-manifest.js","sourceRoot":"","sources":["../../../src/core/derive-manifest.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
close(): void;
|
|
3
|
-
};
|
|
4
|
-
declare function createDiscoveryWatcher(args: {
|
|
5
|
-
dirs: string[];
|
|
6
|
-
onChange: () => void;
|
|
7
|
-
}): DiscoveryWatcher;
|
|
8
|
-
export { createDiscoveryWatcher };
|
|
1
|
+
export * from "../internal/core/discovery-watch.d.ts";
|
|
9
2
|
//# sourceMappingURL=discovery-watch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-watch.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"discovery-watch.d.ts","sourceRoot":"","sources":["../../../src/core/discovery-watch.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -1,101 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
function createDiscoveryWatcher(args) {
|
|
4
|
-
const watchers = new Map();
|
|
5
|
-
let closed = false;
|
|
6
|
-
let timer = null;
|
|
7
|
-
const interval = setInterval(() => {
|
|
8
|
-
if (refreshAll()) {
|
|
9
|
-
emitChange();
|
|
10
|
-
}
|
|
11
|
-
}, 250);
|
|
12
|
-
const emitChange = () => {
|
|
13
|
-
if (closed)
|
|
14
|
-
return;
|
|
15
|
-
if (timer)
|
|
16
|
-
clearTimeout(timer);
|
|
17
|
-
timer = setTimeout(() => {
|
|
18
|
-
timer = null;
|
|
19
|
-
args.onChange();
|
|
20
|
-
}, 80);
|
|
21
|
-
};
|
|
22
|
-
const ensureWatch = (dir) => {
|
|
23
|
-
if (closed || watchers.has(dir) || !fs.existsSync(dir))
|
|
24
|
-
return false;
|
|
25
|
-
let stats;
|
|
26
|
-
try {
|
|
27
|
-
stats = fs.statSync(dir);
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
if (!stats.isDirectory())
|
|
33
|
-
return false;
|
|
34
|
-
const watcher = fs.watch(dir, () => {
|
|
35
|
-
refreshAll();
|
|
36
|
-
emitChange();
|
|
37
|
-
});
|
|
38
|
-
watcher.on("error", () => {
|
|
39
|
-
watchers.delete(dir);
|
|
40
|
-
});
|
|
41
|
-
watchers.set(dir, watcher);
|
|
42
|
-
return true;
|
|
43
|
-
};
|
|
44
|
-
const collectDirs = (startDir, found) => {
|
|
45
|
-
if (closed || !fs.existsSync(startDir))
|
|
46
|
-
return;
|
|
47
|
-
const stack = [startDir];
|
|
48
|
-
while (stack.length) {
|
|
49
|
-
const current = stack.pop();
|
|
50
|
-
if (!fs.existsSync(current))
|
|
51
|
-
continue;
|
|
52
|
-
found.add(current);
|
|
53
|
-
try {
|
|
54
|
-
for (const entry of fs.readdirSync(current, { withFileTypes: true })) {
|
|
55
|
-
if (!entry.isDirectory())
|
|
56
|
-
continue;
|
|
57
|
-
const child = path.join(current, entry.name);
|
|
58
|
-
stack.push(child);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const refreshAll = () => {
|
|
67
|
-
let changed = false;
|
|
68
|
-
const found = new Set();
|
|
69
|
-
for (const dir of args.dirs) {
|
|
70
|
-
collectDirs(dir, found);
|
|
71
|
-
}
|
|
72
|
-
for (const dir of found) {
|
|
73
|
-
if (ensureWatch(dir)) {
|
|
74
|
-
changed = true;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
for (const [dir, watcher] of watchers.entries()) {
|
|
78
|
-
if (found.has(dir))
|
|
79
|
-
continue;
|
|
80
|
-
watcher.close();
|
|
81
|
-
watchers.delete(dir);
|
|
82
|
-
changed = true;
|
|
83
|
-
}
|
|
84
|
-
return changed;
|
|
85
|
-
};
|
|
86
|
-
refreshAll();
|
|
87
|
-
return {
|
|
88
|
-
close() {
|
|
89
|
-
closed = true;
|
|
90
|
-
clearInterval(interval);
|
|
91
|
-
if (timer)
|
|
92
|
-
clearTimeout(timer);
|
|
93
|
-
for (const watcher of watchers.values()) {
|
|
94
|
-
watcher.close();
|
|
95
|
-
}
|
|
96
|
-
watchers.clear();
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
export { createDiscoveryWatcher };
|
|
1
|
+
export * from "../internal/core/discovery-watch.js";
|
|
101
2
|
//# sourceMappingURL=discovery-watch.js.map
|