@animus-ui/extract 0.1.26 → 0.1.28
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/crates/extract-v2/animus-extract-v2.darwin-arm64.node +0 -0
- package/crates/extract-v2/animus-extract-v2.linux-arm64-gnu.node +0 -0
- package/crates/extract-v2/animus-extract-v2.linux-x64-gnu.node +0 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/pipeline/core-options.d.ts +18 -0
- package/dist/pipeline/core-options.d.ts.map +1 -1
- package/dist/pipeline/engine-adapter.d.ts.map +1 -1
- package/dist/pipeline/index.d.ts +1 -1
- package/dist/pipeline/index.d.ts.map +1 -1
- package/dist/pipeline/manifest-diagnostics.d.ts +1 -1
- package/dist/pipeline/manifest-diagnostics.d.ts.map +1 -1
- package/dist/pipeline/probe-evidence.d.ts +8 -5
- package/dist/pipeline/probe-evidence.d.ts.map +1 -1
- package/dist/pipeline/registry-packages.d.ts +27 -0
- package/dist/pipeline/registry-packages.d.ts.map +1 -0
- package/dist/pipeline/run-analysis.d.ts +13 -0
- package/dist/pipeline/run-analysis.d.ts.map +1 -1
- package/dist/{pipeline-BzMQ_Z0M.mjs → pipeline-DAcqiv0D.mjs} +3062 -2842
- package/dist/{pipeline-DyUf-eKZ.cjs → pipeline-TQ5MPEFr.cjs} +3061 -2841
- package/dist/session/environment-builds.d.ts +26 -0
- package/dist/session/environment-builds.d.ts.map +1 -0
- package/dist/session/extraction-session.d.ts +55 -11
- package/dist/session/extraction-session.d.ts.map +1 -1
- package/dist/session/index.d.ts +4 -2
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/singleton.d.ts +33 -30
- package/dist/session/singleton.d.ts.map +1 -1
- package/dist/session/turbopack-orchestrator.d.ts.map +1 -1
- package/dist/session.cjs +253 -163
- package/dist/session.mjs +194 -106
- package/package.json +4 -4
package/dist/session.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_pipeline = require("./pipeline-
|
|
2
|
+
const require_pipeline = require("./pipeline-TQ5MPEFr.cjs");
|
|
3
3
|
let crypto = require("crypto");
|
|
4
4
|
let fs = require("fs");
|
|
5
5
|
let path = require("path");
|
|
@@ -51,6 +51,50 @@ var CoalescingWindow = class {
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
//#endregion
|
|
54
|
+
//#region session/environment-builds.ts
|
|
55
|
+
/**
|
|
56
|
+
* Each environment build that started and has not ended, by name. A host
|
|
57
|
+
* that builds a shared plugin's environments in parallel (a Vite `buildApp`)
|
|
58
|
+
* shares one build among them, retired by the last to end. A build under a
|
|
59
|
+
* name whose build is open (a reused builder, or a second environment under
|
|
60
|
+
* one name) waits for that build's end, so each build ends only its own
|
|
61
|
+
* generation, once.
|
|
62
|
+
*/
|
|
63
|
+
var EnvironmentBuilds = class {
|
|
64
|
+
/** What a host without environments builds as. */
|
|
65
|
+
single = { name: "build" };
|
|
66
|
+
builds = /* @__PURE__ */ new Map();
|
|
67
|
+
/** Opens `environment`'s build once no build under its name is open;
|
|
68
|
+
* whether another environment's build is open beside it. */
|
|
69
|
+
async open(environment) {
|
|
70
|
+
for (;;) {
|
|
71
|
+
const open = this.builds.get(environment.name);
|
|
72
|
+
if (open === void 0) break;
|
|
73
|
+
await open.ended;
|
|
74
|
+
}
|
|
75
|
+
let end = () => {};
|
|
76
|
+
const ended = new Promise((settle) => {
|
|
77
|
+
end = settle;
|
|
78
|
+
});
|
|
79
|
+
this.builds.set(environment.name, {
|
|
80
|
+
environment,
|
|
81
|
+
ended,
|
|
82
|
+
end
|
|
83
|
+
});
|
|
84
|
+
return this.builds.size > 1;
|
|
85
|
+
}
|
|
86
|
+
/** Ends `environment`'s build if this environment opened it; whether that
|
|
87
|
+
* left none open. A host can end an environment it never opened (a dev
|
|
88
|
+
* server ends every environment, started or not), which ends nothing. */
|
|
89
|
+
end(environment) {
|
|
90
|
+
const open = this.builds.get(environment.name);
|
|
91
|
+
if (open === void 0 || open.environment !== environment) return false;
|
|
92
|
+
this.builds.delete(environment.name);
|
|
93
|
+
open.end();
|
|
94
|
+
return this.builds.size === 0;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
54
98
|
//#region pipeline/system-instances.ts
|
|
55
99
|
/**
|
|
56
100
|
* The system and the analysis read one instance of each kit (spec §2.2
|
|
@@ -60,11 +104,11 @@ var CoalescingWindow = class {
|
|
|
60
104
|
* one the system evaluated is refused: its components would be extracted
|
|
61
105
|
* against another instance's vocabulary.
|
|
62
106
|
*/
|
|
63
|
-
function realPath(path$
|
|
107
|
+
function realPath(path$39) {
|
|
64
108
|
try {
|
|
65
|
-
return (0, fs.realpathSync)(path$
|
|
109
|
+
return (0, fs.realpathSync)(path$39);
|
|
66
110
|
} catch {
|
|
67
|
-
return path$
|
|
111
|
+
return path$39;
|
|
68
112
|
}
|
|
69
113
|
}
|
|
70
114
|
/**
|
|
@@ -75,7 +119,7 @@ function realPath(path$38) {
|
|
|
75
119
|
*/
|
|
76
120
|
function systemInstanceMismatches(input) {
|
|
77
121
|
const evaluated = new Set(input.evaluated.map(realPath));
|
|
78
|
-
const shown = (path$
|
|
122
|
+
const shown = (path$40) => (0, path.relative)(input.rootDir, path$40).split(path.sep).join("/");
|
|
79
123
|
const diagnostics = [];
|
|
80
124
|
for (const specifier of input.specifiers) {
|
|
81
125
|
if (!require_pipeline.isPackageSpecifier(specifier)) continue;
|
|
@@ -315,7 +359,7 @@ function lockRecordBytes(startedAt, build) {
|
|
|
315
359
|
const HEARTBEAT_TEMP_PREFIX = ".lock-heartbeat-";
|
|
316
360
|
function holdDirectoryClaim(dir, options = {}) {
|
|
317
361
|
const startedAt = options.startedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
318
|
-
const path$
|
|
362
|
+
const path$38 = (0, path.join)(dir, CLI_LOCK_ARTIFACT);
|
|
319
363
|
const tempPath = (0, path.join)(dir, `${HEARTBEAT_TEMP_PREFIX}${process.pid}`);
|
|
320
364
|
const rename = options.write === "rename";
|
|
321
365
|
let refresh = null;
|
|
@@ -329,12 +373,12 @@ function holdDirectoryClaim(dir, options = {}) {
|
|
|
329
373
|
try {
|
|
330
374
|
if (rename) {
|
|
331
375
|
(0, fs.writeFileSync)(tempPath, lockRecordBytes(startedAt, options.build));
|
|
332
|
-
(0, fs.renameSync)(tempPath, path$
|
|
333
|
-
} else (0, fs.writeFileSync)(path$
|
|
376
|
+
(0, fs.renameSync)(tempPath, path$38);
|
|
377
|
+
} else (0, fs.writeFileSync)(path$38, lockRecordBytes(startedAt, options.build));
|
|
334
378
|
} catch (error) {
|
|
335
379
|
stop();
|
|
336
380
|
if (isMissingFile(error)) return;
|
|
337
|
-
console.error(`[animus] Could not write the directory claim ${path$
|
|
381
|
+
console.error(`[animus] Could not write the directory claim ${path$38}: ${String(error)}`);
|
|
338
382
|
}
|
|
339
383
|
};
|
|
340
384
|
stamp();
|
|
@@ -345,7 +389,7 @@ function holdDirectoryClaim(dir, options = {}) {
|
|
|
345
389
|
return () => {
|
|
346
390
|
stop();
|
|
347
391
|
if (rename) (0, fs.rmSync)(tempPath, { force: true });
|
|
348
|
-
(0, fs.rmSync)(path$
|
|
392
|
+
(0, fs.rmSync)(path$38, { force: true });
|
|
349
393
|
};
|
|
350
394
|
}
|
|
351
395
|
/** Snapshot the session's copied asset() files, sorted, BEFORE the session
|
|
@@ -373,11 +417,15 @@ function joined(key) {
|
|
|
373
417
|
if (state === void 0) throw new Error(`[animus] no participant has joined build ${key.build} of ${key.root}`);
|
|
374
418
|
return state;
|
|
375
419
|
}
|
|
376
|
-
|
|
377
|
-
|
|
420
|
+
/** Commits the build's publication, the one write of everything below. */
|
|
421
|
+
function setPublication(key, publication) {
|
|
422
|
+
joined(key).publication = publication;
|
|
423
|
+
}
|
|
424
|
+
function publicationOf(key) {
|
|
425
|
+
return findSession(key)?.publication ?? null;
|
|
378
426
|
}
|
|
379
|
-
function
|
|
380
|
-
|
|
427
|
+
function getManifestJson(key) {
|
|
428
|
+
return publicationOf(key)?.manifestJson ?? null;
|
|
381
429
|
}
|
|
382
430
|
/**
|
|
383
431
|
* A latch over the most recently STARTED analysis, never cleared on settle:
|
|
@@ -401,37 +449,30 @@ function claimUnmatchedExcludeReport(key) {
|
|
|
401
449
|
state.unmatchedExcludesReported = true;
|
|
402
450
|
return true;
|
|
403
451
|
}
|
|
404
|
-
|
|
405
|
-
|
|
452
|
+
/** True for the build's first caller only: the one that reports what the
|
|
453
|
+
* build extracted. */
|
|
454
|
+
function claimExtractionReport(key) {
|
|
455
|
+
const state = joined(key);
|
|
456
|
+
if (state.extractionReported) return false;
|
|
457
|
+
state.extractionReported = true;
|
|
458
|
+
return true;
|
|
406
459
|
}
|
|
407
|
-
function
|
|
408
|
-
|
|
460
|
+
function getSharedCss(key) {
|
|
461
|
+
return publicationOf(key)?.styles ?? "";
|
|
409
462
|
}
|
|
410
463
|
function getSharedSystemProps(key) {
|
|
411
|
-
return
|
|
412
|
-
}
|
|
413
|
-
function setSharedSystemProps(key, content) {
|
|
414
|
-
joined(key).sharedSystemProps = content;
|
|
464
|
+
return publicationOf(key)?.systemPropsModule ?? "";
|
|
415
465
|
}
|
|
416
466
|
function getSharedExternalDirs(key) {
|
|
417
|
-
return
|
|
418
|
-
}
|
|
419
|
-
function setSharedExternalDirs(key, dirs) {
|
|
420
|
-
joined(key).externalDirs = dirs;
|
|
467
|
+
return publicationOf(key)?.externalPackageDirs ?? [];
|
|
421
468
|
}
|
|
422
469
|
function getSharedExternalEntries(key) {
|
|
423
|
-
return
|
|
424
|
-
}
|
|
425
|
-
function setSharedExternalEntries(key, entries) {
|
|
426
|
-
joined(key).externalEntries = entries;
|
|
470
|
+
return publicationOf(key)?.externalSourceEntries ?? /* @__PURE__ */ new Map();
|
|
427
471
|
}
|
|
428
472
|
/** Specifier → its source entry's side effects, published with the shared
|
|
429
473
|
* entries; absent leaves the bundler's own classification. */
|
|
430
474
|
function getSharedExternalSideEffects(key) {
|
|
431
|
-
return
|
|
432
|
-
}
|
|
433
|
-
function setSharedExternalSideEffects(key, sideEffects) {
|
|
434
|
-
joined(key).externalSideEffects = sideEffects;
|
|
475
|
+
return publicationOf(key)?.externalSourceSideEffects ?? /* @__PURE__ */ new Map();
|
|
435
476
|
}
|
|
436
477
|
/**
|
|
437
478
|
* The only session of a build that can run watch analysis. A non-owning
|
|
@@ -449,18 +490,12 @@ function setOwningWatchSession(key, session) {
|
|
|
449
490
|
* the exact bytes analyzed), including files that produced zero entries.
|
|
450
491
|
*/
|
|
451
492
|
function getAnalyzedHashes(key) {
|
|
452
|
-
return
|
|
453
|
-
}
|
|
454
|
-
function setAnalyzedHashes(key, hashes) {
|
|
455
|
-
joined(key).analyzedHashes = hashes;
|
|
493
|
+
return publicationOf(key)?.analyzedHashes ?? null;
|
|
456
494
|
}
|
|
457
495
|
/** What the build's last published analysis read of the discovered
|
|
458
496
|
* packages (spec §2.2 A4); null before one publishes. */
|
|
459
497
|
function getSharedPackageReadRecord(key) {
|
|
460
|
-
return
|
|
461
|
-
}
|
|
462
|
-
function setSharedPackageReadRecord(key, record) {
|
|
463
|
-
joined(key).packageReadRecord = record;
|
|
498
|
+
return publicationOf(key)?.packageReadRecord ?? null;
|
|
464
499
|
}
|
|
465
500
|
/**
|
|
466
501
|
* One participant publishes a build's analysis, holding this claim until it
|
|
@@ -486,15 +521,10 @@ function getSessionArtifactDir(key) {
|
|
|
486
521
|
function setSessionArtifactDir(key, dir) {
|
|
487
522
|
joined(key).artifactDir = dir;
|
|
488
523
|
}
|
|
489
|
-
/**
|
|
490
|
-
*
|
|
491
|
-
* manifest so an epoch reader always sees at least that generation's manifest.
|
|
492
|
-
*/
|
|
524
|
+
/** Replacement epoch of the last published analysis: committed in the same
|
|
525
|
+
* record as its manifest, so an epoch reader sees that generation's. */
|
|
493
526
|
function getReplacementEpoch(key) {
|
|
494
|
-
return
|
|
495
|
-
}
|
|
496
|
-
function setReplacementEpoch(key, epoch) {
|
|
497
|
-
joined(key).replacementEpoch = epoch;
|
|
527
|
+
return publicationOf(key)?.replacementEpoch ?? null;
|
|
498
528
|
}
|
|
499
529
|
/**
|
|
500
530
|
* The build's one in-flight watch-analysis transaction: a participant that
|
|
@@ -672,6 +702,8 @@ const OPTION_CLASSES = {
|
|
|
672
702
|
layers: digestOf("layers"),
|
|
673
703
|
engine: digestOf("engine"),
|
|
674
704
|
mode: digestOf("mode"),
|
|
705
|
+
runtimeImport: digestOf("runtimeImport"),
|
|
706
|
+
closedDynamicImports: digestOf("closedDynamicImports"),
|
|
675
707
|
root: "excluded"
|
|
676
708
|
};
|
|
677
709
|
/** The options a build's analysis depends on, each as stable text; each is
|
|
@@ -724,17 +756,10 @@ function joinSession(key, participant, options) {
|
|
|
724
756
|
},
|
|
725
757
|
systemAuthority: null,
|
|
726
758
|
claimRecord: null,
|
|
727
|
-
|
|
728
|
-
sharedCss: "",
|
|
729
|
-
sharedSystemProps: "",
|
|
730
|
-
externalDirs: [],
|
|
731
|
-
externalEntries: /* @__PURE__ */ new Map(),
|
|
732
|
-
externalSideEffects: /* @__PURE__ */ new Map(),
|
|
733
|
-
analyzedHashes: null,
|
|
734
|
-
packageReadRecord: null,
|
|
735
|
-
replacementEpoch: null,
|
|
759
|
+
publication: null,
|
|
736
760
|
artifactDir: null,
|
|
737
|
-
unmatchedExcludesReported: false
|
|
761
|
+
unmatchedExcludesReported: false,
|
|
762
|
+
extractionReported: false
|
|
738
763
|
};
|
|
739
764
|
sessions.set(id, state);
|
|
740
765
|
return state;
|
|
@@ -887,6 +912,9 @@ function misspelledHostSources(hostSources, readPaths) {
|
|
|
887
912
|
function isDiskNumber(value) {
|
|
888
913
|
return Object(value) !== value && Object.prototype.toString.call(value) === "[object Number]";
|
|
889
914
|
}
|
|
915
|
+
/** The session's own system-props file, imported by absolute path: what a
|
|
916
|
+
* host that serves no system-props module (the CLI) delivers. */
|
|
917
|
+
const SESSION_ARTIFACT = Symbol("animus.session-artifact");
|
|
890
918
|
/** A file's content hash, or '' when it cannot be read. */
|
|
891
919
|
function fileHashOrEmpty(path$7) {
|
|
892
920
|
try {
|
|
@@ -906,9 +934,6 @@ var ExtractionSession = class {
|
|
|
906
934
|
host;
|
|
907
935
|
/** Set by the adapter before any pipeline run. */
|
|
908
936
|
rootDir = null;
|
|
909
|
-
/** The module extracted terminals import their factories from; an
|
|
910
|
-
* override must supply every terminal the analysis extracts. */
|
|
911
|
-
runtimeImport = require_pipeline.DEFAULT_RUNTIME_IMPORT;
|
|
912
937
|
/** A host that resolves imports itself (Vite's `this.resolve`): package
|
|
913
938
|
* discovery asks it first, the loader only for a declared workspace it
|
|
914
939
|
* cannot resolve. Null resolves through the loader alone. */
|
|
@@ -942,12 +967,12 @@ var ExtractionSession = class {
|
|
|
942
967
|
/** Physical asset files registered with the host watcher. */
|
|
943
968
|
assetDependencyPaths = /* @__PURE__ */ new Set();
|
|
944
969
|
assetDependencyKeys = /* @__PURE__ */ new Set();
|
|
945
|
-
/**
|
|
946
|
-
*
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
970
|
+
/** What generated code imports; a host that serves its own modules
|
|
971
|
+
* declares them before planning. */
|
|
972
|
+
delivery = {
|
|
973
|
+
cssModuleId: ANIMUS_CSS_MODULE_ID,
|
|
974
|
+
systemPropsModuleId: SESSION_ARTIFACT
|
|
975
|
+
};
|
|
951
976
|
/** Whether the analysis-inputs hydration corpus is written to disk. Only
|
|
952
977
|
* isolated loader workers replay it; an in-process loader reads memory. */
|
|
953
978
|
persistAnalysisInputs = false;
|
|
@@ -1019,8 +1044,8 @@ var ExtractionSession = class {
|
|
|
1019
1044
|
get heldSources() {
|
|
1020
1045
|
return this.fileCache;
|
|
1021
1046
|
}
|
|
1022
|
-
/** The generation an emit produced,
|
|
1023
|
-
*
|
|
1047
|
+
/** The generation an emit produced, until it commits with the
|
|
1048
|
+
* ingestion's ownership and the external package state it analysed. */
|
|
1024
1049
|
stagedPublication = null;
|
|
1025
1050
|
options;
|
|
1026
1051
|
staticCssJson;
|
|
@@ -1062,10 +1087,31 @@ var ExtractionSession = class {
|
|
|
1062
1087
|
};
|
|
1063
1088
|
}
|
|
1064
1089
|
systemDependencyKeys = /* @__PURE__ */ new Set();
|
|
1090
|
+
/** What a host watches for this Session, one list for every host: the
|
|
1091
|
+
* files whose change it acts on (the system module and the modules it
|
|
1092
|
+
* read, asset() sources, the configuration inputs), the paths the system
|
|
1093
|
+
* load found absent, whose creation reloads it, and the external package
|
|
1094
|
+
* roots, watched recursively. An absent path inside `covered` (roots the
|
|
1095
|
+
* host already watches recursively) is left out: a host's recursive
|
|
1096
|
+
* watch reports its creation, and watching an absent file inside a
|
|
1097
|
+
* watched directory can stop that directory's events (inotify). */
|
|
1098
|
+
watchPlan(covered = []) {
|
|
1099
|
+
const system = this.rootDir === null ? [] : [(0, path.resolve)(this.rootDir, this.options.system)];
|
|
1100
|
+
return {
|
|
1101
|
+
files: [.../* @__PURE__ */ new Set([
|
|
1102
|
+
...system,
|
|
1103
|
+
...this.systemDependencyPaths,
|
|
1104
|
+
...this.assetDependencyPaths,
|
|
1105
|
+
...this.configInputPaths
|
|
1106
|
+
])],
|
|
1107
|
+
missing: this.systemMissingPaths.filter((path$9) => !covered.some((root) => require_pipeline.isPathWithinRoot(root, path$9))),
|
|
1108
|
+
directories: [...this.externalWatchRoots]
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1065
1111
|
/** Whether `path` is the system module, one of its dependencies, or a
|
|
1066
1112
|
* path its load found absent: a change to it reloads the system. */
|
|
1067
|
-
isSystemDependency(path$
|
|
1068
|
-
return require_pipeline.toWatchKeys(path$
|
|
1113
|
+
isSystemDependency(path$10) {
|
|
1114
|
+
return require_pipeline.toWatchKeys(path$10).some((key) => this.systemDependencyKeys.has(key));
|
|
1069
1115
|
}
|
|
1070
1116
|
/** Loader-reported dependency paths for bundler watch registration. */
|
|
1071
1117
|
systemDependencyPaths = [];
|
|
@@ -1153,6 +1199,10 @@ var ExtractionSession = class {
|
|
|
1153
1199
|
this.ingestionFailureDiagnostics = this.ingestionFailureDiagnostics.filter((diagnostic) => diagnostic.file !== relPath);
|
|
1154
1200
|
return this.ingestionFailureDiagnostics.length !== before;
|
|
1155
1201
|
}
|
|
1202
|
+
/** The module extracted terminals import their factories from. */
|
|
1203
|
+
get runtimeImport() {
|
|
1204
|
+
return this.options.runtimeImport ?? "@animus-ui/system/runtime";
|
|
1205
|
+
}
|
|
1156
1206
|
get sessionDir() {
|
|
1157
1207
|
return sessionArtifactDir(this.rootDir, this.sessionId);
|
|
1158
1208
|
}
|
|
@@ -1233,6 +1283,12 @@ var ExtractionSession = class {
|
|
|
1233
1283
|
* excluded as literal path prefixes from discovery and from package
|
|
1234
1284
|
* collection, whatever the user's list. */
|
|
1235
1285
|
structuralExclude = [];
|
|
1286
|
+
/** The build configuration files the host loaded, absolute: config
|
|
1287
|
+
* roots, beside the well-known tool config names, whose unanalysed
|
|
1288
|
+
* imports open nothing the app renders. */
|
|
1289
|
+
buildConfigFiles = [];
|
|
1290
|
+
/** How long the last full pass took to load the system, in ms. */
|
|
1291
|
+
systemLoadMs = 0;
|
|
1236
1292
|
scanConfigMemo = null;
|
|
1237
1293
|
/** Resolve the scan configuration from options — the single source of the
|
|
1238
1294
|
* exclude/extension policy shared by the full and incremental pipelines,
|
|
@@ -1276,27 +1332,27 @@ var ExtractionSession = class {
|
|
|
1276
1332
|
recordObservation(changes) {
|
|
1277
1333
|
const queue = observationQueue(this.key);
|
|
1278
1334
|
const observed = /* @__PURE__ */ new Map();
|
|
1279
|
-
for (const path$
|
|
1335
|
+
for (const path$11 of changes.modifiedFiles ?? []) {
|
|
1280
1336
|
let state;
|
|
1281
1337
|
try {
|
|
1282
|
-
state = require_pipeline.contentHash(changes.sources?.get(path$
|
|
1338
|
+
state = require_pipeline.contentHash(changes.sources?.get(path$11) ?? (0, fs.readFileSync)(path$11, "utf-8"));
|
|
1283
1339
|
} catch {
|
|
1284
1340
|
state = UNREADABLE_OBSERVATION;
|
|
1285
1341
|
}
|
|
1286
|
-
observed.set(path$
|
|
1342
|
+
observed.set(path$11, state);
|
|
1287
1343
|
}
|
|
1288
|
-
for (const path$
|
|
1344
|
+
for (const path$12 of changes.removedFiles ?? []) observed.set(path$12, REMOVED_OBSERVATION);
|
|
1289
1345
|
const revision = ++queue.revision;
|
|
1290
1346
|
const active = queue.active;
|
|
1291
|
-
if (active !== null && [...observed].every(([path$
|
|
1347
|
+
if (active !== null && [...observed].every(([path$13, state]) => !queue.untaken.has(path$13) && active.taken.get(path$13) === state)) {
|
|
1292
1348
|
queue.revisions.set(revision, active.transaction);
|
|
1293
1349
|
return revision;
|
|
1294
1350
|
}
|
|
1295
|
-
for (const [path$
|
|
1296
|
-
queue.untaken.set(path$
|
|
1297
|
-
const supplied = changes.sources?.get(path$
|
|
1298
|
-
if (supplied === void 0) queue.suppliedSources.delete(path$
|
|
1299
|
-
else queue.suppliedSources.set(path$
|
|
1351
|
+
for (const [path$14, state] of observed) {
|
|
1352
|
+
queue.untaken.set(path$14, state);
|
|
1353
|
+
const supplied = changes.sources?.get(path$14);
|
|
1354
|
+
if (supplied === void 0) queue.suppliedSources.delete(path$14);
|
|
1355
|
+
else queue.suppliedSources.set(path$14, supplied);
|
|
1300
1356
|
}
|
|
1301
1357
|
queue.revisions.set(revision, null);
|
|
1302
1358
|
return revision;
|
|
@@ -1334,7 +1390,7 @@ var ExtractionSession = class {
|
|
|
1334
1390
|
const { taken, rescan, sources } = this.takeObservations();
|
|
1335
1391
|
const modifiedFiles = /* @__PURE__ */ new Set();
|
|
1336
1392
|
const removedFiles = /* @__PURE__ */ new Set();
|
|
1337
|
-
for (const [path$
|
|
1393
|
+
for (const [path$15, state] of taken) (state === REMOVED_OBSERVATION ? removedFiles : modifiedFiles).add(path$15);
|
|
1338
1394
|
this.settleTaken(taken, this.runWatchAttempt({
|
|
1339
1395
|
modifiedFiles,
|
|
1340
1396
|
removedFiles,
|
|
@@ -1399,11 +1455,11 @@ var ExtractionSession = class {
|
|
|
1399
1455
|
if (changed.length === 0) {
|
|
1400
1456
|
systemHit = firstChangedFile(this.systemDependencyHashes);
|
|
1401
1457
|
if (systemHit === void 0) configHit = firstChangedFile(this.configInputHashes);
|
|
1402
|
-
} else systemHit = changed.find((path$
|
|
1458
|
+
} else systemHit = changed.find((path$16) => this.isSystemDependency(path$16));
|
|
1403
1459
|
} catch (err) {
|
|
1404
1460
|
this.warn(`HMR system-reload check failed: ${String(err)}`);
|
|
1405
1461
|
}
|
|
1406
|
-
configHit ??= changed.find((path$
|
|
1462
|
+
configHit ??= changed.find((path$17) => require_pipeline.toWatchKeys(path$17).some((key) => this.configInputKeys.has(key)));
|
|
1407
1463
|
const debtRetry = this.systemReloadOwed && this.heldRejection === null;
|
|
1408
1464
|
if (systemHit || configHit || debtRetry) {
|
|
1409
1465
|
this.log(systemHit ? `system reload: system dependency changed (${(0, path.relative)(rootDir, systemHit)})` : configHit ? `system reload: configuration changed (${(0, path.relative)(rootDir, configHit)})` : "system reload: retrying the reload a failure left owed");
|
|
@@ -1423,13 +1479,14 @@ var ExtractionSession = class {
|
|
|
1423
1479
|
}
|
|
1424
1480
|
return;
|
|
1425
1481
|
}
|
|
1426
|
-
if (changed.some((path$
|
|
1482
|
+
if (changed.some((path$18) => require_pipeline.toWatchKeys(path$18).some((key) => this.assetDependencyKeys.has(key)))) {
|
|
1427
1483
|
this.assetCopyCache.clear();
|
|
1428
1484
|
assetChanged = true;
|
|
1429
1485
|
}
|
|
1430
1486
|
const { excludeMatcher, extensionsSet } = this.scanConfig;
|
|
1431
1487
|
const priorCacheEntries = /* @__PURE__ */ new Map();
|
|
1432
1488
|
const priorExternalFileOwners = { ...this.externalFileOwners };
|
|
1489
|
+
const priorHostSuppliedKeys = new Set(this.hostSuppliedKeys);
|
|
1433
1490
|
const recordPrior = (key) => {
|
|
1434
1491
|
if (!priorCacheEntries.has(key)) priorCacheEntries.set(key, this.fileCache.get(key) ?? null);
|
|
1435
1492
|
};
|
|
@@ -1579,6 +1636,7 @@ var ExtractionSession = class {
|
|
|
1579
1636
|
else this.fileCache.set(key, prior);
|
|
1580
1637
|
}
|
|
1581
1638
|
this.externalFileOwners = priorExternalFileOwners;
|
|
1639
|
+
this.hostSuppliedKeys = priorHostSuppliedKeys;
|
|
1582
1640
|
}
|
|
1583
1641
|
if (this.statusAttemptOpen) {
|
|
1584
1642
|
this.debouncePending.clear();
|
|
@@ -1586,7 +1644,7 @@ var ExtractionSession = class {
|
|
|
1586
1644
|
}
|
|
1587
1645
|
throw err;
|
|
1588
1646
|
}
|
|
1589
|
-
this.publishSourceIngestion(ingested, "incremental", (path$
|
|
1647
|
+
this.publishSourceIngestion(ingested, "incremental", (path$19) => this.fileCache.get(path$19));
|
|
1590
1648
|
commitObservedBatch();
|
|
1591
1649
|
} else if (this.statusAttemptOpen) {
|
|
1592
1650
|
this.debouncePending.clear();
|
|
@@ -1607,6 +1665,20 @@ var ExtractionSession = class {
|
|
|
1607
1665
|
});
|
|
1608
1666
|
throw new AbortedParseRejection(rejection.message);
|
|
1609
1667
|
}
|
|
1668
|
+
/** Holds a held full read's entries: what it read stays the held bytes,
|
|
1669
|
+
* never overwriting held host bytes with the disk's (a key the host
|
|
1670
|
+
* supplied before that this read took from disk keeps its bytes). */
|
|
1671
|
+
holdObservedEntries(entries, supplied) {
|
|
1672
|
+
for (const entry of entries) {
|
|
1673
|
+
const fromHost = supplied.has(entry.path);
|
|
1674
|
+
if (this.hostSuppliedKeys.has(entry.path) && !fromHost) continue;
|
|
1675
|
+
this.fileCache.set(entry.path, {
|
|
1676
|
+
hash: entry.hash,
|
|
1677
|
+
source: entry.source
|
|
1678
|
+
});
|
|
1679
|
+
if (fromHost) this.hostSuppliedKeys.add(entry.path);
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1610
1682
|
/** Held sources whose bytes the host supplied and which the disk no
|
|
1611
1683
|
* longer matches: a full read not carrying them (`carried`) would
|
|
1612
1684
|
* publish the disk's bytes in their place. */
|
|
@@ -1638,9 +1710,9 @@ var ExtractionSession = class {
|
|
|
1638
1710
|
hash: entry.hash,
|
|
1639
1711
|
source: entry.source
|
|
1640
1712
|
}]));
|
|
1641
|
-
for (const path$
|
|
1642
|
-
const entry = raw(path$
|
|
1643
|
-
if (entry) held.set(path$
|
|
1713
|
+
for (const path$20 of result.skippedOriginals ?? []) {
|
|
1714
|
+
const entry = raw(path$20);
|
|
1715
|
+
if (entry) held.set(path$20, {
|
|
1644
1716
|
hash: entry.hash ?? require_pipeline.contentHash(entry.source),
|
|
1645
1717
|
source: entry.source
|
|
1646
1718
|
});
|
|
@@ -1653,9 +1725,13 @@ var ExtractionSession = class {
|
|
|
1653
1725
|
const previous = this.publication;
|
|
1654
1726
|
const publication = {
|
|
1655
1727
|
...staged,
|
|
1656
|
-
ownership: result.ownership
|
|
1728
|
+
ownership: result.ownership,
|
|
1729
|
+
externalPackageDirs: this.externalPackageDirs,
|
|
1730
|
+
externalSourceEntries: this.externalSourceEntries,
|
|
1731
|
+
externalSourceSideEffects: this.externalSourceSideEffects
|
|
1657
1732
|
};
|
|
1658
1733
|
this.publication = publication;
|
|
1734
|
+
setPublication(this.key, publication);
|
|
1659
1735
|
this.onOutcome?.({
|
|
1660
1736
|
kind: "published",
|
|
1661
1737
|
publication,
|
|
@@ -1713,18 +1789,18 @@ var ExtractionSession = class {
|
|
|
1713
1789
|
* paths it found absent, whose creation is a system change. */
|
|
1714
1790
|
recordSystemDependencies(systemPath, dependencies, missing) {
|
|
1715
1791
|
const keys = /* @__PURE__ */ new Set();
|
|
1716
|
-
for (const path$
|
|
1792
|
+
for (const path$21 of [
|
|
1717
1793
|
systemPath,
|
|
1718
1794
|
...dependencies,
|
|
1719
1795
|
...missing
|
|
1720
|
-
]) for (const key of require_pipeline.toWatchKeys(path$
|
|
1796
|
+
]) for (const key of require_pipeline.toWatchKeys(path$21)) keys.add(key);
|
|
1721
1797
|
const hashes = /* @__PURE__ */ new Map();
|
|
1722
1798
|
for (const dep of dependencies.length > 0 ? dependencies : [systemPath]) try {
|
|
1723
1799
|
hashes.set(dep, require_pipeline.contentHash((0, fs.readFileSync)(dep, "utf-8")));
|
|
1724
1800
|
} catch {
|
|
1725
1801
|
hashes.set(dep, "");
|
|
1726
1802
|
}
|
|
1727
|
-
for (const path$
|
|
1803
|
+
for (const path$22 of missing) hashes.set(path$22, "");
|
|
1728
1804
|
this.systemDependencyKeys = keys;
|
|
1729
1805
|
this.systemDependencyPaths = dependencies;
|
|
1730
1806
|
this.systemMissingPaths = missing;
|
|
@@ -1735,8 +1811,8 @@ var ExtractionSession = class {
|
|
|
1735
1811
|
* re-reads its aliases. */
|
|
1736
1812
|
readConfigInputs(rootDir) {
|
|
1737
1813
|
this.configInputPaths = [(0, path.join)(rootDir, "package.json"), ...require_pipeline.tsconfigChainPaths(rootDir)];
|
|
1738
|
-
this.configInputKeys = new Set(this.configInputPaths.flatMap((path$
|
|
1739
|
-
this.configInputHashes = new Map(this.configInputPaths.map((path$
|
|
1814
|
+
this.configInputKeys = new Set(this.configInputPaths.flatMap((path$23) => require_pipeline.toWatchKeys(path$23)));
|
|
1815
|
+
this.configInputHashes = new Map(this.configInputPaths.map((path$24) => [path$24, fileHashOrEmpty(path$24)]));
|
|
1740
1816
|
if (this.aliasesFromTsconfig) this.pathAliasesJson = require_pipeline.buildPathAliasesJson(require_pipeline.readTsconfigAliasPairs(rootDir), rootDir)?.json ?? null;
|
|
1741
1817
|
}
|
|
1742
1818
|
/** What hosts watch for assets, and what the last-good generation
|
|
@@ -1810,24 +1886,32 @@ var ExtractionSession = class {
|
|
|
1810
1886
|
this.assetDependencyKeys.clear();
|
|
1811
1887
|
this.recordSystemDependencies(resolvedSystemPath, this.system.dependencies ?? [], this.system.missing ?? []);
|
|
1812
1888
|
bt.systemLoad = this.elapsed(t);
|
|
1889
|
+
this.systemLoadMs = bt.systemLoad;
|
|
1813
1890
|
t = this.now();
|
|
1814
1891
|
const { excludeMatcher, extensionsSet } = this.scanConfig;
|
|
1815
1892
|
const files = require_pipeline.discoverFiles(rootDir, rootDir, excludeMatcher, extensionsSet);
|
|
1893
|
+
const systemPackageRoot = require_pipeline.findPackageRoot(resolvedSystemPath);
|
|
1894
|
+
const discovered = new Set(files);
|
|
1895
|
+
const outsideRoot = files.length === 0 ? [] : [resolvedSystemPath, ...this.systemDependencyPaths];
|
|
1896
|
+
for (const dependency of outsideRoot) if (!discovered.has(dependency) && !require_pipeline.isPathWithinRoot(rootDir, dependency) && !dependency.split(path.sep).includes("node_modules") && extensionsSet.has((0, path.extname)(dependency)) && require_pipeline.findPackageRoot(dependency) === systemPackageRoot) {
|
|
1897
|
+
discovered.add(dependency);
|
|
1898
|
+
files.push(dependency);
|
|
1899
|
+
}
|
|
1816
1900
|
if (claimUnmatchedExcludeReport(this.key)) for (const line of require_pipeline.unmatchedExcludeLines(excludeMatcher)) this.logger.error(line);
|
|
1817
1901
|
bt.fileDiscovery = this.elapsed(t);
|
|
1818
1902
|
t = this.now();
|
|
1819
1903
|
const rawEntries = [];
|
|
1820
1904
|
const ingestionFailures = [];
|
|
1821
1905
|
const readPaths = /* @__PURE__ */ new Set();
|
|
1906
|
+
const supplied = /* @__PURE__ */ new Set();
|
|
1822
1907
|
for (const filePath of files) {
|
|
1823
1908
|
const relPath = (0, path.relative)(rootDir, filePath);
|
|
1824
1909
|
readPaths.add(filePath);
|
|
1825
1910
|
let source;
|
|
1826
1911
|
try {
|
|
1827
|
-
const
|
|
1828
|
-
source =
|
|
1829
|
-
if (
|
|
1830
|
-
else this.hostSuppliedKeys.add(relPath);
|
|
1912
|
+
const hostSource = hostSources.get(filePath);
|
|
1913
|
+
source = hostSource ?? (0, fs.readFileSync)(filePath, "utf-8");
|
|
1914
|
+
if (hostSource !== void 0) supplied.add(relPath);
|
|
1831
1915
|
} catch (err) {
|
|
1832
1916
|
if (!require_pipeline.isDeletedSource(err)) ingestionFailures.push(require_pipeline.unreadableSourceDiagnostic(relPath, err));
|
|
1833
1917
|
continue;
|
|
@@ -1848,7 +1932,6 @@ var ExtractionSession = class {
|
|
|
1848
1932
|
extensions: context.extensions
|
|
1849
1933
|
});
|
|
1850
1934
|
const discoveryDiagnostics = [];
|
|
1851
|
-
const systemPackageRoot = require_pipeline.findPackageRoot(resolvedSystemPath);
|
|
1852
1935
|
const kitMembers = /* @__PURE__ */ new Map();
|
|
1853
1936
|
const packageNames = await require_pipeline.extractSystemFilePackages(resolvedSystemPath, { systemMembership: this.engine().systemMembership ?? requireEngine().systemMembership }, (diagnostic) => discoveryDiagnostics.push(diagnostic), (specifier, importer) => require_pipeline.findPackageRoot(importer) === systemPackageRoot ? resolver.resolveSpecifier(specifier) : resolver.loaderResolve(specifier, (0, path.dirname)(importer)), context.extensions, kitMembers);
|
|
1854
1937
|
discoveryDiagnostics.push(...require_pipeline.importedKitDiagnostics(rawEntries, this.engine(), rootDir, packageNames, (entries) => this.corpus.facts(entries)));
|
|
@@ -1957,7 +2040,9 @@ var ExtractionSession = class {
|
|
|
1957
2040
|
for (const entry of admitted.entries) {
|
|
1958
2041
|
const entryPath = (0, path.resolve)(rootDir, entry.path);
|
|
1959
2042
|
readPaths.add(entryPath);
|
|
1960
|
-
const
|
|
2043
|
+
const hostSource = hostSources.get(entryPath);
|
|
2044
|
+
if (hostSource !== void 0) supplied.add(entry.path);
|
|
2045
|
+
const source = hostSource ?? entry.source;
|
|
1961
2046
|
rawEntries.push({
|
|
1962
2047
|
path: entry.path,
|
|
1963
2048
|
source,
|
|
@@ -1968,17 +2053,19 @@ var ExtractionSession = class {
|
|
|
1968
2053
|
this.externalLinkedDirs = admitted.linkedDirs;
|
|
1969
2054
|
this.externalOutputDirs = admitted.outputDirs;
|
|
1970
2055
|
bt.packageResolve = this.elapsed(t);
|
|
1971
|
-
const misspelled = misspelledHostSources(hostSources, readPaths).map(({ path: path$
|
|
2056
|
+
const misspelled = misspelledHostSources(hostSources, readPaths).map(({ path: path$25, read }) => `${(0, path.relative)(rootDir, path$25)} (read as ${read.map((readPath) => (0, path.relative)(rootDir, readPath)).join(", ")})`);
|
|
1972
2057
|
if (misspelled.length > 0) throw new DeferredReloadRefusal(`[${this.driverLabel}] reload not published: the host supplied bytes for ${misspelled.join(", ")}, which the full read reaches only under another spelling; the last generation stays served`);
|
|
1973
2058
|
this.beginStatusAttempt();
|
|
1974
2059
|
let accepted;
|
|
2060
|
+
const readEntries = this.withoutOutputSources(rawEntries);
|
|
1975
2061
|
try {
|
|
1976
|
-
accepted = await this.corpus.prepare(
|
|
2062
|
+
accepted = await this.corpus.prepare(readEntries);
|
|
1977
2063
|
this.throwOnAbortedParse(accepted);
|
|
1978
2064
|
this.skippedSources = accepted.skippedOriginals ?? [];
|
|
1979
2065
|
this.ingestionOpenings = accepted.openings ?? [];
|
|
1980
2066
|
this.ingestionAdapted = require_pipeline.adaptedOriginals(accepted.ownership);
|
|
1981
2067
|
} catch (err) {
|
|
2068
|
+
if (err instanceof AbortedParseRejection) this.holdObservedEntries(readEntries, supplied);
|
|
1982
2069
|
this.debouncePending.clear();
|
|
1983
2070
|
this.writeAnalysisStatus("failed", pending, String(err));
|
|
1984
2071
|
throw err;
|
|
@@ -1987,10 +2074,8 @@ var ExtractionSession = class {
|
|
|
1987
2074
|
bt.fileCount = accepted.analysisEntries.length;
|
|
1988
2075
|
require_pipeline.clearEngineCache(() => this.engine());
|
|
1989
2076
|
await this.analyzeAndEmit(accepted.analysisEntries, packageMap, false, bt, pipelineStart, pending);
|
|
1990
|
-
this.publishSourceIngestion(accepted, "full", (path$
|
|
1991
|
-
|
|
1992
|
-
setSharedExternalEntries(this.key, admitted.sourceEntries);
|
|
1993
|
-
setSharedExternalSideEffects(this.key, admitted.sourceEntrySideEffects);
|
|
2077
|
+
this.publishSourceIngestion(accepted, "full", (path$26) => rawEntries.find((entry) => entry.path === path$26));
|
|
2078
|
+
this.hostSuppliedKeys = supplied;
|
|
1994
2079
|
this.onExternalRootsCommitted?.(this.externalWatchRoots);
|
|
1995
2080
|
setOwningWatchSession(this.key, this);
|
|
1996
2081
|
} catch (err) {
|
|
@@ -2072,7 +2157,7 @@ var ExtractionSession = class {
|
|
|
2072
2157
|
if (own.identity === authority.identity) return;
|
|
2073
2158
|
const shared = new Set(authority.dependencies);
|
|
2074
2159
|
const mine = new Set(own.dependencies);
|
|
2075
|
-
const differing = [...authority.dependencies.filter((path$
|
|
2160
|
+
const differing = [...authority.dependencies.filter((path$27) => !mine.has(path$27)), ...own.dependencies.filter((path$28) => !shared.has(path$28))].map((path$29) => (0, path.relative)(this.rootDir, path$29));
|
|
2076
2161
|
throw new SessionConfigurationConflict(this.key, authority.label, this.resolutionContextLabel(), differing.length > 0 ? [`system modules ${differing.join(", ")}`] : ["the evaluated system"], "Every participant of one build must evaluate the same system: give each compiler conditions that select the same system modules.");
|
|
2077
2162
|
}
|
|
2078
2163
|
/** Release this session's publication claim so a successor may publish,
|
|
@@ -2081,6 +2166,7 @@ var ExtractionSession = class {
|
|
|
2081
2166
|
close() {
|
|
2082
2167
|
this.releasePublicationClaim?.();
|
|
2083
2168
|
this.releasePublicationClaim = null;
|
|
2169
|
+
this.hostSuppliedKeys.clear();
|
|
2084
2170
|
if (this.joinedKey === null || this.participant === null) return;
|
|
2085
2171
|
if (getOwningWatchSession(this.joinedKey) === this) setOwningWatchSession(this.joinedKey, null);
|
|
2086
2172
|
leaveSession(this.joinedKey, this.participant);
|
|
@@ -2128,14 +2214,14 @@ var ExtractionSession = class {
|
|
|
2128
2214
|
pendingFromBatch(changes) {
|
|
2129
2215
|
const { excludeMatcher, extensionsSet } = this.scanConfig;
|
|
2130
2216
|
const pending = [];
|
|
2131
|
-
for (const path$
|
|
2132
|
-
const classified = this.classifyWatchPath(path$
|
|
2217
|
+
for (const path$30 of changes.modifiedFiles ?? []) {
|
|
2218
|
+
const classified = this.classifyWatchPath(path$30, {
|
|
2133
2219
|
excludeMatcher,
|
|
2134
2220
|
extensionsSet
|
|
2135
2221
|
});
|
|
2136
2222
|
if (!classified) continue;
|
|
2137
2223
|
try {
|
|
2138
|
-
pending.push([classified.key, require_pipeline.contentHash(changes.sources?.get(path$
|
|
2224
|
+
pending.push([classified.key, require_pipeline.contentHash(changes.sources?.get(path$30) ?? (0, fs.readFileSync)(path$30, "utf-8"))]);
|
|
2139
2225
|
} catch {}
|
|
2140
2226
|
}
|
|
2141
2227
|
return pending;
|
|
@@ -2151,24 +2237,24 @@ var ExtractionSession = class {
|
|
|
2151
2237
|
const dirtyRoots = /* @__PURE__ */ new Set();
|
|
2152
2238
|
const modified = /* @__PURE__ */ new Set();
|
|
2153
2239
|
const removed = /* @__PURE__ */ new Set();
|
|
2154
|
-
const rootHitFor = (path$
|
|
2155
|
-
const containing = identity.containingExternalRoot(path$
|
|
2240
|
+
const rootHitFor = (path$31) => {
|
|
2241
|
+
const containing = identity.containingExternalRoot(path$31);
|
|
2156
2242
|
if (!containing) return null;
|
|
2157
2243
|
try {
|
|
2158
|
-
return (0, fs.statSync)(path$
|
|
2244
|
+
return (0, fs.statSync)(path$31).isDirectory() ? containing : null;
|
|
2159
2245
|
} catch {
|
|
2160
|
-
return identity.resolveDeletedSourceId(path$
|
|
2246
|
+
return identity.resolveDeletedSourceId(path$31) ? null : containing;
|
|
2161
2247
|
}
|
|
2162
2248
|
};
|
|
2163
|
-
for (const path$
|
|
2164
|
-
const root = rootHitFor(path$
|
|
2249
|
+
for (const path$32 of changes.modifiedFiles ?? []) {
|
|
2250
|
+
const root = rootHitFor(path$32);
|
|
2165
2251
|
if (root) dirtyRoots.add(root);
|
|
2166
|
-
else modified.add(path$
|
|
2252
|
+
else modified.add(path$32);
|
|
2167
2253
|
}
|
|
2168
|
-
for (const path$
|
|
2169
|
-
const root = rootHitFor(path$
|
|
2254
|
+
for (const path$33 of changes.removedFiles ?? []) {
|
|
2255
|
+
const root = rootHitFor(path$33);
|
|
2170
2256
|
if (root) dirtyRoots.add(root);
|
|
2171
|
-
else removed.add(path$
|
|
2257
|
+
else removed.add(path$33);
|
|
2172
2258
|
}
|
|
2173
2259
|
for (const root of dirtyRoots) {
|
|
2174
2260
|
const previous = this.externalInventory.get(root) ?? /* @__PURE__ */ new Map();
|
|
@@ -2260,8 +2346,8 @@ var ExtractionSession = class {
|
|
|
2260
2346
|
system,
|
|
2261
2347
|
emitter: {
|
|
2262
2348
|
runtimeImport: this.runtimeImport,
|
|
2263
|
-
cssModuleId: this.cssModuleId,
|
|
2264
|
-
systemPropsModuleId: this.systemPropsModuleId
|
|
2349
|
+
cssModuleId: this.delivery.cssModuleId,
|
|
2350
|
+
systemPropsModuleId: this.delivery.systemPropsModuleId === SESSION_ARTIFACT ? systemPropsPath(this.sessionDir) : this.delivery.systemPropsModuleId
|
|
2265
2351
|
},
|
|
2266
2352
|
pathAliasesJson: this.pathAliasesJson,
|
|
2267
2353
|
staticCssJson: this.staticCssJson,
|
|
@@ -2278,7 +2364,13 @@ var ExtractionSession = class {
|
|
|
2278
2364
|
packageDirs: this.externalPackageDirs.map((dir) => (0, path.relative)(this.rootDir, dir)),
|
|
2279
2365
|
linkedDirs: this.externalLinkedDirs.map((dir) => (0, path.relative)(this.rootDir, dir)),
|
|
2280
2366
|
outputDirs: this.externalOutputDirs.map((dir) => (0, path.relative)(this.rootDir, dir)),
|
|
2281
|
-
extensions: this.extensionPolicy
|
|
2367
|
+
extensions: this.extensionPolicy,
|
|
2368
|
+
configFiles: this.buildConfigFiles.map((file) => (0, path.relative)(this.rootDir, file).split(path.sep).join("/")),
|
|
2369
|
+
systemModules: [...new Set([(0, path.resolve)(this.rootDir, this.options.system), ...this.systemDependencyPaths].map((file) => (0, path.relative)(this.rootDir, file).split(path.sep).join("/")))],
|
|
2370
|
+
closedDynamicImports: (this.options.closedDynamicImports ?? []).map((site) => ({
|
|
2371
|
+
...site,
|
|
2372
|
+
importer: (0, path.relative)(this.rootDir, (0, path.resolve)(this.rootDir, site.importer)).split(path.sep).join("/")
|
|
2373
|
+
}))
|
|
2282
2374
|
}
|
|
2283
2375
|
};
|
|
2284
2376
|
this.writeAnalysisStatus("analyzing", pending);
|
|
@@ -2308,10 +2400,9 @@ var ExtractionSession = class {
|
|
|
2308
2400
|
bt.jsonParse = result.timings.parseMs;
|
|
2309
2401
|
const manifest = result.manifest;
|
|
2310
2402
|
this.lastComponentCount = Object.keys(manifest?.components ?? {}).length;
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
}
|
|
2403
|
+
const analysisMs = (bt.jsonSerialize ?? 0) + (bt.rustExtract ?? 0) + (bt.jsonParse ?? 0);
|
|
2404
|
+
if (!devMode) bt.analysis = analysisMs;
|
|
2405
|
+
if (manifest?.report && claimExtractionReport(this.key)) this.log(`Extracted ${manifest.report.components_extracted ?? "?"}/${manifest.report.components_total ?? "?"} components (${analysisMs}ms)`);
|
|
2315
2406
|
const sheets = this.substituteAssetReferences({
|
|
2316
2407
|
variableCss: system.variableCss,
|
|
2317
2408
|
globalCss: result.globalCss,
|
|
@@ -2345,7 +2436,6 @@ var ExtractionSession = class {
|
|
|
2345
2436
|
prefix: `[${this.driverLabel}]`,
|
|
2346
2437
|
surface: "generated runtime modules"
|
|
2347
2438
|
});
|
|
2348
|
-
setSharedCss(this.key, fullCss);
|
|
2349
2439
|
const systemPropsContent = require_pipeline.buildSystemPropsModule({
|
|
2350
2440
|
systemPropMapJson: JSON.stringify(manifest?.system_prop_map ?? {}),
|
|
2351
2441
|
groupRegistryJson: system.groupRegistryJson,
|
|
@@ -2353,20 +2443,6 @@ var ExtractionSession = class {
|
|
|
2353
2443
|
admittedTransforms: manifest?.admitted_transforms ?? {},
|
|
2354
2444
|
typedSystemProps: manifest?.typed_system_props ?? []
|
|
2355
2445
|
});
|
|
2356
|
-
setSharedSystemProps(this.key, systemPropsContent);
|
|
2357
|
-
setManifestJson(this.key, result.manifestJson);
|
|
2358
|
-
if (manifest) this.stagedPublication = {
|
|
2359
|
-
manifest,
|
|
2360
|
-
manifestJson: result.manifestJson,
|
|
2361
|
-
analysisGlobalCss: sheets.globalCss,
|
|
2362
|
-
analysisComponentCss: sheets.componentCss,
|
|
2363
|
-
styles: fullCss,
|
|
2364
|
-
systemPropsModule: systemPropsContent,
|
|
2365
|
-
system,
|
|
2366
|
-
packageMap
|
|
2367
|
-
};
|
|
2368
|
-
setAnalyzedHashes(this.key, new Map(fileEntries.map((entry) => [entry.path, entry.hash])));
|
|
2369
|
-
if (this.packageReadRecord !== null) setSharedPackageReadRecord(this.key, this.packageReadRecord);
|
|
2370
2446
|
this.writeAnalysisStatus("committing", pending);
|
|
2371
2447
|
const epoch = require_pipeline.hashReplacementPlans(require_pipeline.snapshotFilePlans(manifest), systemPropsContent);
|
|
2372
2448
|
if (this.lastCommit === null) this.lastCommit = this.seedCommitFromDisk();
|
|
@@ -2386,6 +2462,19 @@ var ExtractionSession = class {
|
|
|
2386
2462
|
} else this.writeSessionArtifact(SYSTEM_PROPS_ARTIFACT, systemPropsContent);
|
|
2387
2463
|
this.publishAnalysisCommit(epoch, generation);
|
|
2388
2464
|
this.publishReplacementEpoch(epoch);
|
|
2465
|
+
this.stagedPublication = {
|
|
2466
|
+
manifest,
|
|
2467
|
+
manifestJson: result.manifestJson,
|
|
2468
|
+
analysisGlobalCss: sheets.globalCss,
|
|
2469
|
+
analysisComponentCss: sheets.componentCss,
|
|
2470
|
+
styles: fullCss,
|
|
2471
|
+
systemPropsModule: systemPropsContent,
|
|
2472
|
+
system,
|
|
2473
|
+
packageMap,
|
|
2474
|
+
analyzedHashes: new Map(fileEntries.map((entry) => [entry.path, entry.hash])),
|
|
2475
|
+
packageReadRecord: this.packageReadRecord,
|
|
2476
|
+
replacementEpoch: epoch
|
|
2477
|
+
};
|
|
2389
2478
|
bt.total = this.elapsed(pipelineStart);
|
|
2390
2479
|
logBuildTimings(bt, manifest?.timing, (msg) => this.log(msg), this.verbose);
|
|
2391
2480
|
}
|
|
@@ -2446,12 +2535,12 @@ var ExtractionSession = class {
|
|
|
2446
2535
|
if (!require_pipeline.isEngineTransformExtension(file)) return false;
|
|
2447
2536
|
const { extractFacts } = this.engine();
|
|
2448
2537
|
if (extractFacts === void 0) return true;
|
|
2449
|
-
const path$
|
|
2538
|
+
const path$34 = (0, path.relative)(this.rootDir, file);
|
|
2450
2539
|
try {
|
|
2451
2540
|
const facts = require_pipeline.parseInternalWire(extractFacts(JSON.stringify([{
|
|
2452
|
-
path: path$
|
|
2541
|
+
path: path$34,
|
|
2453
2542
|
source: (0, fs.readFileSync)(file, "utf-8")
|
|
2454
|
-
}])), "extractFacts").files[path$
|
|
2543
|
+
}])), "extractFacts").files[path$34];
|
|
2455
2544
|
return facts === void 0 || facts.parsePanicked || facts.chains.length > 0;
|
|
2456
2545
|
} catch {
|
|
2457
2546
|
return true;
|
|
@@ -2590,7 +2679,6 @@ var ExtractionSession = class {
|
|
|
2590
2679
|
publishReplacementEpoch(epoch) {
|
|
2591
2680
|
if (!this.persistArtifacts) {
|
|
2592
2681
|
this.lastEpochValue = epoch;
|
|
2593
|
-
setReplacementEpoch(this.key, epoch);
|
|
2594
2682
|
return;
|
|
2595
2683
|
}
|
|
2596
2684
|
const onDisk = this.diskEpochValue();
|
|
@@ -2604,7 +2692,6 @@ var ExtractionSession = class {
|
|
|
2604
2692
|
this.lastEpochValue = epoch;
|
|
2605
2693
|
this.reconcileSiblingEpochs(epoch);
|
|
2606
2694
|
}
|
|
2607
|
-
setReplacementEpoch(this.key, epoch);
|
|
2608
2695
|
}
|
|
2609
2696
|
/** sessions-root listing memo, keyed by the root dir's mtime — a new or
|
|
2610
2697
|
* pruned sibling DIRECTORY moves it; agreeing siblings stay listed. */
|
|
@@ -2743,11 +2830,11 @@ var ExtractionSession = class {
|
|
|
2743
2830
|
assetFingerprints() {
|
|
2744
2831
|
const { fingerprintFile, fingerprintBytes } = this.engine();
|
|
2745
2832
|
if (fingerprintFile && fingerprintBytes) return {
|
|
2746
|
-
ofFile: (path$
|
|
2833
|
+
ofFile: (path$35) => fingerprintFile(path$35) ?? require_pipeline.contentHash((0, fs.readFileSync)(path$35)),
|
|
2747
2834
|
ofBytes: fingerprintBytes
|
|
2748
2835
|
};
|
|
2749
2836
|
return {
|
|
2750
|
-
ofFile: (path$
|
|
2837
|
+
ofFile: (path$36) => require_pipeline.contentHash((0, fs.readFileSync)(path$36)),
|
|
2751
2838
|
ofBytes: require_pipeline.contentHash
|
|
2752
2839
|
};
|
|
2753
2840
|
}
|
|
@@ -2797,9 +2884,9 @@ var ExtractionSession = class {
|
|
|
2797
2884
|
const message = `unresolvable asset() specifier: ${specifier}`;
|
|
2798
2885
|
this.strictOrWarn(message, `[${this.driverLabel}] ${message}`);
|
|
2799
2886
|
}
|
|
2800
|
-
trackAssetDependency(path$
|
|
2801
|
-
this.assetDependencyPaths.add(path$
|
|
2802
|
-
for (const key of require_pipeline.toWatchKeys(path$
|
|
2887
|
+
trackAssetDependency(path$37) {
|
|
2888
|
+
this.assetDependencyPaths.add(path$37);
|
|
2889
|
+
for (const key of require_pipeline.toWatchKeys(path$37)) this.assetDependencyKeys.add(key);
|
|
2803
2890
|
}
|
|
2804
2891
|
/** Resolve an asset specifier through the shared resolver, with one
|
|
2805
2892
|
* last resort: a discovered source entry's package root. */
|
|
@@ -2821,7 +2908,10 @@ var ExtractionSession = class {
|
|
|
2821
2908
|
//#endregion
|
|
2822
2909
|
//#region session/turbopack-orchestrator.ts
|
|
2823
2910
|
async function runSessionPipeline(session) {
|
|
2824
|
-
session.
|
|
2911
|
+
session.delivery = {
|
|
2912
|
+
...session.delivery,
|
|
2913
|
+
systemPropsModuleId: TURBOPACK_SYSTEM_PROPS_ID
|
|
2914
|
+
};
|
|
2825
2915
|
session.persistAnalysisInputs = true;
|
|
2826
2916
|
await session.runFullPipeline();
|
|
2827
2917
|
}
|
|
@@ -2987,16 +3077,14 @@ function startTurbopackWatcher(session, rootDir, options = {}) {
|
|
|
2987
3077
|
if (require_pipeline.isPathWithinRoot(rootDir, path$2) && !(0, path.relative)(rootDir, path$2).split(/[\\/]/).some((segment) => IGNORED_SEGMENTS.has(segment))) return true;
|
|
2988
3078
|
return [...externalWatchers.keys()].some((root) => require_pipeline.isPathWithinRoot(root, path$2));
|
|
2989
3079
|
};
|
|
2990
|
-
/** Watches the
|
|
2991
|
-
*
|
|
3080
|
+
/** Watches the Session's plan (its files, and the absent paths whose
|
|
3081
|
+
* creation reloads the system) where no root watcher reports them, by
|
|
3082
|
+
* their directories, for those paths only. */
|
|
2992
3083
|
const syncDependencyWatchers = () => {
|
|
2993
3084
|
if (closed) return;
|
|
2994
3085
|
const wanted = /* @__PURE__ */ new Map();
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
...session.assetDependencyPaths,
|
|
2998
|
-
...session.configInputPaths
|
|
2999
|
-
]) {
|
|
3086
|
+
const plan = session.watchPlan();
|
|
3087
|
+
for (const path$3 of [...plan.files, ...plan.missing]) {
|
|
3000
3088
|
if (watchedByRoot(path$3)) continue;
|
|
3001
3089
|
const files = wanted.get((0, path.dirname)(path$3)) ?? /* @__PURE__ */ new Set();
|
|
3002
3090
|
files.add(path$3);
|
|
@@ -3098,9 +3186,11 @@ exports.CLI_LOCK_HEARTBEAT_INTERVAL_MS = CLI_LOCK_HEARTBEAT_INTERVAL_MS;
|
|
|
3098
3186
|
exports.CLI_LOCK_STALE_AFTER_MS = CLI_LOCK_STALE_AFTER_MS;
|
|
3099
3187
|
exports.COALESCING_WINDOW_MS = COALESCING_WINDOW_MS;
|
|
3100
3188
|
exports.CoalescingWindow = CoalescingWindow;
|
|
3189
|
+
exports.EnvironmentBuilds = EnvironmentBuilds;
|
|
3101
3190
|
exports.EnvironmentFailure = EnvironmentFailure;
|
|
3102
3191
|
exports.ExtractionSession = ExtractionSession;
|
|
3103
3192
|
exports.MANIFEST_ARTIFACT = MANIFEST_ARTIFACT;
|
|
3193
|
+
exports.SESSION_ARTIFACT = SESSION_ARTIFACT;
|
|
3104
3194
|
exports.SESSION_ASSETS_DIR = SESSION_ASSETS_DIR;
|
|
3105
3195
|
exports.STYLES_ARTIFACT = STYLES_ARTIFACT;
|
|
3106
3196
|
exports.SYSTEM_PROPS_ARTIFACT = SYSTEM_PROPS_ARTIFACT;
|