@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.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-DAcqiv0D.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:
|
|
@@ -400,37 +448,30 @@ function claimUnmatchedExcludeReport(key) {
|
|
|
400
448
|
state.unmatchedExcludesReported = true;
|
|
401
449
|
return true;
|
|
402
450
|
}
|
|
403
|
-
|
|
404
|
-
|
|
451
|
+
/** True for the build's first caller only: the one that reports what the
|
|
452
|
+
* build extracted. */
|
|
453
|
+
function claimExtractionReport(key) {
|
|
454
|
+
const state = joined(key);
|
|
455
|
+
if (state.extractionReported) return false;
|
|
456
|
+
state.extractionReported = true;
|
|
457
|
+
return true;
|
|
405
458
|
}
|
|
406
|
-
function
|
|
407
|
-
|
|
459
|
+
function getSharedCss(key) {
|
|
460
|
+
return publicationOf(key)?.styles ?? "";
|
|
408
461
|
}
|
|
409
462
|
function getSharedSystemProps(key) {
|
|
410
|
-
return
|
|
411
|
-
}
|
|
412
|
-
function setSharedSystemProps(key, content) {
|
|
413
|
-
joined(key).sharedSystemProps = content;
|
|
463
|
+
return publicationOf(key)?.systemPropsModule ?? "";
|
|
414
464
|
}
|
|
415
465
|
function getSharedExternalDirs(key) {
|
|
416
|
-
return
|
|
417
|
-
}
|
|
418
|
-
function setSharedExternalDirs(key, dirs) {
|
|
419
|
-
joined(key).externalDirs = dirs;
|
|
466
|
+
return publicationOf(key)?.externalPackageDirs ?? [];
|
|
420
467
|
}
|
|
421
468
|
function getSharedExternalEntries(key) {
|
|
422
|
-
return
|
|
423
|
-
}
|
|
424
|
-
function setSharedExternalEntries(key, entries) {
|
|
425
|
-
joined(key).externalEntries = entries;
|
|
469
|
+
return publicationOf(key)?.externalSourceEntries ?? /* @__PURE__ */ new Map();
|
|
426
470
|
}
|
|
427
471
|
/** Specifier → its source entry's side effects, published with the shared
|
|
428
472
|
* entries; absent leaves the bundler's own classification. */
|
|
429
473
|
function getSharedExternalSideEffects(key) {
|
|
430
|
-
return
|
|
431
|
-
}
|
|
432
|
-
function setSharedExternalSideEffects(key, sideEffects) {
|
|
433
|
-
joined(key).externalSideEffects = sideEffects;
|
|
474
|
+
return publicationOf(key)?.externalSourceSideEffects ?? /* @__PURE__ */ new Map();
|
|
434
475
|
}
|
|
435
476
|
/**
|
|
436
477
|
* The only session of a build that can run watch analysis. A non-owning
|
|
@@ -448,18 +489,12 @@ function setOwningWatchSession(key, session) {
|
|
|
448
489
|
* the exact bytes analyzed), including files that produced zero entries.
|
|
449
490
|
*/
|
|
450
491
|
function getAnalyzedHashes(key) {
|
|
451
|
-
return
|
|
452
|
-
}
|
|
453
|
-
function setAnalyzedHashes(key, hashes) {
|
|
454
|
-
joined(key).analyzedHashes = hashes;
|
|
492
|
+
return publicationOf(key)?.analyzedHashes ?? null;
|
|
455
493
|
}
|
|
456
494
|
/** What the build's last published analysis read of the discovered
|
|
457
495
|
* packages (spec §2.2 A4); null before one publishes. */
|
|
458
496
|
function getSharedPackageReadRecord(key) {
|
|
459
|
-
return
|
|
460
|
-
}
|
|
461
|
-
function setSharedPackageReadRecord(key, record) {
|
|
462
|
-
joined(key).packageReadRecord = record;
|
|
497
|
+
return publicationOf(key)?.packageReadRecord ?? null;
|
|
463
498
|
}
|
|
464
499
|
/**
|
|
465
500
|
* One participant publishes a build's analysis, holding this claim until it
|
|
@@ -485,15 +520,10 @@ function getSessionArtifactDir(key) {
|
|
|
485
520
|
function setSessionArtifactDir(key, dir) {
|
|
486
521
|
joined(key).artifactDir = dir;
|
|
487
522
|
}
|
|
488
|
-
/**
|
|
489
|
-
*
|
|
490
|
-
* manifest so an epoch reader always sees at least that generation's manifest.
|
|
491
|
-
*/
|
|
523
|
+
/** Replacement epoch of the last published analysis: committed in the same
|
|
524
|
+
* record as its manifest, so an epoch reader sees that generation's. */
|
|
492
525
|
function getReplacementEpoch(key) {
|
|
493
|
-
return
|
|
494
|
-
}
|
|
495
|
-
function setReplacementEpoch(key, epoch) {
|
|
496
|
-
joined(key).replacementEpoch = epoch;
|
|
526
|
+
return publicationOf(key)?.replacementEpoch ?? null;
|
|
497
527
|
}
|
|
498
528
|
/**
|
|
499
529
|
* The build's one in-flight watch-analysis transaction: a participant that
|
|
@@ -671,6 +701,8 @@ const OPTION_CLASSES = {
|
|
|
671
701
|
layers: digestOf("layers"),
|
|
672
702
|
engine: digestOf("engine"),
|
|
673
703
|
mode: digestOf("mode"),
|
|
704
|
+
runtimeImport: digestOf("runtimeImport"),
|
|
705
|
+
closedDynamicImports: digestOf("closedDynamicImports"),
|
|
674
706
|
root: "excluded"
|
|
675
707
|
};
|
|
676
708
|
/** The options a build's analysis depends on, each as stable text; each is
|
|
@@ -723,17 +755,10 @@ function joinSession(key, participant, options) {
|
|
|
723
755
|
},
|
|
724
756
|
systemAuthority: null,
|
|
725
757
|
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,
|
|
758
|
+
publication: null,
|
|
735
759
|
artifactDir: null,
|
|
736
|
-
unmatchedExcludesReported: false
|
|
760
|
+
unmatchedExcludesReported: false,
|
|
761
|
+
extractionReported: false
|
|
737
762
|
};
|
|
738
763
|
sessions.set(id, state);
|
|
739
764
|
return state;
|
|
@@ -886,6 +911,9 @@ function misspelledHostSources(hostSources, readPaths) {
|
|
|
886
911
|
function isDiskNumber(value) {
|
|
887
912
|
return Object(value) !== value && Object.prototype.toString.call(value) === "[object Number]";
|
|
888
913
|
}
|
|
914
|
+
/** The session's own system-props file, imported by absolute path: what a
|
|
915
|
+
* host that serves no system-props module (the CLI) delivers. */
|
|
916
|
+
const SESSION_ARTIFACT = Symbol("animus.session-artifact");
|
|
889
917
|
/** A file's content hash, or '' when it cannot be read. */
|
|
890
918
|
function fileHashOrEmpty(path) {
|
|
891
919
|
try {
|
|
@@ -905,9 +933,6 @@ var ExtractionSession = class {
|
|
|
905
933
|
host;
|
|
906
934
|
/** Set by the adapter before any pipeline run. */
|
|
907
935
|
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
936
|
/** A host that resolves imports itself (Vite's `this.resolve`): package
|
|
912
937
|
* discovery asks it first, the loader only for a declared workspace it
|
|
913
938
|
* cannot resolve. Null resolves through the loader alone. */
|
|
@@ -941,12 +966,12 @@ var ExtractionSession = class {
|
|
|
941
966
|
/** Physical asset files registered with the host watcher. */
|
|
942
967
|
assetDependencyPaths = /* @__PURE__ */ new Set();
|
|
943
968
|
assetDependencyKeys = /* @__PURE__ */ new Set();
|
|
944
|
-
/**
|
|
945
|
-
*
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
969
|
+
/** What generated code imports; a host that serves its own modules
|
|
970
|
+
* declares them before planning. */
|
|
971
|
+
delivery = {
|
|
972
|
+
cssModuleId: ANIMUS_CSS_MODULE_ID,
|
|
973
|
+
systemPropsModuleId: SESSION_ARTIFACT
|
|
974
|
+
};
|
|
950
975
|
/** Whether the analysis-inputs hydration corpus is written to disk. Only
|
|
951
976
|
* isolated loader workers replay it; an in-process loader reads memory. */
|
|
952
977
|
persistAnalysisInputs = false;
|
|
@@ -1018,8 +1043,8 @@ var ExtractionSession = class {
|
|
|
1018
1043
|
get heldSources() {
|
|
1019
1044
|
return this.fileCache;
|
|
1020
1045
|
}
|
|
1021
|
-
/** The generation an emit produced,
|
|
1022
|
-
*
|
|
1046
|
+
/** The generation an emit produced, until it commits with the
|
|
1047
|
+
* ingestion's ownership and the external package state it analysed. */
|
|
1023
1048
|
stagedPublication = null;
|
|
1024
1049
|
options;
|
|
1025
1050
|
staticCssJson;
|
|
@@ -1061,6 +1086,27 @@ var ExtractionSession = class {
|
|
|
1061
1086
|
};
|
|
1062
1087
|
}
|
|
1063
1088
|
systemDependencyKeys = /* @__PURE__ */ new Set();
|
|
1089
|
+
/** What a host watches for this Session, one list for every host: the
|
|
1090
|
+
* files whose change it acts on (the system module and the modules it
|
|
1091
|
+
* read, asset() sources, the configuration inputs), the paths the system
|
|
1092
|
+
* load found absent, whose creation reloads it, and the external package
|
|
1093
|
+
* roots, watched recursively. An absent path inside `covered` (roots the
|
|
1094
|
+
* host already watches recursively) is left out: a host's recursive
|
|
1095
|
+
* watch reports its creation, and watching an absent file inside a
|
|
1096
|
+
* watched directory can stop that directory's events (inotify). */
|
|
1097
|
+
watchPlan(covered = []) {
|
|
1098
|
+
const system = this.rootDir === null ? [] : [resolve(this.rootDir, this.options.system)];
|
|
1099
|
+
return {
|
|
1100
|
+
files: [.../* @__PURE__ */ new Set([
|
|
1101
|
+
...system,
|
|
1102
|
+
...this.systemDependencyPaths,
|
|
1103
|
+
...this.assetDependencyPaths,
|
|
1104
|
+
...this.configInputPaths
|
|
1105
|
+
])],
|
|
1106
|
+
missing: this.systemMissingPaths.filter((path) => !covered.some((root) => isPathWithinRoot(root, path))),
|
|
1107
|
+
directories: [...this.externalWatchRoots]
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1064
1110
|
/** Whether `path` is the system module, one of its dependencies, or a
|
|
1065
1111
|
* path its load found absent: a change to it reloads the system. */
|
|
1066
1112
|
isSystemDependency(path) {
|
|
@@ -1152,6 +1198,10 @@ var ExtractionSession = class {
|
|
|
1152
1198
|
this.ingestionFailureDiagnostics = this.ingestionFailureDiagnostics.filter((diagnostic) => diagnostic.file !== relPath);
|
|
1153
1199
|
return this.ingestionFailureDiagnostics.length !== before;
|
|
1154
1200
|
}
|
|
1201
|
+
/** The module extracted terminals import their factories from. */
|
|
1202
|
+
get runtimeImport() {
|
|
1203
|
+
return this.options.runtimeImport ?? "@animus-ui/system/runtime";
|
|
1204
|
+
}
|
|
1155
1205
|
get sessionDir() {
|
|
1156
1206
|
return sessionArtifactDir(this.rootDir, this.sessionId);
|
|
1157
1207
|
}
|
|
@@ -1232,6 +1282,12 @@ var ExtractionSession = class {
|
|
|
1232
1282
|
* excluded as literal path prefixes from discovery and from package
|
|
1233
1283
|
* collection, whatever the user's list. */
|
|
1234
1284
|
structuralExclude = [];
|
|
1285
|
+
/** The build configuration files the host loaded, absolute: config
|
|
1286
|
+
* roots, beside the well-known tool config names, whose unanalysed
|
|
1287
|
+
* imports open nothing the app renders. */
|
|
1288
|
+
buildConfigFiles = [];
|
|
1289
|
+
/** How long the last full pass took to load the system, in ms. */
|
|
1290
|
+
systemLoadMs = 0;
|
|
1235
1291
|
scanConfigMemo = null;
|
|
1236
1292
|
/** Resolve the scan configuration from options — the single source of the
|
|
1237
1293
|
* exclude/extension policy shared by the full and incremental pipelines,
|
|
@@ -1429,6 +1485,7 @@ var ExtractionSession = class {
|
|
|
1429
1485
|
const { excludeMatcher, extensionsSet } = this.scanConfig;
|
|
1430
1486
|
const priorCacheEntries = /* @__PURE__ */ new Map();
|
|
1431
1487
|
const priorExternalFileOwners = { ...this.externalFileOwners };
|
|
1488
|
+
const priorHostSuppliedKeys = new Set(this.hostSuppliedKeys);
|
|
1432
1489
|
const recordPrior = (key) => {
|
|
1433
1490
|
if (!priorCacheEntries.has(key)) priorCacheEntries.set(key, this.fileCache.get(key) ?? null);
|
|
1434
1491
|
};
|
|
@@ -1578,6 +1635,7 @@ var ExtractionSession = class {
|
|
|
1578
1635
|
else this.fileCache.set(key, prior);
|
|
1579
1636
|
}
|
|
1580
1637
|
this.externalFileOwners = priorExternalFileOwners;
|
|
1638
|
+
this.hostSuppliedKeys = priorHostSuppliedKeys;
|
|
1581
1639
|
}
|
|
1582
1640
|
if (this.statusAttemptOpen) {
|
|
1583
1641
|
this.debouncePending.clear();
|
|
@@ -1606,6 +1664,20 @@ var ExtractionSession = class {
|
|
|
1606
1664
|
});
|
|
1607
1665
|
throw new AbortedParseRejection(rejection.message);
|
|
1608
1666
|
}
|
|
1667
|
+
/** Holds a held full read's entries: what it read stays the held bytes,
|
|
1668
|
+
* never overwriting held host bytes with the disk's (a key the host
|
|
1669
|
+
* supplied before that this read took from disk keeps its bytes). */
|
|
1670
|
+
holdObservedEntries(entries, supplied) {
|
|
1671
|
+
for (const entry of entries) {
|
|
1672
|
+
const fromHost = supplied.has(entry.path);
|
|
1673
|
+
if (this.hostSuppliedKeys.has(entry.path) && !fromHost) continue;
|
|
1674
|
+
this.fileCache.set(entry.path, {
|
|
1675
|
+
hash: entry.hash,
|
|
1676
|
+
source: entry.source
|
|
1677
|
+
});
|
|
1678
|
+
if (fromHost) this.hostSuppliedKeys.add(entry.path);
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1609
1681
|
/** Held sources whose bytes the host supplied and which the disk no
|
|
1610
1682
|
* longer matches: a full read not carrying them (`carried`) would
|
|
1611
1683
|
* publish the disk's bytes in their place. */
|
|
@@ -1652,9 +1724,13 @@ var ExtractionSession = class {
|
|
|
1652
1724
|
const previous = this.publication;
|
|
1653
1725
|
const publication = {
|
|
1654
1726
|
...staged,
|
|
1655
|
-
ownership: result.ownership
|
|
1727
|
+
ownership: result.ownership,
|
|
1728
|
+
externalPackageDirs: this.externalPackageDirs,
|
|
1729
|
+
externalSourceEntries: this.externalSourceEntries,
|
|
1730
|
+
externalSourceSideEffects: this.externalSourceSideEffects
|
|
1656
1731
|
};
|
|
1657
1732
|
this.publication = publication;
|
|
1733
|
+
setPublication(this.key, publication);
|
|
1658
1734
|
this.onOutcome?.({
|
|
1659
1735
|
kind: "published",
|
|
1660
1736
|
publication,
|
|
@@ -1809,24 +1885,32 @@ var ExtractionSession = class {
|
|
|
1809
1885
|
this.assetDependencyKeys.clear();
|
|
1810
1886
|
this.recordSystemDependencies(resolvedSystemPath, this.system.dependencies ?? [], this.system.missing ?? []);
|
|
1811
1887
|
bt.systemLoad = this.elapsed(t);
|
|
1888
|
+
this.systemLoadMs = bt.systemLoad;
|
|
1812
1889
|
t = this.now();
|
|
1813
1890
|
const { excludeMatcher, extensionsSet } = this.scanConfig;
|
|
1814
1891
|
const files = discoverFiles(rootDir, rootDir, excludeMatcher, extensionsSet);
|
|
1892
|
+
const systemPackageRoot = findPackageRoot(resolvedSystemPath);
|
|
1893
|
+
const discovered = new Set(files);
|
|
1894
|
+
const outsideRoot = files.length === 0 ? [] : [resolvedSystemPath, ...this.systemDependencyPaths];
|
|
1895
|
+
for (const dependency of outsideRoot) if (!discovered.has(dependency) && !isPathWithinRoot(rootDir, dependency) && !dependency.split(sep).includes("node_modules") && extensionsSet.has(extname(dependency)) && findPackageRoot(dependency) === systemPackageRoot) {
|
|
1896
|
+
discovered.add(dependency);
|
|
1897
|
+
files.push(dependency);
|
|
1898
|
+
}
|
|
1815
1899
|
if (claimUnmatchedExcludeReport(this.key)) for (const line of unmatchedExcludeLines(excludeMatcher)) this.logger.error(line);
|
|
1816
1900
|
bt.fileDiscovery = this.elapsed(t);
|
|
1817
1901
|
t = this.now();
|
|
1818
1902
|
const rawEntries = [];
|
|
1819
1903
|
const ingestionFailures = [];
|
|
1820
1904
|
const readPaths = /* @__PURE__ */ new Set();
|
|
1905
|
+
const supplied = /* @__PURE__ */ new Set();
|
|
1821
1906
|
for (const filePath of files) {
|
|
1822
1907
|
const relPath = relative(rootDir, filePath);
|
|
1823
1908
|
readPaths.add(filePath);
|
|
1824
1909
|
let source;
|
|
1825
1910
|
try {
|
|
1826
|
-
const
|
|
1827
|
-
source =
|
|
1828
|
-
if (
|
|
1829
|
-
else this.hostSuppliedKeys.add(relPath);
|
|
1911
|
+
const hostSource = hostSources.get(filePath);
|
|
1912
|
+
source = hostSource ?? readFileSync(filePath, "utf-8");
|
|
1913
|
+
if (hostSource !== void 0) supplied.add(relPath);
|
|
1830
1914
|
} catch (err) {
|
|
1831
1915
|
if (!isDeletedSource(err)) ingestionFailures.push(unreadableSourceDiagnostic(relPath, err));
|
|
1832
1916
|
continue;
|
|
@@ -1847,7 +1931,6 @@ var ExtractionSession = class {
|
|
|
1847
1931
|
extensions: context.extensions
|
|
1848
1932
|
});
|
|
1849
1933
|
const discoveryDiagnostics = [];
|
|
1850
|
-
const systemPackageRoot = findPackageRoot(resolvedSystemPath);
|
|
1851
1934
|
const kitMembers = /* @__PURE__ */ new Map();
|
|
1852
1935
|
const packageNames = await extractSystemFilePackages(resolvedSystemPath, { systemMembership: this.engine().systemMembership ?? requireEngine().systemMembership }, (diagnostic) => discoveryDiagnostics.push(diagnostic), (specifier, importer) => findPackageRoot(importer) === systemPackageRoot ? resolver.resolveSpecifier(specifier) : resolver.loaderResolve(specifier, dirname(importer)), context.extensions, kitMembers);
|
|
1853
1936
|
discoveryDiagnostics.push(...importedKitDiagnostics(rawEntries, this.engine(), rootDir, packageNames, (entries) => this.corpus.facts(entries)));
|
|
@@ -1956,7 +2039,9 @@ var ExtractionSession = class {
|
|
|
1956
2039
|
for (const entry of admitted.entries) {
|
|
1957
2040
|
const entryPath = resolve(rootDir, entry.path);
|
|
1958
2041
|
readPaths.add(entryPath);
|
|
1959
|
-
const
|
|
2042
|
+
const hostSource = hostSources.get(entryPath);
|
|
2043
|
+
if (hostSource !== void 0) supplied.add(entry.path);
|
|
2044
|
+
const source = hostSource ?? entry.source;
|
|
1960
2045
|
rawEntries.push({
|
|
1961
2046
|
path: entry.path,
|
|
1962
2047
|
source,
|
|
@@ -1971,13 +2056,15 @@ var ExtractionSession = class {
|
|
|
1971
2056
|
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
2057
|
this.beginStatusAttempt();
|
|
1973
2058
|
let accepted;
|
|
2059
|
+
const readEntries = this.withoutOutputSources(rawEntries);
|
|
1974
2060
|
try {
|
|
1975
|
-
accepted = await this.corpus.prepare(
|
|
2061
|
+
accepted = await this.corpus.prepare(readEntries);
|
|
1976
2062
|
this.throwOnAbortedParse(accepted);
|
|
1977
2063
|
this.skippedSources = accepted.skippedOriginals ?? [];
|
|
1978
2064
|
this.ingestionOpenings = accepted.openings ?? [];
|
|
1979
2065
|
this.ingestionAdapted = adaptedOriginals(accepted.ownership);
|
|
1980
2066
|
} catch (err) {
|
|
2067
|
+
if (err instanceof AbortedParseRejection) this.holdObservedEntries(readEntries, supplied);
|
|
1981
2068
|
this.debouncePending.clear();
|
|
1982
2069
|
this.writeAnalysisStatus("failed", pending, String(err));
|
|
1983
2070
|
throw err;
|
|
@@ -1987,9 +2074,7 @@ var ExtractionSession = class {
|
|
|
1987
2074
|
clearEngineCache(() => this.engine());
|
|
1988
2075
|
await this.analyzeAndEmit(accepted.analysisEntries, packageMap, false, bt, pipelineStart, pending);
|
|
1989
2076
|
this.publishSourceIngestion(accepted, "full", (path) => rawEntries.find((entry) => entry.path === path));
|
|
1990
|
-
|
|
1991
|
-
setSharedExternalEntries(this.key, admitted.sourceEntries);
|
|
1992
|
-
setSharedExternalSideEffects(this.key, admitted.sourceEntrySideEffects);
|
|
2077
|
+
this.hostSuppliedKeys = supplied;
|
|
1993
2078
|
this.onExternalRootsCommitted?.(this.externalWatchRoots);
|
|
1994
2079
|
setOwningWatchSession(this.key, this);
|
|
1995
2080
|
} catch (err) {
|
|
@@ -2080,6 +2165,7 @@ var ExtractionSession = class {
|
|
|
2080
2165
|
close() {
|
|
2081
2166
|
this.releasePublicationClaim?.();
|
|
2082
2167
|
this.releasePublicationClaim = null;
|
|
2168
|
+
this.hostSuppliedKeys.clear();
|
|
2083
2169
|
if (this.joinedKey === null || this.participant === null) return;
|
|
2084
2170
|
if (getOwningWatchSession(this.joinedKey) === this) setOwningWatchSession(this.joinedKey, null);
|
|
2085
2171
|
leaveSession(this.joinedKey, this.participant);
|
|
@@ -2259,8 +2345,8 @@ var ExtractionSession = class {
|
|
|
2259
2345
|
system,
|
|
2260
2346
|
emitter: {
|
|
2261
2347
|
runtimeImport: this.runtimeImport,
|
|
2262
|
-
cssModuleId: this.cssModuleId,
|
|
2263
|
-
systemPropsModuleId: this.systemPropsModuleId
|
|
2348
|
+
cssModuleId: this.delivery.cssModuleId,
|
|
2349
|
+
systemPropsModuleId: this.delivery.systemPropsModuleId === SESSION_ARTIFACT ? systemPropsPath(this.sessionDir) : this.delivery.systemPropsModuleId
|
|
2264
2350
|
},
|
|
2265
2351
|
pathAliasesJson: this.pathAliasesJson,
|
|
2266
2352
|
staticCssJson: this.staticCssJson,
|
|
@@ -2277,7 +2363,13 @@ var ExtractionSession = class {
|
|
|
2277
2363
|
packageDirs: this.externalPackageDirs.map((dir) => relative(this.rootDir, dir)),
|
|
2278
2364
|
linkedDirs: this.externalLinkedDirs.map((dir) => relative(this.rootDir, dir)),
|
|
2279
2365
|
outputDirs: this.externalOutputDirs.map((dir) => relative(this.rootDir, dir)),
|
|
2280
|
-
extensions: this.extensionPolicy
|
|
2366
|
+
extensions: this.extensionPolicy,
|
|
2367
|
+
configFiles: this.buildConfigFiles.map((file) => relative(this.rootDir, file).split(sep).join("/")),
|
|
2368
|
+
systemModules: [...new Set([resolve(this.rootDir, this.options.system), ...this.systemDependencyPaths].map((file) => relative(this.rootDir, file).split(sep).join("/")))],
|
|
2369
|
+
closedDynamicImports: (this.options.closedDynamicImports ?? []).map((site) => ({
|
|
2370
|
+
...site,
|
|
2371
|
+
importer: relative(this.rootDir, resolve(this.rootDir, site.importer)).split(sep).join("/")
|
|
2372
|
+
}))
|
|
2281
2373
|
}
|
|
2282
2374
|
};
|
|
2283
2375
|
this.writeAnalysisStatus("analyzing", pending);
|
|
@@ -2307,10 +2399,9 @@ var ExtractionSession = class {
|
|
|
2307
2399
|
bt.jsonParse = result.timings.parseMs;
|
|
2308
2400
|
const manifest = result.manifest;
|
|
2309
2401
|
this.lastComponentCount = Object.keys(manifest?.components ?? {}).length;
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
}
|
|
2402
|
+
const analysisMs = (bt.jsonSerialize ?? 0) + (bt.rustExtract ?? 0) + (bt.jsonParse ?? 0);
|
|
2403
|
+
if (!devMode) bt.analysis = analysisMs;
|
|
2404
|
+
if (manifest?.report && claimExtractionReport(this.key)) this.log(`Extracted ${manifest.report.components_extracted ?? "?"}/${manifest.report.components_total ?? "?"} components (${analysisMs}ms)`);
|
|
2314
2405
|
const sheets = this.substituteAssetReferences({
|
|
2315
2406
|
variableCss: system.variableCss,
|
|
2316
2407
|
globalCss: result.globalCss,
|
|
@@ -2344,7 +2435,6 @@ var ExtractionSession = class {
|
|
|
2344
2435
|
prefix: `[${this.driverLabel}]`,
|
|
2345
2436
|
surface: "generated runtime modules"
|
|
2346
2437
|
});
|
|
2347
|
-
setSharedCss(this.key, fullCss);
|
|
2348
2438
|
const systemPropsContent = buildSystemPropsModule({
|
|
2349
2439
|
systemPropMapJson: JSON.stringify(manifest?.system_prop_map ?? {}),
|
|
2350
2440
|
groupRegistryJson: system.groupRegistryJson,
|
|
@@ -2352,20 +2442,6 @@ var ExtractionSession = class {
|
|
|
2352
2442
|
admittedTransforms: manifest?.admitted_transforms ?? {},
|
|
2353
2443
|
typedSystemProps: manifest?.typed_system_props ?? []
|
|
2354
2444
|
});
|
|
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
2445
|
this.writeAnalysisStatus("committing", pending);
|
|
2370
2446
|
const epoch = hashReplacementPlans(snapshotFilePlans(manifest), systemPropsContent);
|
|
2371
2447
|
if (this.lastCommit === null) this.lastCommit = this.seedCommitFromDisk();
|
|
@@ -2385,6 +2461,19 @@ var ExtractionSession = class {
|
|
|
2385
2461
|
} else this.writeSessionArtifact(SYSTEM_PROPS_ARTIFACT, systemPropsContent);
|
|
2386
2462
|
this.publishAnalysisCommit(epoch, generation);
|
|
2387
2463
|
this.publishReplacementEpoch(epoch);
|
|
2464
|
+
this.stagedPublication = {
|
|
2465
|
+
manifest,
|
|
2466
|
+
manifestJson: result.manifestJson,
|
|
2467
|
+
analysisGlobalCss: sheets.globalCss,
|
|
2468
|
+
analysisComponentCss: sheets.componentCss,
|
|
2469
|
+
styles: fullCss,
|
|
2470
|
+
systemPropsModule: systemPropsContent,
|
|
2471
|
+
system,
|
|
2472
|
+
packageMap,
|
|
2473
|
+
analyzedHashes: new Map(fileEntries.map((entry) => [entry.path, entry.hash])),
|
|
2474
|
+
packageReadRecord: this.packageReadRecord,
|
|
2475
|
+
replacementEpoch: epoch
|
|
2476
|
+
};
|
|
2388
2477
|
bt.total = this.elapsed(pipelineStart);
|
|
2389
2478
|
logBuildTimings(bt, manifest?.timing, (msg) => this.log(msg), this.verbose);
|
|
2390
2479
|
}
|
|
@@ -2589,7 +2678,6 @@ var ExtractionSession = class {
|
|
|
2589
2678
|
publishReplacementEpoch(epoch) {
|
|
2590
2679
|
if (!this.persistArtifacts) {
|
|
2591
2680
|
this.lastEpochValue = epoch;
|
|
2592
|
-
setReplacementEpoch(this.key, epoch);
|
|
2593
2681
|
return;
|
|
2594
2682
|
}
|
|
2595
2683
|
const onDisk = this.diskEpochValue();
|
|
@@ -2603,7 +2691,6 @@ var ExtractionSession = class {
|
|
|
2603
2691
|
this.lastEpochValue = epoch;
|
|
2604
2692
|
this.reconcileSiblingEpochs(epoch);
|
|
2605
2693
|
}
|
|
2606
|
-
setReplacementEpoch(this.key, epoch);
|
|
2607
2694
|
}
|
|
2608
2695
|
/** sessions-root listing memo, keyed by the root dir's mtime — a new or
|
|
2609
2696
|
* pruned sibling DIRECTORY moves it; agreeing siblings stay listed. */
|
|
@@ -2820,7 +2907,10 @@ var ExtractionSession = class {
|
|
|
2820
2907
|
//#endregion
|
|
2821
2908
|
//#region session/turbopack-orchestrator.ts
|
|
2822
2909
|
async function runSessionPipeline(session) {
|
|
2823
|
-
session.
|
|
2910
|
+
session.delivery = {
|
|
2911
|
+
...session.delivery,
|
|
2912
|
+
systemPropsModuleId: TURBOPACK_SYSTEM_PROPS_ID
|
|
2913
|
+
};
|
|
2824
2914
|
session.persistAnalysisInputs = true;
|
|
2825
2915
|
await session.runFullPipeline();
|
|
2826
2916
|
}
|
|
@@ -2986,16 +3076,14 @@ function startTurbopackWatcher(session, rootDir, options = {}) {
|
|
|
2986
3076
|
if (isPathWithinRoot(rootDir, path) && !relative(rootDir, path).split(/[\\/]/).some((segment) => IGNORED_SEGMENTS.has(segment))) return true;
|
|
2987
3077
|
return [...externalWatchers.keys()].some((root) => isPathWithinRoot(root, path));
|
|
2988
3078
|
};
|
|
2989
|
-
/** Watches the
|
|
2990
|
-
*
|
|
3079
|
+
/** Watches the Session's plan (its files, and the absent paths whose
|
|
3080
|
+
* creation reloads the system) where no root watcher reports them, by
|
|
3081
|
+
* their directories, for those paths only. */
|
|
2991
3082
|
const syncDependencyWatchers = () => {
|
|
2992
3083
|
if (closed) return;
|
|
2993
3084
|
const wanted = /* @__PURE__ */ new Map();
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
...session.assetDependencyPaths,
|
|
2997
|
-
...session.configInputPaths
|
|
2998
|
-
]) {
|
|
3085
|
+
const plan = session.watchPlan();
|
|
3086
|
+
for (const path of [...plan.files, ...plan.missing]) {
|
|
2999
3087
|
if (watchedByRoot(path)) continue;
|
|
3000
3088
|
const files = wanted.get(dirname(path)) ?? /* @__PURE__ */ new Set();
|
|
3001
3089
|
files.add(path);
|
|
@@ -3089,4 +3177,4 @@ function startTurbopackWatcher(session, rootDir, options = {}) {
|
|
|
3089
3177
|
};
|
|
3090
3178
|
}
|
|
3091
3179
|
//#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 };
|
|
3180
|
+
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.28",
|
|
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.28",
|
|
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.28",
|
|
64
|
+
"@animus-ui/system": "0.1.28",
|
|
65
65
|
"@mdx-js/mdx": "3.1.1",
|
|
66
66
|
"@napi-rs/cli": "^3.10.5",
|
|
67
67
|
"svelte": "5.57.0"
|