@animus-ui/extract 0.1.26 → 0.1.27
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 +5 -0
- package/dist/pipeline/core-options.d.ts.map +1 -1
- package/dist/pipeline/engine-adapter.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-BzMQ_Z0M.mjs → pipeline-C0AcBXuQ.mjs} +2979 -2842
- package/dist/{pipeline-DyUf-eKZ.cjs → pipeline-CPSPw522.cjs} +2978 -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 +49 -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 +27 -30
- package/dist/session/singleton.d.ts.map +1 -1
- package/dist/session/turbopack-orchestrator.d.ts.map +1 -1
- package/dist/session.cjs +218 -156
- package/dist/session.mjs +159 -99
- package/package.json +4 -4
package/dist/session.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as writeAssetCopy, $t as createExcludeMatcher, A as postProcessCss, At as declaredWorkspacePackages, Bn as __require, C as serializeStaticCss, Ct as nativePackageLocator, D as clearEngineCache, Dn as findSheetAssetSpecifiers, Et as staleDistIncludesMessage, Ft as readTsconfigAliasPairs, G as discoveryResolver, Gt as discoverFiles, I as createSourceCorpus, It as tsconfigChainPaths, J as packageInstanceFinding, K as AliasAgreementCache, Ln as assembleStylesheet, Lt as BUILT_IN_EXTENSION_POLICY, M as buildPathAliasesJson, N as enforceExternalTokenContracts, Nn as contentHash, O as runProjectAnalysis, On as generatedModuleCode, Ot as unresolvableIncludesMessage, P as resolveAssetFile, Pn as parseInternalWire, Q as pruneStaleAssets, Sn as surfaceManifestDiagnostics, St as nativeKitSourceRoot, T as stableStringify, Y as packageReadRecord, Z as assertRuntimeImportSuppliesTerminals, _ as buildSystemPropsModule, _t as importedKitDiagnostics, an as unmatchedExcludeLines, b as loadSystemConfig, cn as sharesVolumeRoot, ct as adaptedOriginals, d as toWatchKeys, dn as isEngineTransformExtension, f as diffFilePlans, ft as excludeCollectedPackages, gn as SYSTEM_INSTANCE_MISMATCH, gt as firstOwners, ht as findPackageRoot, in as resolveVerbosity, j as resolveLightningTargets, jn as substituteSheetAssets, kn as reportSurvivingAssetPlaceholders, kt as walkPackageSources, ln as DEFAULT_EXTENSIONS, lt as bareSpecifierPackageName, m as snapshotFilePlans, nn as outputSourceMessage, nt as createV2EngineApi, on as createSourceIdentity, ot as projectExternalFileOwners, p as hashReplacementPlans, pt as extractSystemFilePackages, q as compareAliases, rn as resolveMode, s as builtInAssetClassification, sn as isPathWithinRoot, tn as outputSourceGuard, ut as collectExternalPackageSources, vt as isExcludedPackageRelativePath, wn as unreadableSourceDiagnostic, x as systemLoadReads, xn as severityFor, yn as isDeletedSource, yt as isPackageSpecifier, zt as extensionPolicyJson } from "./pipeline-C0AcBXuQ.mjs";
|
|
2
2
|
import { randomUUID } from "crypto";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, watch, writeFileSync } from "fs";
|
|
4
4
|
import { basename, dirname, extname, isAbsolute, join, posix, relative, resolve, sep } from "path";
|
|
@@ -50,6 +50,50 @@ var CoalescingWindow = class {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
//#endregion
|
|
53
|
+
//#region session/environment-builds.ts
|
|
54
|
+
/**
|
|
55
|
+
* Each environment build that started and has not ended, by name. A host
|
|
56
|
+
* that builds a shared plugin's environments in parallel (a Vite `buildApp`)
|
|
57
|
+
* shares one build among them, retired by the last to end. A build under a
|
|
58
|
+
* name whose build is open (a reused builder, or a second environment under
|
|
59
|
+
* one name) waits for that build's end, so each build ends only its own
|
|
60
|
+
* generation, once.
|
|
61
|
+
*/
|
|
62
|
+
var EnvironmentBuilds = class {
|
|
63
|
+
/** What a host without environments builds as. */
|
|
64
|
+
single = { name: "build" };
|
|
65
|
+
builds = /* @__PURE__ */ new Map();
|
|
66
|
+
/** Opens `environment`'s build once no build under its name is open;
|
|
67
|
+
* whether another environment's build is open beside it. */
|
|
68
|
+
async open(environment) {
|
|
69
|
+
for (;;) {
|
|
70
|
+
const open = this.builds.get(environment.name);
|
|
71
|
+
if (open === void 0) break;
|
|
72
|
+
await open.ended;
|
|
73
|
+
}
|
|
74
|
+
let end = () => {};
|
|
75
|
+
const ended = new Promise((settle) => {
|
|
76
|
+
end = settle;
|
|
77
|
+
});
|
|
78
|
+
this.builds.set(environment.name, {
|
|
79
|
+
environment,
|
|
80
|
+
ended,
|
|
81
|
+
end
|
|
82
|
+
});
|
|
83
|
+
return this.builds.size > 1;
|
|
84
|
+
}
|
|
85
|
+
/** Ends `environment`'s build if this environment opened it; whether that
|
|
86
|
+
* left none open. A host can end an environment it never opened (a dev
|
|
87
|
+
* server ends every environment, started or not), which ends nothing. */
|
|
88
|
+
end(environment) {
|
|
89
|
+
const open = this.builds.get(environment.name);
|
|
90
|
+
if (open === void 0 || open.environment !== environment) return false;
|
|
91
|
+
this.builds.delete(environment.name);
|
|
92
|
+
open.end();
|
|
93
|
+
return this.builds.size === 0;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
//#endregion
|
|
53
97
|
//#region pipeline/system-instances.ts
|
|
54
98
|
/**
|
|
55
99
|
* The system and the analysis read one instance of each kit (spec §2.2
|
|
@@ -372,11 +416,15 @@ function joined(key) {
|
|
|
372
416
|
if (state === void 0) throw new Error(`[animus] no participant has joined build ${key.build} of ${key.root}`);
|
|
373
417
|
return state;
|
|
374
418
|
}
|
|
375
|
-
|
|
376
|
-
|
|
419
|
+
/** Commits the build's publication, the one write of everything below. */
|
|
420
|
+
function setPublication(key, publication) {
|
|
421
|
+
joined(key).publication = publication;
|
|
377
422
|
}
|
|
378
|
-
function
|
|
379
|
-
|
|
423
|
+
function publicationOf(key) {
|
|
424
|
+
return findSession(key)?.publication ?? null;
|
|
425
|
+
}
|
|
426
|
+
function getManifestJson(key) {
|
|
427
|
+
return publicationOf(key)?.manifestJson ?? null;
|
|
380
428
|
}
|
|
381
429
|
/**
|
|
382
430
|
* A latch over the most recently STARTED analysis, never cleared on settle:
|
|
@@ -401,36 +449,21 @@ function claimUnmatchedExcludeReport(key) {
|
|
|
401
449
|
return true;
|
|
402
450
|
}
|
|
403
451
|
function getSharedCss(key) {
|
|
404
|
-
return
|
|
405
|
-
}
|
|
406
|
-
function setSharedCss(key, css) {
|
|
407
|
-
joined(key).sharedCss = css;
|
|
452
|
+
return publicationOf(key)?.styles ?? "";
|
|
408
453
|
}
|
|
409
454
|
function getSharedSystemProps(key) {
|
|
410
|
-
return
|
|
411
|
-
}
|
|
412
|
-
function setSharedSystemProps(key, content) {
|
|
413
|
-
joined(key).sharedSystemProps = content;
|
|
455
|
+
return publicationOf(key)?.systemPropsModule ?? "";
|
|
414
456
|
}
|
|
415
457
|
function getSharedExternalDirs(key) {
|
|
416
|
-
return
|
|
417
|
-
}
|
|
418
|
-
function setSharedExternalDirs(key, dirs) {
|
|
419
|
-
joined(key).externalDirs = dirs;
|
|
458
|
+
return publicationOf(key)?.externalPackageDirs ?? [];
|
|
420
459
|
}
|
|
421
460
|
function getSharedExternalEntries(key) {
|
|
422
|
-
return
|
|
423
|
-
}
|
|
424
|
-
function setSharedExternalEntries(key, entries) {
|
|
425
|
-
joined(key).externalEntries = entries;
|
|
461
|
+
return publicationOf(key)?.externalSourceEntries ?? /* @__PURE__ */ new Map();
|
|
426
462
|
}
|
|
427
463
|
/** Specifier → its source entry's side effects, published with the shared
|
|
428
464
|
* entries; absent leaves the bundler's own classification. */
|
|
429
465
|
function getSharedExternalSideEffects(key) {
|
|
430
|
-
return
|
|
431
|
-
}
|
|
432
|
-
function setSharedExternalSideEffects(key, sideEffects) {
|
|
433
|
-
joined(key).externalSideEffects = sideEffects;
|
|
466
|
+
return publicationOf(key)?.externalSourceSideEffects ?? /* @__PURE__ */ new Map();
|
|
434
467
|
}
|
|
435
468
|
/**
|
|
436
469
|
* The only session of a build that can run watch analysis. A non-owning
|
|
@@ -448,18 +481,12 @@ function setOwningWatchSession(key, session) {
|
|
|
448
481
|
* the exact bytes analyzed), including files that produced zero entries.
|
|
449
482
|
*/
|
|
450
483
|
function getAnalyzedHashes(key) {
|
|
451
|
-
return
|
|
452
|
-
}
|
|
453
|
-
function setAnalyzedHashes(key, hashes) {
|
|
454
|
-
joined(key).analyzedHashes = hashes;
|
|
484
|
+
return publicationOf(key)?.analyzedHashes ?? null;
|
|
455
485
|
}
|
|
456
486
|
/** What the build's last published analysis read of the discovered
|
|
457
487
|
* packages (spec §2.2 A4); null before one publishes. */
|
|
458
488
|
function getSharedPackageReadRecord(key) {
|
|
459
|
-
return
|
|
460
|
-
}
|
|
461
|
-
function setSharedPackageReadRecord(key, record) {
|
|
462
|
-
joined(key).packageReadRecord = record;
|
|
489
|
+
return publicationOf(key)?.packageReadRecord ?? null;
|
|
463
490
|
}
|
|
464
491
|
/**
|
|
465
492
|
* One participant publishes a build's analysis, holding this claim until it
|
|
@@ -485,15 +512,10 @@ function getSessionArtifactDir(key) {
|
|
|
485
512
|
function setSessionArtifactDir(key, dir) {
|
|
486
513
|
joined(key).artifactDir = dir;
|
|
487
514
|
}
|
|
488
|
-
/**
|
|
489
|
-
*
|
|
490
|
-
* manifest so an epoch reader always sees at least that generation's manifest.
|
|
491
|
-
*/
|
|
515
|
+
/** Replacement epoch of the last published analysis: committed in the same
|
|
516
|
+
* record as its manifest, so an epoch reader sees that generation's. */
|
|
492
517
|
function getReplacementEpoch(key) {
|
|
493
|
-
return
|
|
494
|
-
}
|
|
495
|
-
function setReplacementEpoch(key, epoch) {
|
|
496
|
-
joined(key).replacementEpoch = epoch;
|
|
518
|
+
return publicationOf(key)?.replacementEpoch ?? null;
|
|
497
519
|
}
|
|
498
520
|
/**
|
|
499
521
|
* The build's one in-flight watch-analysis transaction: a participant that
|
|
@@ -671,6 +693,7 @@ const OPTION_CLASSES = {
|
|
|
671
693
|
layers: digestOf("layers"),
|
|
672
694
|
engine: digestOf("engine"),
|
|
673
695
|
mode: digestOf("mode"),
|
|
696
|
+
runtimeImport: digestOf("runtimeImport"),
|
|
674
697
|
root: "excluded"
|
|
675
698
|
};
|
|
676
699
|
/** The options a build's analysis depends on, each as stable text; each is
|
|
@@ -723,15 +746,7 @@ function joinSession(key, participant, options) {
|
|
|
723
746
|
},
|
|
724
747
|
systemAuthority: null,
|
|
725
748
|
claimRecord: null,
|
|
726
|
-
|
|
727
|
-
sharedCss: "",
|
|
728
|
-
sharedSystemProps: "",
|
|
729
|
-
externalDirs: [],
|
|
730
|
-
externalEntries: /* @__PURE__ */ new Map(),
|
|
731
|
-
externalSideEffects: /* @__PURE__ */ new Map(),
|
|
732
|
-
analyzedHashes: null,
|
|
733
|
-
packageReadRecord: null,
|
|
734
|
-
replacementEpoch: null,
|
|
749
|
+
publication: null,
|
|
735
750
|
artifactDir: null,
|
|
736
751
|
unmatchedExcludesReported: false
|
|
737
752
|
};
|
|
@@ -886,6 +901,9 @@ function misspelledHostSources(hostSources, readPaths) {
|
|
|
886
901
|
function isDiskNumber(value) {
|
|
887
902
|
return Object(value) !== value && Object.prototype.toString.call(value) === "[object Number]";
|
|
888
903
|
}
|
|
904
|
+
/** The session's own system-props file, imported by absolute path: what a
|
|
905
|
+
* host that serves no system-props module (the CLI) delivers. */
|
|
906
|
+
const SESSION_ARTIFACT = Symbol("animus.session-artifact");
|
|
889
907
|
/** A file's content hash, or '' when it cannot be read. */
|
|
890
908
|
function fileHashOrEmpty(path) {
|
|
891
909
|
try {
|
|
@@ -905,9 +923,6 @@ var ExtractionSession = class {
|
|
|
905
923
|
host;
|
|
906
924
|
/** Set by the adapter before any pipeline run. */
|
|
907
925
|
rootDir = null;
|
|
908
|
-
/** The module extracted terminals import their factories from; an
|
|
909
|
-
* override must supply every terminal the analysis extracts. */
|
|
910
|
-
runtimeImport = DEFAULT_RUNTIME_IMPORT;
|
|
911
926
|
/** A host that resolves imports itself (Vite's `this.resolve`): package
|
|
912
927
|
* discovery asks it first, the loader only for a declared workspace it
|
|
913
928
|
* cannot resolve. Null resolves through the loader alone. */
|
|
@@ -941,12 +956,12 @@ var ExtractionSession = class {
|
|
|
941
956
|
/** Physical asset files registered with the host watcher. */
|
|
942
957
|
assetDependencyPaths = /* @__PURE__ */ new Set();
|
|
943
958
|
assetDependencyKeys = /* @__PURE__ */ new Set();
|
|
944
|
-
/**
|
|
945
|
-
*
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
959
|
+
/** What generated code imports; a host that serves its own modules
|
|
960
|
+
* declares them before planning. */
|
|
961
|
+
delivery = {
|
|
962
|
+
cssModuleId: ANIMUS_CSS_MODULE_ID,
|
|
963
|
+
systemPropsModuleId: SESSION_ARTIFACT
|
|
964
|
+
};
|
|
950
965
|
/** Whether the analysis-inputs hydration corpus is written to disk. Only
|
|
951
966
|
* isolated loader workers replay it; an in-process loader reads memory. */
|
|
952
967
|
persistAnalysisInputs = false;
|
|
@@ -1018,8 +1033,8 @@ var ExtractionSession = class {
|
|
|
1018
1033
|
get heldSources() {
|
|
1019
1034
|
return this.fileCache;
|
|
1020
1035
|
}
|
|
1021
|
-
/** The generation an emit produced,
|
|
1022
|
-
*
|
|
1036
|
+
/** The generation an emit produced, until it commits with the
|
|
1037
|
+
* ingestion's ownership and the external package state it analysed. */
|
|
1023
1038
|
stagedPublication = null;
|
|
1024
1039
|
options;
|
|
1025
1040
|
staticCssJson;
|
|
@@ -1061,6 +1076,27 @@ var ExtractionSession = class {
|
|
|
1061
1076
|
};
|
|
1062
1077
|
}
|
|
1063
1078
|
systemDependencyKeys = /* @__PURE__ */ new Set();
|
|
1079
|
+
/** What a host watches for this Session, one list for every host: the
|
|
1080
|
+
* files whose change it acts on (the system module and the modules it
|
|
1081
|
+
* read, asset() sources, the configuration inputs), the paths the system
|
|
1082
|
+
* load found absent, whose creation reloads it, and the external package
|
|
1083
|
+
* roots, watched recursively. An absent path inside `covered` (roots the
|
|
1084
|
+
* host already watches recursively) is left out: a host's recursive
|
|
1085
|
+
* watch reports its creation, and watching an absent file inside a
|
|
1086
|
+
* watched directory can stop that directory's events (inotify). */
|
|
1087
|
+
watchPlan(covered = []) {
|
|
1088
|
+
const system = this.rootDir === null ? [] : [resolve(this.rootDir, this.options.system)];
|
|
1089
|
+
return {
|
|
1090
|
+
files: [.../* @__PURE__ */ new Set([
|
|
1091
|
+
...system,
|
|
1092
|
+
...this.systemDependencyPaths,
|
|
1093
|
+
...this.assetDependencyPaths,
|
|
1094
|
+
...this.configInputPaths
|
|
1095
|
+
])],
|
|
1096
|
+
missing: this.systemMissingPaths.filter((path) => !covered.some((root) => isPathWithinRoot(root, path))),
|
|
1097
|
+
directories: [...this.externalWatchRoots]
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1064
1100
|
/** Whether `path` is the system module, one of its dependencies, or a
|
|
1065
1101
|
* path its load found absent: a change to it reloads the system. */
|
|
1066
1102
|
isSystemDependency(path) {
|
|
@@ -1152,6 +1188,10 @@ var ExtractionSession = class {
|
|
|
1152
1188
|
this.ingestionFailureDiagnostics = this.ingestionFailureDiagnostics.filter((diagnostic) => diagnostic.file !== relPath);
|
|
1153
1189
|
return this.ingestionFailureDiagnostics.length !== before;
|
|
1154
1190
|
}
|
|
1191
|
+
/** The module extracted terminals import their factories from. */
|
|
1192
|
+
get runtimeImport() {
|
|
1193
|
+
return this.options.runtimeImport ?? "@animus-ui/system/runtime";
|
|
1194
|
+
}
|
|
1155
1195
|
get sessionDir() {
|
|
1156
1196
|
return sessionArtifactDir(this.rootDir, this.sessionId);
|
|
1157
1197
|
}
|
|
@@ -1429,6 +1469,7 @@ var ExtractionSession = class {
|
|
|
1429
1469
|
const { excludeMatcher, extensionsSet } = this.scanConfig;
|
|
1430
1470
|
const priorCacheEntries = /* @__PURE__ */ new Map();
|
|
1431
1471
|
const priorExternalFileOwners = { ...this.externalFileOwners };
|
|
1472
|
+
const priorHostSuppliedKeys = new Set(this.hostSuppliedKeys);
|
|
1432
1473
|
const recordPrior = (key) => {
|
|
1433
1474
|
if (!priorCacheEntries.has(key)) priorCacheEntries.set(key, this.fileCache.get(key) ?? null);
|
|
1434
1475
|
};
|
|
@@ -1578,6 +1619,7 @@ var ExtractionSession = class {
|
|
|
1578
1619
|
else this.fileCache.set(key, prior);
|
|
1579
1620
|
}
|
|
1580
1621
|
this.externalFileOwners = priorExternalFileOwners;
|
|
1622
|
+
this.hostSuppliedKeys = priorHostSuppliedKeys;
|
|
1581
1623
|
}
|
|
1582
1624
|
if (this.statusAttemptOpen) {
|
|
1583
1625
|
this.debouncePending.clear();
|
|
@@ -1606,6 +1648,20 @@ var ExtractionSession = class {
|
|
|
1606
1648
|
});
|
|
1607
1649
|
throw new AbortedParseRejection(rejection.message);
|
|
1608
1650
|
}
|
|
1651
|
+
/** Holds a held full read's entries: what it read stays the held bytes,
|
|
1652
|
+
* never overwriting held host bytes with the disk's (a key the host
|
|
1653
|
+
* supplied before that this read took from disk keeps its bytes). */
|
|
1654
|
+
holdObservedEntries(entries, supplied) {
|
|
1655
|
+
for (const entry of entries) {
|
|
1656
|
+
const fromHost = supplied.has(entry.path);
|
|
1657
|
+
if (this.hostSuppliedKeys.has(entry.path) && !fromHost) continue;
|
|
1658
|
+
this.fileCache.set(entry.path, {
|
|
1659
|
+
hash: entry.hash,
|
|
1660
|
+
source: entry.source
|
|
1661
|
+
});
|
|
1662
|
+
if (fromHost) this.hostSuppliedKeys.add(entry.path);
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1609
1665
|
/** Held sources whose bytes the host supplied and which the disk no
|
|
1610
1666
|
* longer matches: a full read not carrying them (`carried`) would
|
|
1611
1667
|
* publish the disk's bytes in their place. */
|
|
@@ -1652,9 +1708,13 @@ var ExtractionSession = class {
|
|
|
1652
1708
|
const previous = this.publication;
|
|
1653
1709
|
const publication = {
|
|
1654
1710
|
...staged,
|
|
1655
|
-
ownership: result.ownership
|
|
1711
|
+
ownership: result.ownership,
|
|
1712
|
+
externalPackageDirs: this.externalPackageDirs,
|
|
1713
|
+
externalSourceEntries: this.externalSourceEntries,
|
|
1714
|
+
externalSourceSideEffects: this.externalSourceSideEffects
|
|
1656
1715
|
};
|
|
1657
1716
|
this.publication = publication;
|
|
1717
|
+
setPublication(this.key, publication);
|
|
1658
1718
|
this.onOutcome?.({
|
|
1659
1719
|
kind: "published",
|
|
1660
1720
|
publication,
|
|
@@ -1818,15 +1878,15 @@ var ExtractionSession = class {
|
|
|
1818
1878
|
const rawEntries = [];
|
|
1819
1879
|
const ingestionFailures = [];
|
|
1820
1880
|
const readPaths = /* @__PURE__ */ new Set();
|
|
1881
|
+
const supplied = /* @__PURE__ */ new Set();
|
|
1821
1882
|
for (const filePath of files) {
|
|
1822
1883
|
const relPath = relative(rootDir, filePath);
|
|
1823
1884
|
readPaths.add(filePath);
|
|
1824
1885
|
let source;
|
|
1825
1886
|
try {
|
|
1826
|
-
const
|
|
1827
|
-
source =
|
|
1828
|
-
if (
|
|
1829
|
-
else this.hostSuppliedKeys.add(relPath);
|
|
1887
|
+
const hostSource = hostSources.get(filePath);
|
|
1888
|
+
source = hostSource ?? readFileSync(filePath, "utf-8");
|
|
1889
|
+
if (hostSource !== void 0) supplied.add(relPath);
|
|
1830
1890
|
} catch (err) {
|
|
1831
1891
|
if (!isDeletedSource(err)) ingestionFailures.push(unreadableSourceDiagnostic(relPath, err));
|
|
1832
1892
|
continue;
|
|
@@ -1956,7 +2016,9 @@ var ExtractionSession = class {
|
|
|
1956
2016
|
for (const entry of admitted.entries) {
|
|
1957
2017
|
const entryPath = resolve(rootDir, entry.path);
|
|
1958
2018
|
readPaths.add(entryPath);
|
|
1959
|
-
const
|
|
2019
|
+
const hostSource = hostSources.get(entryPath);
|
|
2020
|
+
if (hostSource !== void 0) supplied.add(entry.path);
|
|
2021
|
+
const source = hostSource ?? entry.source;
|
|
1960
2022
|
rawEntries.push({
|
|
1961
2023
|
path: entry.path,
|
|
1962
2024
|
source,
|
|
@@ -1971,13 +2033,15 @@ var ExtractionSession = class {
|
|
|
1971
2033
|
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`);
|
|
1972
2034
|
this.beginStatusAttempt();
|
|
1973
2035
|
let accepted;
|
|
2036
|
+
const readEntries = this.withoutOutputSources(rawEntries);
|
|
1974
2037
|
try {
|
|
1975
|
-
accepted = await this.corpus.prepare(
|
|
2038
|
+
accepted = await this.corpus.prepare(readEntries);
|
|
1976
2039
|
this.throwOnAbortedParse(accepted);
|
|
1977
2040
|
this.skippedSources = accepted.skippedOriginals ?? [];
|
|
1978
2041
|
this.ingestionOpenings = accepted.openings ?? [];
|
|
1979
2042
|
this.ingestionAdapted = adaptedOriginals(accepted.ownership);
|
|
1980
2043
|
} catch (err) {
|
|
2044
|
+
if (err instanceof AbortedParseRejection) this.holdObservedEntries(readEntries, supplied);
|
|
1981
2045
|
this.debouncePending.clear();
|
|
1982
2046
|
this.writeAnalysisStatus("failed", pending, String(err));
|
|
1983
2047
|
throw err;
|
|
@@ -1987,9 +2051,7 @@ var ExtractionSession = class {
|
|
|
1987
2051
|
clearEngineCache(() => this.engine());
|
|
1988
2052
|
await this.analyzeAndEmit(accepted.analysisEntries, packageMap, false, bt, pipelineStart, pending);
|
|
1989
2053
|
this.publishSourceIngestion(accepted, "full", (path) => rawEntries.find((entry) => entry.path === path));
|
|
1990
|
-
|
|
1991
|
-
setSharedExternalEntries(this.key, admitted.sourceEntries);
|
|
1992
|
-
setSharedExternalSideEffects(this.key, admitted.sourceEntrySideEffects);
|
|
2054
|
+
this.hostSuppliedKeys = supplied;
|
|
1993
2055
|
this.onExternalRootsCommitted?.(this.externalWatchRoots);
|
|
1994
2056
|
setOwningWatchSession(this.key, this);
|
|
1995
2057
|
} catch (err) {
|
|
@@ -2080,6 +2142,7 @@ var ExtractionSession = class {
|
|
|
2080
2142
|
close() {
|
|
2081
2143
|
this.releasePublicationClaim?.();
|
|
2082
2144
|
this.releasePublicationClaim = null;
|
|
2145
|
+
this.hostSuppliedKeys.clear();
|
|
2083
2146
|
if (this.joinedKey === null || this.participant === null) return;
|
|
2084
2147
|
if (getOwningWatchSession(this.joinedKey) === this) setOwningWatchSession(this.joinedKey, null);
|
|
2085
2148
|
leaveSession(this.joinedKey, this.participant);
|
|
@@ -2259,8 +2322,8 @@ var ExtractionSession = class {
|
|
|
2259
2322
|
system,
|
|
2260
2323
|
emitter: {
|
|
2261
2324
|
runtimeImport: this.runtimeImport,
|
|
2262
|
-
cssModuleId: this.cssModuleId,
|
|
2263
|
-
systemPropsModuleId: this.systemPropsModuleId
|
|
2325
|
+
cssModuleId: this.delivery.cssModuleId,
|
|
2326
|
+
systemPropsModuleId: this.delivery.systemPropsModuleId === SESSION_ARTIFACT ? systemPropsPath(this.sessionDir) : this.delivery.systemPropsModuleId
|
|
2264
2327
|
},
|
|
2265
2328
|
pathAliasesJson: this.pathAliasesJson,
|
|
2266
2329
|
staticCssJson: this.staticCssJson,
|
|
@@ -2344,7 +2407,6 @@ var ExtractionSession = class {
|
|
|
2344
2407
|
prefix: `[${this.driverLabel}]`,
|
|
2345
2408
|
surface: "generated runtime modules"
|
|
2346
2409
|
});
|
|
2347
|
-
setSharedCss(this.key, fullCss);
|
|
2348
2410
|
const systemPropsContent = buildSystemPropsModule({
|
|
2349
2411
|
systemPropMapJson: JSON.stringify(manifest?.system_prop_map ?? {}),
|
|
2350
2412
|
groupRegistryJson: system.groupRegistryJson,
|
|
@@ -2352,20 +2414,6 @@ var ExtractionSession = class {
|
|
|
2352
2414
|
admittedTransforms: manifest?.admitted_transforms ?? {},
|
|
2353
2415
|
typedSystemProps: manifest?.typed_system_props ?? []
|
|
2354
2416
|
});
|
|
2355
|
-
setSharedSystemProps(this.key, systemPropsContent);
|
|
2356
|
-
setManifestJson(this.key, result.manifestJson);
|
|
2357
|
-
if (manifest) this.stagedPublication = {
|
|
2358
|
-
manifest,
|
|
2359
|
-
manifestJson: result.manifestJson,
|
|
2360
|
-
analysisGlobalCss: sheets.globalCss,
|
|
2361
|
-
analysisComponentCss: sheets.componentCss,
|
|
2362
|
-
styles: fullCss,
|
|
2363
|
-
systemPropsModule: systemPropsContent,
|
|
2364
|
-
system,
|
|
2365
|
-
packageMap
|
|
2366
|
-
};
|
|
2367
|
-
setAnalyzedHashes(this.key, new Map(fileEntries.map((entry) => [entry.path, entry.hash])));
|
|
2368
|
-
if (this.packageReadRecord !== null) setSharedPackageReadRecord(this.key, this.packageReadRecord);
|
|
2369
2417
|
this.writeAnalysisStatus("committing", pending);
|
|
2370
2418
|
const epoch = hashReplacementPlans(snapshotFilePlans(manifest), systemPropsContent);
|
|
2371
2419
|
if (this.lastCommit === null) this.lastCommit = this.seedCommitFromDisk();
|
|
@@ -2385,6 +2433,19 @@ var ExtractionSession = class {
|
|
|
2385
2433
|
} else this.writeSessionArtifact(SYSTEM_PROPS_ARTIFACT, systemPropsContent);
|
|
2386
2434
|
this.publishAnalysisCommit(epoch, generation);
|
|
2387
2435
|
this.publishReplacementEpoch(epoch);
|
|
2436
|
+
this.stagedPublication = {
|
|
2437
|
+
manifest,
|
|
2438
|
+
manifestJson: result.manifestJson,
|
|
2439
|
+
analysisGlobalCss: sheets.globalCss,
|
|
2440
|
+
analysisComponentCss: sheets.componentCss,
|
|
2441
|
+
styles: fullCss,
|
|
2442
|
+
systemPropsModule: systemPropsContent,
|
|
2443
|
+
system,
|
|
2444
|
+
packageMap,
|
|
2445
|
+
analyzedHashes: new Map(fileEntries.map((entry) => [entry.path, entry.hash])),
|
|
2446
|
+
packageReadRecord: this.packageReadRecord,
|
|
2447
|
+
replacementEpoch: epoch
|
|
2448
|
+
};
|
|
2388
2449
|
bt.total = this.elapsed(pipelineStart);
|
|
2389
2450
|
logBuildTimings(bt, manifest?.timing, (msg) => this.log(msg), this.verbose);
|
|
2390
2451
|
}
|
|
@@ -2589,7 +2650,6 @@ var ExtractionSession = class {
|
|
|
2589
2650
|
publishReplacementEpoch(epoch) {
|
|
2590
2651
|
if (!this.persistArtifacts) {
|
|
2591
2652
|
this.lastEpochValue = epoch;
|
|
2592
|
-
setReplacementEpoch(this.key, epoch);
|
|
2593
2653
|
return;
|
|
2594
2654
|
}
|
|
2595
2655
|
const onDisk = this.diskEpochValue();
|
|
@@ -2603,7 +2663,6 @@ var ExtractionSession = class {
|
|
|
2603
2663
|
this.lastEpochValue = epoch;
|
|
2604
2664
|
this.reconcileSiblingEpochs(epoch);
|
|
2605
2665
|
}
|
|
2606
|
-
setReplacementEpoch(this.key, epoch);
|
|
2607
2666
|
}
|
|
2608
2667
|
/** sessions-root listing memo, keyed by the root dir's mtime — a new or
|
|
2609
2668
|
* pruned sibling DIRECTORY moves it; agreeing siblings stay listed. */
|
|
@@ -2820,7 +2879,10 @@ var ExtractionSession = class {
|
|
|
2820
2879
|
//#endregion
|
|
2821
2880
|
//#region session/turbopack-orchestrator.ts
|
|
2822
2881
|
async function runSessionPipeline(session) {
|
|
2823
|
-
session.
|
|
2882
|
+
session.delivery = {
|
|
2883
|
+
...session.delivery,
|
|
2884
|
+
systemPropsModuleId: TURBOPACK_SYSTEM_PROPS_ID
|
|
2885
|
+
};
|
|
2824
2886
|
session.persistAnalysisInputs = true;
|
|
2825
2887
|
await session.runFullPipeline();
|
|
2826
2888
|
}
|
|
@@ -2986,16 +3048,14 @@ function startTurbopackWatcher(session, rootDir, options = {}) {
|
|
|
2986
3048
|
if (isPathWithinRoot(rootDir, path) && !relative(rootDir, path).split(/[\\/]/).some((segment) => IGNORED_SEGMENTS.has(segment))) return true;
|
|
2987
3049
|
return [...externalWatchers.keys()].some((root) => isPathWithinRoot(root, path));
|
|
2988
3050
|
};
|
|
2989
|
-
/** Watches the
|
|
2990
|
-
*
|
|
3051
|
+
/** Watches the Session's plan (its files, and the absent paths whose
|
|
3052
|
+
* creation reloads the system) where no root watcher reports them, by
|
|
3053
|
+
* their directories, for those paths only. */
|
|
2991
3054
|
const syncDependencyWatchers = () => {
|
|
2992
3055
|
if (closed) return;
|
|
2993
3056
|
const wanted = /* @__PURE__ */ new Map();
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
...session.assetDependencyPaths,
|
|
2997
|
-
...session.configInputPaths
|
|
2998
|
-
]) {
|
|
3057
|
+
const plan = session.watchPlan();
|
|
3058
|
+
for (const path of [...plan.files, ...plan.missing]) {
|
|
2999
3059
|
if (watchedByRoot(path)) continue;
|
|
3000
3060
|
const files = wanted.get(dirname(path)) ?? /* @__PURE__ */ new Set();
|
|
3001
3061
|
files.add(path);
|
|
@@ -3089,4 +3149,4 @@ function startTurbopackWatcher(session, rootDir, options = {}) {
|
|
|
3089
3149
|
};
|
|
3090
3150
|
}
|
|
3091
3151
|
//#endregion
|
|
3092
|
-
export { ANIMUS_ARTIFACT_DIR, ANIMUS_CSS_MODULE_ID, CLI_COMMIT_ARTIFACT, CLI_LOCK_ARTIFACT, CLI_LOCK_HEARTBEAT_INTERVAL_MS, CLI_LOCK_STALE_AFTER_MS, COALESCING_WINDOW_MS, CoalescingWindow, EnvironmentFailure, ExtractionSession, MANIFEST_ARTIFACT, SESSION_ASSETS_DIR, STYLES_ARTIFACT, SYSTEM_PROPS_ARTIFACT, SessionConfigurationConflict, TURBOPACK_SYSTEM_PROPS_ID, analysisCommitPath, analysisInputsPath, analysisStatusPath, checkLockLiveness, collectSessionAssets, createBuildId, decodeCommitRecord, engineApi, engineFactory, engineHandle, findSession, getAnalysisStartedPromise, getAnalyzedHashes, getManifestJson, getReplacementEpoch, getSessionArtifactDir, getSharedCss, getSharedExternalDirs, getSharedExternalEntries, getSharedExternalSideEffects, getSharedSystemProps, holdDirectoryClaim, isLockHolderAlive, joinSession, lockRecordBytes, manifestPath, pruneStaleAssets, readCliLockRecord, readJsonEnvelope, releaseEngineHandle, replacementEpochPath, requireEngine, resetAnalysisStartedPromise, runSessionPipeline, sessionArtifactDir, sessionKey, setAnalysisStartedPromise, startTurbopackWatcher, stylesPath, systemPropsPath, verifyCommitRecord };
|
|
3152
|
+
export { ANIMUS_ARTIFACT_DIR, ANIMUS_CSS_MODULE_ID, CLI_COMMIT_ARTIFACT, CLI_LOCK_ARTIFACT, CLI_LOCK_HEARTBEAT_INTERVAL_MS, CLI_LOCK_STALE_AFTER_MS, COALESCING_WINDOW_MS, CoalescingWindow, EnvironmentBuilds, EnvironmentFailure, ExtractionSession, MANIFEST_ARTIFACT, SESSION_ARTIFACT, SESSION_ASSETS_DIR, STYLES_ARTIFACT, SYSTEM_PROPS_ARTIFACT, SessionConfigurationConflict, TURBOPACK_SYSTEM_PROPS_ID, analysisCommitPath, analysisInputsPath, analysisStatusPath, checkLockLiveness, collectSessionAssets, createBuildId, decodeCommitRecord, engineApi, engineFactory, engineHandle, findSession, getAnalysisStartedPromise, getAnalyzedHashes, getManifestJson, getReplacementEpoch, getSessionArtifactDir, getSharedCss, getSharedExternalDirs, getSharedExternalEntries, getSharedExternalSideEffects, getSharedSystemProps, holdDirectoryClaim, isLockHolderAlive, joinSession, lockRecordBytes, manifestPath, pruneStaleAssets, readCliLockRecord, readJsonEnvelope, releaseEngineHandle, replacementEpochPath, requireEngine, resetAnalysisStartedPromise, runSessionPipeline, sessionArtifactDir, sessionKey, setAnalysisStartedPromise, startTurbopackWatcher, stylesPath, systemPropsPath, verifyCommitRecord };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animus-ui/extract",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"description": "Animus static CSS extraction pipeline (Rust/NAPI)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"animus",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"build:v2:debug": "cd crates/extract-v2 && bunx napi build --platform --no-js"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@animus-ui/properties": "0.1.
|
|
58
|
+
"@animus-ui/properties": "0.1.27",
|
|
59
59
|
"browserslist": "^4.28.8",
|
|
60
60
|
"lightningcss": "^1.33.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@animus-ui/assertions": "0.1.
|
|
64
|
-
"@animus-ui/system": "0.1.
|
|
63
|
+
"@animus-ui/assertions": "0.1.27",
|
|
64
|
+
"@animus-ui/system": "0.1.27",
|
|
65
65
|
"@mdx-js/mdx": "3.1.1",
|
|
66
66
|
"@napi-rs/cli": "^3.10.5",
|
|
67
67
|
"svelte": "5.57.0"
|