@valbuild/core 0.105.0 → 0.106.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/declarations/src/extractValModules.d.ts +54 -0
- package/dist/declarations/src/index.d.ts +3 -2
- package/dist/declarations/src/module.d.ts +10 -0
- package/dist/{index-d7cc2231.esm.js → index-193f19b4.esm.js} +120 -43
- package/dist/{index-730a5254.cjs.dev.js → index-2cef45cc.cjs.dev.js} +120 -42
- package/dist/{index-e990b6ad.cjs.prod.js → index-eaee0a0b.cjs.prod.js} +120 -42
- package/dist/valbuild-core.cjs.dev.js +2 -1
- package/dist/valbuild-core.cjs.prod.js +2 -1
- package/dist/valbuild-core.esm.js +1 -1
- package/package.json +1 -1
- package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
- package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
- package/patch/dist/valbuild-core-patch.esm.js +2 -2
|
@@ -16,7 +16,61 @@ export type ExtractedValModules = {
|
|
|
16
16
|
sourcesSha: string;
|
|
17
17
|
configSha: string;
|
|
18
18
|
moduleErrors: ExtractedModuleError[];
|
|
19
|
+
/**
|
|
20
|
+
* What the SHAs above are a fold over, in order.
|
|
21
|
+
*
|
|
22
|
+
* Kept so they can be recomputed from a source that did NOT come from
|
|
23
|
+
* evaluating the modules — see {@link computeValModuleShas}. A record keyed by
|
|
24
|
+
* path could not do this: the fold is order-dependent, and the order is
|
|
25
|
+
* `val.modules`, which a record does not promise to preserve.
|
|
26
|
+
*/
|
|
27
|
+
shaEntries: ValModuleShaEntry[];
|
|
19
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* One module's contribution to the SHAs, in fold order.
|
|
31
|
+
*
|
|
32
|
+
* The SHAs are a FOLD, not a hash of a set: each module is mixed into the
|
|
33
|
+
* running value in `val.modules` order, so reproducing one means replaying the
|
|
34
|
+
* same modules with the same inputs in the same order. That is what this type
|
|
35
|
+
* is for — see {@link computeValModuleShas}.
|
|
36
|
+
*/
|
|
37
|
+
export type ValModuleShaEntry = {
|
|
38
|
+
path: ModuleFilePath;
|
|
39
|
+
source: Source;
|
|
40
|
+
serializedSchema: SerializedSchema;
|
|
41
|
+
/**
|
|
42
|
+
* How many module errors had been collected when this module was folded in.
|
|
43
|
+
*
|
|
44
|
+
* The base SHA mixes in the error array as it stood at each step, so a module
|
|
45
|
+
* that failed to load changes the hash of every module folded in AFTER it and
|
|
46
|
+
* of none before. Errors are only ever appended, so the state at step _i_ is
|
|
47
|
+
* the final array's first `moduleErrorsAt` entries — one number is enough to
|
|
48
|
+
* reproduce it exactly, and a per-step copy is not needed.
|
|
49
|
+
*/
|
|
50
|
+
moduleErrorsAt: number;
|
|
51
|
+
};
|
|
52
|
+
export type ValModuleShas = {
|
|
53
|
+
baseSha: string;
|
|
54
|
+
schemaSha: string;
|
|
55
|
+
sourcesSha: string;
|
|
56
|
+
configSha: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The SHAs, from the entries they are a fold over.
|
|
60
|
+
*
|
|
61
|
+
* Split out from {@link extractValModules} because there are two ways to arrive
|
|
62
|
+
* at a set of sources. Extraction evaluates the modules; the server also
|
|
63
|
+
* PROMOTES the sources it has just written to disk, because re-evaluating gets
|
|
64
|
+
* it nothing — a module `def` is the app's own `import()`, which resolves from
|
|
65
|
+
* the module registry rather than from the file that was just rewritten. Both
|
|
66
|
+
* have to produce SHAs the other side can compare, so the fold has one
|
|
67
|
+
* implementation and both call it.
|
|
68
|
+
*
|
|
69
|
+
* Feeding back the entries a previous fold used, unchanged, reproduces its SHAs
|
|
70
|
+
* exactly. That is the property the promotion relies on: only the modules whose
|
|
71
|
+
* source actually moved change anything.
|
|
72
|
+
*/
|
|
73
|
+
export declare function computeValModuleShas(config: ValModules["config"], entries: readonly ValModuleShaEntry[], moduleErrors: readonly ExtractedModuleError[]): ValModuleShas;
|
|
20
74
|
/**
|
|
21
75
|
* Extracts schemas and sources from a ValModules registry and computes the
|
|
22
76
|
* deterministic SHAs that the server and client both use to detect changes.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { initVal, type ConfigDirectory } from "./initVal.js";
|
|
2
2
|
export { modules, type ValModules } from "./modules.js";
|
|
3
|
-
export { extractValModules, type ExtractedValModules, type ExtractedModuleError, } from "./extractValModules.js";
|
|
3
|
+
export { extractValModules, computeValModuleShas, type ExtractedValModules, type ValModuleShaEntry, type ValModuleShas, type ExtractedModuleError, } from "./extractValModules.js";
|
|
4
4
|
export type { InitVal, ValConfig, ValConstructor, ContentConstructor, } from "./initVal.js";
|
|
5
5
|
export { Schema, type SerializedSchema, type SelectorOfSchema } from "./schema/index.js";
|
|
6
6
|
export { hasRemoteFileSchema } from "./schema/hasRemoteFileSchema.js";
|
|
@@ -23,7 +23,7 @@ export type { ValidationFix } from "./schema/validation/ValidationFix.js";
|
|
|
23
23
|
export { VAL_EXTENSION, type SourceArray } from "./source/index.js";
|
|
24
24
|
export { derefPatch } from "./patch/deref.js";
|
|
25
25
|
export { type SelectorSource, type SelectorOf, GenericSelector, } from "./selector/index.js";
|
|
26
|
-
import { getSource, splitModulePath, splitModuleFilePath, resolvePath, safeResolvePath, splitModuleFilePathAndModulePath, joinModuleFilePathAndModulePath, parentOfSourcePath, patchPathToModulePath, splitJoinedSourcePaths, type ValModule } from "./module.js";
|
|
26
|
+
import { getSource, isValModule, splitModulePath, splitModuleFilePath, resolvePath, safeResolvePath, splitModuleFilePathAndModulePath, joinModuleFilePathAndModulePath, parentOfSourcePath, patchPathToModulePath, splitJoinedSourcePaths, type ValModule } from "./module.js";
|
|
27
27
|
declare const ModuleFilePathSep = "?p=";
|
|
28
28
|
export { ModuleFilePathSep };
|
|
29
29
|
import { SelectorSource, getSchema } from "./selector/index.js";
|
|
@@ -80,6 +80,7 @@ declare const Internal: {
|
|
|
80
80
|
getSchema: typeof getSchema;
|
|
81
81
|
getValPath: typeof getValPath;
|
|
82
82
|
getSource: typeof getSource;
|
|
83
|
+
isValModule: typeof isValModule;
|
|
83
84
|
resolvePath: typeof resolvePath;
|
|
84
85
|
safeResolvePath: typeof safeResolvePath;
|
|
85
86
|
splitModuleFilePathAndModulePath: typeof splitModuleFilePathAndModulePath;
|
|
@@ -18,6 +18,16 @@ export type ReplaceRawStringWithString<T extends SelectorSource> = SelectorSourc
|
|
|
18
18
|
export declare function define<T extends Schema<SelectorSource>>(id: string, // TODO: `/${string}`
|
|
19
19
|
schema: T, source: ReplaceRawStringWithString<SelectorOfSchema<T>>): ValModule<SelectorOfSchema<T>>;
|
|
20
20
|
export declare function getSource<T extends Source>(valModule: ValModule<T>): T;
|
|
21
|
+
/**
|
|
22
|
+
* Whether `value` is a Val module, i.e. something {@link define} produced.
|
|
23
|
+
*
|
|
24
|
+
* Checks for the three symbols `define` writes, rather than a class identity:
|
|
25
|
+
* a module may have been created by a different copy of `@valbuild/core` (the
|
|
26
|
+
* editor SPA and the host bundle each ship their own, and the CLI evaluates
|
|
27
|
+
* user modules inside a `node:vm` context). The symbols are created with
|
|
28
|
+
* `Symbol.for`, so they are shared across all of those; a constructor is not.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isValModule(value: unknown): value is ValModule<SelectorSource>;
|
|
21
31
|
export declare function splitModuleFilePathAndModulePath(path: SourcePath | ModuleFilePath): [moduleId: ModuleFilePath, path: ModulePath];
|
|
22
32
|
export declare function joinModuleFilePathAndModulePath(moduleFilePath: ModuleFilePath, modulePath: ModulePath): SourcePath;
|
|
23
33
|
export declare function getSourceAtPath(modulePath: ModulePath, valModule: ValModule<SelectorSource> | Source): any;
|
|
@@ -3319,8 +3319,8 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3319
3319
|
if (_this2.keySchema) {
|
|
3320
3320
|
var keyPath = createValPathOfItem(path, key);
|
|
3321
3321
|
if (!keyPath) {
|
|
3322
|
-
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for key validation")
|
|
3323
|
-
;
|
|
3322
|
+
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for key validation") // Should! never happen
|
|
3323
|
+
);
|
|
3324
3324
|
}
|
|
3325
3325
|
var keyError = _this2.keySchema["executeValidate"](keyPath, key);
|
|
3326
3326
|
if (keyError) {
|
|
@@ -3681,8 +3681,8 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3681
3681
|
}
|
|
3682
3682
|
var subPath = createValPathOfItem(path, validation.error.urlPath);
|
|
3683
3683
|
if (!subPath) {
|
|
3684
|
-
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for router validation")
|
|
3685
|
-
;
|
|
3684
|
+
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for router validation") // Should! never happen
|
|
3685
|
+
);
|
|
3686
3686
|
}
|
|
3687
3687
|
return [subPath, [{
|
|
3688
3688
|
message: validation.error.message,
|
|
@@ -3858,6 +3858,19 @@ schema, source) {
|
|
|
3858
3858
|
function getSource(valModule) {
|
|
3859
3859
|
return valModule[GetSource];
|
|
3860
3860
|
}
|
|
3861
|
+
|
|
3862
|
+
/**
|
|
3863
|
+
* Whether `value` is a Val module, i.e. something {@link define} produced.
|
|
3864
|
+
*
|
|
3865
|
+
* Checks for the three symbols `define` writes, rather than a class identity:
|
|
3866
|
+
* a module may have been created by a different copy of `@valbuild/core` (the
|
|
3867
|
+
* editor SPA and the host bundle each ship their own, and the CLI evaluates
|
|
3868
|
+
* user modules inside a `node:vm` context). The symbols are created with
|
|
3869
|
+
* `Symbol.for`, so they are shared across all of those; a constructor is not.
|
|
3870
|
+
*/
|
|
3871
|
+
function isValModule(value) {
|
|
3872
|
+
return _typeof(value) === "object" && value !== null && GetSource in value && GetSchema in value && Path in value;
|
|
3873
|
+
}
|
|
3861
3874
|
function splitModuleFilePathAndModulePath(path) {
|
|
3862
3875
|
var pathOfSep = path.indexOf(ModuleFilePathSep);
|
|
3863
3876
|
if (pathOfSep === -1) {
|
|
@@ -6808,6 +6821,84 @@ function collectObjectRecursive(item, collector) {
|
|
|
6808
6821
|
}
|
|
6809
6822
|
}
|
|
6810
6823
|
|
|
6824
|
+
/**
|
|
6825
|
+
* One module's contribution to the SHAs, in fold order.
|
|
6826
|
+
*
|
|
6827
|
+
* The SHAs are a FOLD, not a hash of a set: each module is mixed into the
|
|
6828
|
+
* running value in `val.modules` order, so reproducing one means replaying the
|
|
6829
|
+
* same modules with the same inputs in the same order. That is what this type
|
|
6830
|
+
* is for — see {@link computeValModuleShas}.
|
|
6831
|
+
*/
|
|
6832
|
+
|
|
6833
|
+
/**
|
|
6834
|
+
* The SHAs, from the entries they are a fold over.
|
|
6835
|
+
*
|
|
6836
|
+
* Split out from {@link extractValModules} because there are two ways to arrive
|
|
6837
|
+
* at a set of sources. Extraction evaluates the modules; the server also
|
|
6838
|
+
* PROMOTES the sources it has just written to disk, because re-evaluating gets
|
|
6839
|
+
* it nothing — a module `def` is the app's own `import()`, which resolves from
|
|
6840
|
+
* the module registry rather than from the file that was just rewritten. Both
|
|
6841
|
+
* have to produce SHAs the other side can compare, so the fold has one
|
|
6842
|
+
* implementation and both call it.
|
|
6843
|
+
*
|
|
6844
|
+
* Feeding back the entries a previous fold used, unchanged, reproduces its SHAs
|
|
6845
|
+
* exactly. That is the property the promotion relies on: only the modules whose
|
|
6846
|
+
* source actually moved change anything.
|
|
6847
|
+
*/
|
|
6848
|
+
function computeValModuleShas(config, entries, moduleErrors) {
|
|
6849
|
+
var configSha = hash(JSON.stringify(config));
|
|
6850
|
+
var sourcesSha = "";
|
|
6851
|
+
var baseSha = configSha;
|
|
6852
|
+
// NOTE: schemaSha is deliberately NOT seeded with configSha. It is compared
|
|
6853
|
+
// across bundles (the server extracts from the Node bundle, the editor SPA
|
|
6854
|
+
// from the browser bundle) to detect that a new version has been deployed.
|
|
6855
|
+
// The config contains values that are not part of the schema and that differ
|
|
6856
|
+
// between those two bundles - most notably the documented
|
|
6857
|
+
// `gitCommit: process.env.VERCEL_GIT_COMMIT_SHA` / `gitBranch`, which are
|
|
6858
|
+
// server-only env vars and therefore `undefined` in the browser. Seeding with
|
|
6859
|
+
// them made the two sides disagree on every production load.
|
|
6860
|
+
var schemaSha = "";
|
|
6861
|
+
var _iterator = _createForOfIteratorHelper(entries),
|
|
6862
|
+
_step;
|
|
6863
|
+
try {
|
|
6864
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
6865
|
+
var entry = _step.value;
|
|
6866
|
+
var path = entry.path,
|
|
6867
|
+
source = entry.source,
|
|
6868
|
+
serializedSchema = entry.serializedSchema;
|
|
6869
|
+
sourcesSha = hash(sourcesSha + JSON.stringify({
|
|
6870
|
+
path: path,
|
|
6871
|
+
source: source
|
|
6872
|
+
}));
|
|
6873
|
+
baseSha = hash(baseSha + JSON.stringify({
|
|
6874
|
+
path: path,
|
|
6875
|
+
schema: serializedSchema,
|
|
6876
|
+
source: source,
|
|
6877
|
+
modulesErrors: moduleErrors.slice(0, entry.moduleErrorsAt)
|
|
6878
|
+
}));
|
|
6879
|
+
// The PATH is part of the schema set, not just the schema: renaming a
|
|
6880
|
+
// module while leaving its schema byte-identical still changes which paths
|
|
6881
|
+
// exist, and an open client keyed its schema cache by the old path. Hashing
|
|
6882
|
+
// the schema alone left this SHA unchanged, so with no commitSha to fall
|
|
6883
|
+
// back on the client never refetched /schema.
|
|
6884
|
+
schemaSha = hash(schemaSha + JSON.stringify({
|
|
6885
|
+
path: path,
|
|
6886
|
+
schema: serializedSchema
|
|
6887
|
+
}));
|
|
6888
|
+
}
|
|
6889
|
+
} catch (err) {
|
|
6890
|
+
_iterator.e(err);
|
|
6891
|
+
} finally {
|
|
6892
|
+
_iterator.f();
|
|
6893
|
+
}
|
|
6894
|
+
return {
|
|
6895
|
+
baseSha: baseSha,
|
|
6896
|
+
schemaSha: schemaSha,
|
|
6897
|
+
sourcesSha: sourcesSha,
|
|
6898
|
+
configSha: configSha
|
|
6899
|
+
};
|
|
6900
|
+
}
|
|
6901
|
+
|
|
6811
6902
|
/**
|
|
6812
6903
|
* Extracts schemas and sources from a ValModules registry and computes the
|
|
6813
6904
|
* deterministic SHAs that the server and client both use to detect changes.
|
|
@@ -6820,7 +6911,7 @@ function extractValModules(_x) {
|
|
|
6820
6911
|
}
|
|
6821
6912
|
function _extractValModules() {
|
|
6822
6913
|
_extractValModules = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(valModules) {
|
|
6823
|
-
var moduleErrors, addModuleError, sources, schemas, serializedSchemas,
|
|
6914
|
+
var moduleErrors, addModuleError, sources, schemas, serializedSchemas, shaEntries, moduleIdx, module, at, value, path, schema, source, serializedSchema, pathM, _t, _t2;
|
|
6824
6915
|
return _regenerator().w(function (_context) {
|
|
6825
6916
|
while (1) switch (_context.p = _context.n) {
|
|
6826
6917
|
case 0:
|
|
@@ -6835,17 +6926,15 @@ function _extractValModules() {
|
|
|
6835
6926
|
sources = {};
|
|
6836
6927
|
schemas = {};
|
|
6837
6928
|
serializedSchemas = {};
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
// them made the two sides disagree on every production load.
|
|
6848
|
-
schemaSha = "";
|
|
6929
|
+
/**
|
|
6930
|
+
* What the fold below runs over, collected here rather than hashed inline.
|
|
6931
|
+
*
|
|
6932
|
+
* The hashing itself moved to `computeValModuleShas`, so the server can
|
|
6933
|
+
* recompute these SHAs for sources it did not get by evaluating the modules.
|
|
6934
|
+
* Collected in loop order, which is `val.modules` order, which is the order
|
|
6935
|
+
* the fold is defined by.
|
|
6936
|
+
*/
|
|
6937
|
+
shaEntries = [];
|
|
6849
6938
|
moduleIdx = 0;
|
|
6850
6939
|
case 1:
|
|
6851
6940
|
if (!(moduleIdx < valModules.modules.length)) {
|
|
@@ -6948,40 +7037,27 @@ function _extractValModules() {
|
|
|
6948
7037
|
sources[pathM] = source;
|
|
6949
7038
|
schemas[pathM] = schema;
|
|
6950
7039
|
serializedSchemas[pathM] = serializedSchema;
|
|
6951
|
-
|
|
6952
|
-
path:
|
|
6953
|
-
source: source
|
|
6954
|
-
}));
|
|
6955
|
-
baseSha = hash(baseSha + JSON.stringify({
|
|
6956
|
-
path: path,
|
|
6957
|
-
schema: serializedSchema,
|
|
7040
|
+
shaEntries.push({
|
|
7041
|
+
path: pathM,
|
|
6958
7042
|
source: source,
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
// the schema alone left this SHA unchanged, so with no commitSha to fall
|
|
6965
|
-
// back on the client never refetched /schema.
|
|
6966
|
-
schemaSha = hash(schemaSha + JSON.stringify({
|
|
6967
|
-
path: path,
|
|
6968
|
-
schema: serializedSchema
|
|
6969
|
-
}));
|
|
7043
|
+
serializedSchema: serializedSchema,
|
|
7044
|
+
// The errors so far, which is what the base SHA used to mix in by hashing
|
|
7045
|
+
// the live array at this point in the loop. See `moduleErrorsAt`.
|
|
7046
|
+
moduleErrorsAt: moduleErrors.length
|
|
7047
|
+
});
|
|
6970
7048
|
case 17:
|
|
6971
7049
|
moduleIdx++;
|
|
6972
7050
|
_context.n = 1;
|
|
6973
7051
|
break;
|
|
6974
7052
|
case 18:
|
|
6975
|
-
return _context.a(2, {
|
|
7053
|
+
return _context.a(2, _objectSpread2(_objectSpread2({
|
|
6976
7054
|
sources: sources,
|
|
6977
7055
|
schemas: schemas,
|
|
6978
|
-
serializedSchemas: serializedSchemas
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
moduleErrors: moduleErrors
|
|
6984
|
-
});
|
|
7056
|
+
serializedSchemas: serializedSchemas
|
|
7057
|
+
}, computeValModuleShas(valModules.config, shaEntries, moduleErrors)), {}, {
|
|
7058
|
+
moduleErrors: moduleErrors,
|
|
7059
|
+
shaEntries: shaEntries
|
|
7060
|
+
}));
|
|
6985
7061
|
}
|
|
6986
7062
|
}, _callee, null, [[14, 15], [4, 6]]);
|
|
6987
7063
|
}));
|
|
@@ -8498,6 +8574,7 @@ var Internal = {
|
|
|
8498
8574
|
getSchema: getSchema,
|
|
8499
8575
|
getValPath: getValPath,
|
|
8500
8576
|
getSource: getSource,
|
|
8577
|
+
isValModule: isValModule,
|
|
8501
8578
|
resolvePath: resolvePath,
|
|
8502
8579
|
safeResolvePath: safeResolvePath,
|
|
8503
8580
|
splitModuleFilePathAndModulePath: splitModuleFilePathAndModulePath,
|
|
@@ -8590,4 +8667,4 @@ function tryJsonParse(str) {
|
|
|
8590
8667
|
}
|
|
8591
8668
|
}
|
|
8592
8669
|
|
|
8593
|
-
export { ArraySchema as A, BooleanSchema as B, ColorSchema as C, DEFAULT_CONTENT_HOST as D, FATAL_ERROR_TYPES as F, GenericSelector as G, Internal as I, KeyOfSchema as K, LiteralSchema as L, ModuleFilePathSep as M, NumberSchema as N, ObjectSchema as O, PatchError as P, RecordSchema as R, Schema as S, UnionSchema as U, VAL_EXTENSION as V, _typeof as _, _slicedToArray as a, _createClass as b, _classCallCheck as c, _toConsumableArray as d, DEFAULT_APP_HOST as e, extractValModules as f,
|
|
8670
|
+
export { ArraySchema as A, BooleanSchema as B, ColorSchema as C, DEFAULT_CONTENT_HOST as D, FATAL_ERROR_TYPES as F, GenericSelector as G, Internal as I, KeyOfSchema as K, LiteralSchema as L, ModuleFilePathSep as M, NumberSchema as N, ObjectSchema as O, PatchError as P, RecordSchema as R, Schema as S, UnionSchema as U, VAL_EXTENSION as V, _typeof as _, _slicedToArray as a, _createClass as b, _classCallCheck as c, _toConsumableArray as d, DEFAULT_APP_HOST as e, extractValModules as f, computeValModuleShas as g, hasRemoteFileSchema as h, initVal as i, DEFAULT_VAL_REMOTE_HOST as j, derefPatch as k, StringSchema as l, modules as m, ImageSchema as n, FileSchema as o, DateSchema as p, COLOR_FORMATS as q, DEFAULT_COLOR_FORMAT as r, splitModuleFilePathAndModulePath as s, DateTimeSchema as t, RouteSchema as u, RichTextSchema as v, deserializeSchema as w, previewScope as x, CODE_LANGUAGES as y, getSourcePathFromRoute as z };
|
|
@@ -3321,8 +3321,8 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3321
3321
|
if (_this2.keySchema) {
|
|
3322
3322
|
var keyPath = createValPathOfItem(path, key);
|
|
3323
3323
|
if (!keyPath) {
|
|
3324
|
-
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for key validation")
|
|
3325
|
-
;
|
|
3324
|
+
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for key validation") // Should! never happen
|
|
3325
|
+
);
|
|
3326
3326
|
}
|
|
3327
3327
|
var keyError = _this2.keySchema["executeValidate"](keyPath, key);
|
|
3328
3328
|
if (keyError) {
|
|
@@ -3683,8 +3683,8 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3683
3683
|
}
|
|
3684
3684
|
var subPath = createValPathOfItem(path, validation.error.urlPath);
|
|
3685
3685
|
if (!subPath) {
|
|
3686
|
-
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for router validation")
|
|
3687
|
-
;
|
|
3686
|
+
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for router validation") // Should! never happen
|
|
3687
|
+
);
|
|
3688
3688
|
}
|
|
3689
3689
|
return [subPath, [{
|
|
3690
3690
|
message: validation.error.message,
|
|
@@ -3860,6 +3860,19 @@ schema, source) {
|
|
|
3860
3860
|
function getSource(valModule) {
|
|
3861
3861
|
return valModule[GetSource];
|
|
3862
3862
|
}
|
|
3863
|
+
|
|
3864
|
+
/**
|
|
3865
|
+
* Whether `value` is a Val module, i.e. something {@link define} produced.
|
|
3866
|
+
*
|
|
3867
|
+
* Checks for the three symbols `define` writes, rather than a class identity:
|
|
3868
|
+
* a module may have been created by a different copy of `@valbuild/core` (the
|
|
3869
|
+
* editor SPA and the host bundle each ship their own, and the CLI evaluates
|
|
3870
|
+
* user modules inside a `node:vm` context). The symbols are created with
|
|
3871
|
+
* `Symbol.for`, so they are shared across all of those; a constructor is not.
|
|
3872
|
+
*/
|
|
3873
|
+
function isValModule(value) {
|
|
3874
|
+
return _typeof(value) === "object" && value !== null && GetSource in value && GetSchema in value && Path in value;
|
|
3875
|
+
}
|
|
3863
3876
|
function splitModuleFilePathAndModulePath(path) {
|
|
3864
3877
|
var pathOfSep = path.indexOf(ModuleFilePathSep);
|
|
3865
3878
|
if (pathOfSep === -1) {
|
|
@@ -6810,6 +6823,84 @@ function collectObjectRecursive(item, collector) {
|
|
|
6810
6823
|
}
|
|
6811
6824
|
}
|
|
6812
6825
|
|
|
6826
|
+
/**
|
|
6827
|
+
* One module's contribution to the SHAs, in fold order.
|
|
6828
|
+
*
|
|
6829
|
+
* The SHAs are a FOLD, not a hash of a set: each module is mixed into the
|
|
6830
|
+
* running value in `val.modules` order, so reproducing one means replaying the
|
|
6831
|
+
* same modules with the same inputs in the same order. That is what this type
|
|
6832
|
+
* is for — see {@link computeValModuleShas}.
|
|
6833
|
+
*/
|
|
6834
|
+
|
|
6835
|
+
/**
|
|
6836
|
+
* The SHAs, from the entries they are a fold over.
|
|
6837
|
+
*
|
|
6838
|
+
* Split out from {@link extractValModules} because there are two ways to arrive
|
|
6839
|
+
* at a set of sources. Extraction evaluates the modules; the server also
|
|
6840
|
+
* PROMOTES the sources it has just written to disk, because re-evaluating gets
|
|
6841
|
+
* it nothing — a module `def` is the app's own `import()`, which resolves from
|
|
6842
|
+
* the module registry rather than from the file that was just rewritten. Both
|
|
6843
|
+
* have to produce SHAs the other side can compare, so the fold has one
|
|
6844
|
+
* implementation and both call it.
|
|
6845
|
+
*
|
|
6846
|
+
* Feeding back the entries a previous fold used, unchanged, reproduces its SHAs
|
|
6847
|
+
* exactly. That is the property the promotion relies on: only the modules whose
|
|
6848
|
+
* source actually moved change anything.
|
|
6849
|
+
*/
|
|
6850
|
+
function computeValModuleShas(config, entries, moduleErrors) {
|
|
6851
|
+
var configSha = hash(JSON.stringify(config));
|
|
6852
|
+
var sourcesSha = "";
|
|
6853
|
+
var baseSha = configSha;
|
|
6854
|
+
// NOTE: schemaSha is deliberately NOT seeded with configSha. It is compared
|
|
6855
|
+
// across bundles (the server extracts from the Node bundle, the editor SPA
|
|
6856
|
+
// from the browser bundle) to detect that a new version has been deployed.
|
|
6857
|
+
// The config contains values that are not part of the schema and that differ
|
|
6858
|
+
// between those two bundles - most notably the documented
|
|
6859
|
+
// `gitCommit: process.env.VERCEL_GIT_COMMIT_SHA` / `gitBranch`, which are
|
|
6860
|
+
// server-only env vars and therefore `undefined` in the browser. Seeding with
|
|
6861
|
+
// them made the two sides disagree on every production load.
|
|
6862
|
+
var schemaSha = "";
|
|
6863
|
+
var _iterator = result._createForOfIteratorHelper(entries),
|
|
6864
|
+
_step;
|
|
6865
|
+
try {
|
|
6866
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
6867
|
+
var entry = _step.value;
|
|
6868
|
+
var path = entry.path,
|
|
6869
|
+
source = entry.source,
|
|
6870
|
+
serializedSchema = entry.serializedSchema;
|
|
6871
|
+
sourcesSha = hash(sourcesSha + JSON.stringify({
|
|
6872
|
+
path: path,
|
|
6873
|
+
source: source
|
|
6874
|
+
}));
|
|
6875
|
+
baseSha = hash(baseSha + JSON.stringify({
|
|
6876
|
+
path: path,
|
|
6877
|
+
schema: serializedSchema,
|
|
6878
|
+
source: source,
|
|
6879
|
+
modulesErrors: moduleErrors.slice(0, entry.moduleErrorsAt)
|
|
6880
|
+
}));
|
|
6881
|
+
// The PATH is part of the schema set, not just the schema: renaming a
|
|
6882
|
+
// module while leaving its schema byte-identical still changes which paths
|
|
6883
|
+
// exist, and an open client keyed its schema cache by the old path. Hashing
|
|
6884
|
+
// the schema alone left this SHA unchanged, so with no commitSha to fall
|
|
6885
|
+
// back on the client never refetched /schema.
|
|
6886
|
+
schemaSha = hash(schemaSha + JSON.stringify({
|
|
6887
|
+
path: path,
|
|
6888
|
+
schema: serializedSchema
|
|
6889
|
+
}));
|
|
6890
|
+
}
|
|
6891
|
+
} catch (err) {
|
|
6892
|
+
_iterator.e(err);
|
|
6893
|
+
} finally {
|
|
6894
|
+
_iterator.f();
|
|
6895
|
+
}
|
|
6896
|
+
return {
|
|
6897
|
+
baseSha: baseSha,
|
|
6898
|
+
schemaSha: schemaSha,
|
|
6899
|
+
sourcesSha: sourcesSha,
|
|
6900
|
+
configSha: configSha
|
|
6901
|
+
};
|
|
6902
|
+
}
|
|
6903
|
+
|
|
6813
6904
|
/**
|
|
6814
6905
|
* Extracts schemas and sources from a ValModules registry and computes the
|
|
6815
6906
|
* deterministic SHAs that the server and client both use to detect changes.
|
|
@@ -6822,7 +6913,7 @@ function extractValModules(_x) {
|
|
|
6822
6913
|
}
|
|
6823
6914
|
function _extractValModules() {
|
|
6824
6915
|
_extractValModules = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(valModules) {
|
|
6825
|
-
var moduleErrors, addModuleError, sources, schemas, serializedSchemas,
|
|
6916
|
+
var moduleErrors, addModuleError, sources, schemas, serializedSchemas, shaEntries, moduleIdx, module, at, value, path, schema, source, serializedSchema, pathM, _t, _t2;
|
|
6826
6917
|
return _regenerator().w(function (_context) {
|
|
6827
6918
|
while (1) switch (_context.p = _context.n) {
|
|
6828
6919
|
case 0:
|
|
@@ -6837,17 +6928,15 @@ function _extractValModules() {
|
|
|
6837
6928
|
sources = {};
|
|
6838
6929
|
schemas = {};
|
|
6839
6930
|
serializedSchemas = {};
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
// them made the two sides disagree on every production load.
|
|
6850
|
-
schemaSha = "";
|
|
6931
|
+
/**
|
|
6932
|
+
* What the fold below runs over, collected here rather than hashed inline.
|
|
6933
|
+
*
|
|
6934
|
+
* The hashing itself moved to `computeValModuleShas`, so the server can
|
|
6935
|
+
* recompute these SHAs for sources it did not get by evaluating the modules.
|
|
6936
|
+
* Collected in loop order, which is `val.modules` order, which is the order
|
|
6937
|
+
* the fold is defined by.
|
|
6938
|
+
*/
|
|
6939
|
+
shaEntries = [];
|
|
6851
6940
|
moduleIdx = 0;
|
|
6852
6941
|
case 1:
|
|
6853
6942
|
if (!(moduleIdx < valModules.modules.length)) {
|
|
@@ -6950,40 +7039,27 @@ function _extractValModules() {
|
|
|
6950
7039
|
sources[pathM] = source;
|
|
6951
7040
|
schemas[pathM] = schema;
|
|
6952
7041
|
serializedSchemas[pathM] = serializedSchema;
|
|
6953
|
-
|
|
6954
|
-
path:
|
|
6955
|
-
source: source
|
|
6956
|
-
}));
|
|
6957
|
-
baseSha = hash(baseSha + JSON.stringify({
|
|
6958
|
-
path: path,
|
|
6959
|
-
schema: serializedSchema,
|
|
7042
|
+
shaEntries.push({
|
|
7043
|
+
path: pathM,
|
|
6960
7044
|
source: source,
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
// the schema alone left this SHA unchanged, so with no commitSha to fall
|
|
6967
|
-
// back on the client never refetched /schema.
|
|
6968
|
-
schemaSha = hash(schemaSha + JSON.stringify({
|
|
6969
|
-
path: path,
|
|
6970
|
-
schema: serializedSchema
|
|
6971
|
-
}));
|
|
7045
|
+
serializedSchema: serializedSchema,
|
|
7046
|
+
// The errors so far, which is what the base SHA used to mix in by hashing
|
|
7047
|
+
// the live array at this point in the loop. See `moduleErrorsAt`.
|
|
7048
|
+
moduleErrorsAt: moduleErrors.length
|
|
7049
|
+
});
|
|
6972
7050
|
case 17:
|
|
6973
7051
|
moduleIdx++;
|
|
6974
7052
|
_context.n = 1;
|
|
6975
7053
|
break;
|
|
6976
7054
|
case 18:
|
|
6977
|
-
return _context.a(2, {
|
|
7055
|
+
return _context.a(2, _objectSpread2(_objectSpread2({
|
|
6978
7056
|
sources: sources,
|
|
6979
7057
|
schemas: schemas,
|
|
6980
|
-
serializedSchemas: serializedSchemas
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
moduleErrors: moduleErrors
|
|
6986
|
-
});
|
|
7058
|
+
serializedSchemas: serializedSchemas
|
|
7059
|
+
}, computeValModuleShas(valModules.config, shaEntries, moduleErrors)), {}, {
|
|
7060
|
+
moduleErrors: moduleErrors,
|
|
7061
|
+
shaEntries: shaEntries
|
|
7062
|
+
}));
|
|
6987
7063
|
}
|
|
6988
7064
|
}, _callee, null, [[14, 15], [4, 6]]);
|
|
6989
7065
|
}));
|
|
@@ -8500,6 +8576,7 @@ var Internal = {
|
|
|
8500
8576
|
getSchema: getSchema,
|
|
8501
8577
|
getValPath: getValPath,
|
|
8502
8578
|
getSource: getSource,
|
|
8579
|
+
isValModule: isValModule,
|
|
8503
8580
|
resolvePath: resolvePath,
|
|
8504
8581
|
safeResolvePath: safeResolvePath,
|
|
8505
8582
|
splitModuleFilePathAndModulePath: splitModuleFilePathAndModulePath,
|
|
@@ -8626,6 +8703,7 @@ exports._createClass = _createClass;
|
|
|
8626
8703
|
exports._slicedToArray = _slicedToArray;
|
|
8627
8704
|
exports._toConsumableArray = _toConsumableArray;
|
|
8628
8705
|
exports._typeof = _typeof;
|
|
8706
|
+
exports.computeValModuleShas = computeValModuleShas;
|
|
8629
8707
|
exports.derefPatch = derefPatch;
|
|
8630
8708
|
exports.deserializeSchema = deserializeSchema;
|
|
8631
8709
|
exports.extractValModules = extractValModules;
|
|
@@ -3321,8 +3321,8 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3321
3321
|
if (_this2.keySchema) {
|
|
3322
3322
|
var keyPath = createValPathOfItem(path, key);
|
|
3323
3323
|
if (!keyPath) {
|
|
3324
|
-
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for key validation")
|
|
3325
|
-
;
|
|
3324
|
+
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for key validation") // Should! never happen
|
|
3325
|
+
);
|
|
3326
3326
|
}
|
|
3327
3327
|
var keyError = _this2.keySchema["executeValidate"](keyPath, key);
|
|
3328
3328
|
if (keyError) {
|
|
@@ -3683,8 +3683,8 @@ var RecordSchema = /*#__PURE__*/function (_Schema) {
|
|
|
3683
3683
|
}
|
|
3684
3684
|
var subPath = createValPathOfItem(path, validation.error.urlPath);
|
|
3685
3685
|
if (!subPath) {
|
|
3686
|
-
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for router validation")
|
|
3687
|
-
;
|
|
3686
|
+
throw new Error("Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " for router validation") // Should! never happen
|
|
3687
|
+
);
|
|
3688
3688
|
}
|
|
3689
3689
|
return [subPath, [{
|
|
3690
3690
|
message: validation.error.message,
|
|
@@ -3860,6 +3860,19 @@ schema, source) {
|
|
|
3860
3860
|
function getSource(valModule) {
|
|
3861
3861
|
return valModule[GetSource];
|
|
3862
3862
|
}
|
|
3863
|
+
|
|
3864
|
+
/**
|
|
3865
|
+
* Whether `value` is a Val module, i.e. something {@link define} produced.
|
|
3866
|
+
*
|
|
3867
|
+
* Checks for the three symbols `define` writes, rather than a class identity:
|
|
3868
|
+
* a module may have been created by a different copy of `@valbuild/core` (the
|
|
3869
|
+
* editor SPA and the host bundle each ship their own, and the CLI evaluates
|
|
3870
|
+
* user modules inside a `node:vm` context). The symbols are created with
|
|
3871
|
+
* `Symbol.for`, so they are shared across all of those; a constructor is not.
|
|
3872
|
+
*/
|
|
3873
|
+
function isValModule(value) {
|
|
3874
|
+
return _typeof(value) === "object" && value !== null && GetSource in value && GetSchema in value && Path in value;
|
|
3875
|
+
}
|
|
3863
3876
|
function splitModuleFilePathAndModulePath(path) {
|
|
3864
3877
|
var pathOfSep = path.indexOf(ModuleFilePathSep);
|
|
3865
3878
|
if (pathOfSep === -1) {
|
|
@@ -6810,6 +6823,84 @@ function collectObjectRecursive(item, collector) {
|
|
|
6810
6823
|
}
|
|
6811
6824
|
}
|
|
6812
6825
|
|
|
6826
|
+
/**
|
|
6827
|
+
* One module's contribution to the SHAs, in fold order.
|
|
6828
|
+
*
|
|
6829
|
+
* The SHAs are a FOLD, not a hash of a set: each module is mixed into the
|
|
6830
|
+
* running value in `val.modules` order, so reproducing one means replaying the
|
|
6831
|
+
* same modules with the same inputs in the same order. That is what this type
|
|
6832
|
+
* is for — see {@link computeValModuleShas}.
|
|
6833
|
+
*/
|
|
6834
|
+
|
|
6835
|
+
/**
|
|
6836
|
+
* The SHAs, from the entries they are a fold over.
|
|
6837
|
+
*
|
|
6838
|
+
* Split out from {@link extractValModules} because there are two ways to arrive
|
|
6839
|
+
* at a set of sources. Extraction evaluates the modules; the server also
|
|
6840
|
+
* PROMOTES the sources it has just written to disk, because re-evaluating gets
|
|
6841
|
+
* it nothing — a module `def` is the app's own `import()`, which resolves from
|
|
6842
|
+
* the module registry rather than from the file that was just rewritten. Both
|
|
6843
|
+
* have to produce SHAs the other side can compare, so the fold has one
|
|
6844
|
+
* implementation and both call it.
|
|
6845
|
+
*
|
|
6846
|
+
* Feeding back the entries a previous fold used, unchanged, reproduces its SHAs
|
|
6847
|
+
* exactly. That is the property the promotion relies on: only the modules whose
|
|
6848
|
+
* source actually moved change anything.
|
|
6849
|
+
*/
|
|
6850
|
+
function computeValModuleShas(config, entries, moduleErrors) {
|
|
6851
|
+
var configSha = hash(JSON.stringify(config));
|
|
6852
|
+
var sourcesSha = "";
|
|
6853
|
+
var baseSha = configSha;
|
|
6854
|
+
// NOTE: schemaSha is deliberately NOT seeded with configSha. It is compared
|
|
6855
|
+
// across bundles (the server extracts from the Node bundle, the editor SPA
|
|
6856
|
+
// from the browser bundle) to detect that a new version has been deployed.
|
|
6857
|
+
// The config contains values that are not part of the schema and that differ
|
|
6858
|
+
// between those two bundles - most notably the documented
|
|
6859
|
+
// `gitCommit: process.env.VERCEL_GIT_COMMIT_SHA` / `gitBranch`, which are
|
|
6860
|
+
// server-only env vars and therefore `undefined` in the browser. Seeding with
|
|
6861
|
+
// them made the two sides disagree on every production load.
|
|
6862
|
+
var schemaSha = "";
|
|
6863
|
+
var _iterator = result._createForOfIteratorHelper(entries),
|
|
6864
|
+
_step;
|
|
6865
|
+
try {
|
|
6866
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
6867
|
+
var entry = _step.value;
|
|
6868
|
+
var path = entry.path,
|
|
6869
|
+
source = entry.source,
|
|
6870
|
+
serializedSchema = entry.serializedSchema;
|
|
6871
|
+
sourcesSha = hash(sourcesSha + JSON.stringify({
|
|
6872
|
+
path: path,
|
|
6873
|
+
source: source
|
|
6874
|
+
}));
|
|
6875
|
+
baseSha = hash(baseSha + JSON.stringify({
|
|
6876
|
+
path: path,
|
|
6877
|
+
schema: serializedSchema,
|
|
6878
|
+
source: source,
|
|
6879
|
+
modulesErrors: moduleErrors.slice(0, entry.moduleErrorsAt)
|
|
6880
|
+
}));
|
|
6881
|
+
// The PATH is part of the schema set, not just the schema: renaming a
|
|
6882
|
+
// module while leaving its schema byte-identical still changes which paths
|
|
6883
|
+
// exist, and an open client keyed its schema cache by the old path. Hashing
|
|
6884
|
+
// the schema alone left this SHA unchanged, so with no commitSha to fall
|
|
6885
|
+
// back on the client never refetched /schema.
|
|
6886
|
+
schemaSha = hash(schemaSha + JSON.stringify({
|
|
6887
|
+
path: path,
|
|
6888
|
+
schema: serializedSchema
|
|
6889
|
+
}));
|
|
6890
|
+
}
|
|
6891
|
+
} catch (err) {
|
|
6892
|
+
_iterator.e(err);
|
|
6893
|
+
} finally {
|
|
6894
|
+
_iterator.f();
|
|
6895
|
+
}
|
|
6896
|
+
return {
|
|
6897
|
+
baseSha: baseSha,
|
|
6898
|
+
schemaSha: schemaSha,
|
|
6899
|
+
sourcesSha: sourcesSha,
|
|
6900
|
+
configSha: configSha
|
|
6901
|
+
};
|
|
6902
|
+
}
|
|
6903
|
+
|
|
6813
6904
|
/**
|
|
6814
6905
|
* Extracts schemas and sources from a ValModules registry and computes the
|
|
6815
6906
|
* deterministic SHAs that the server and client both use to detect changes.
|
|
@@ -6822,7 +6913,7 @@ function extractValModules(_x) {
|
|
|
6822
6913
|
}
|
|
6823
6914
|
function _extractValModules() {
|
|
6824
6915
|
_extractValModules = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(valModules) {
|
|
6825
|
-
var moduleErrors, addModuleError, sources, schemas, serializedSchemas,
|
|
6916
|
+
var moduleErrors, addModuleError, sources, schemas, serializedSchemas, shaEntries, moduleIdx, module, at, value, path, schema, source, serializedSchema, pathM, _t, _t2;
|
|
6826
6917
|
return _regenerator().w(function (_context) {
|
|
6827
6918
|
while (1) switch (_context.p = _context.n) {
|
|
6828
6919
|
case 0:
|
|
@@ -6837,17 +6928,15 @@ function _extractValModules() {
|
|
|
6837
6928
|
sources = {};
|
|
6838
6929
|
schemas = {};
|
|
6839
6930
|
serializedSchemas = {};
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
// them made the two sides disagree on every production load.
|
|
6850
|
-
schemaSha = "";
|
|
6931
|
+
/**
|
|
6932
|
+
* What the fold below runs over, collected here rather than hashed inline.
|
|
6933
|
+
*
|
|
6934
|
+
* The hashing itself moved to `computeValModuleShas`, so the server can
|
|
6935
|
+
* recompute these SHAs for sources it did not get by evaluating the modules.
|
|
6936
|
+
* Collected in loop order, which is `val.modules` order, which is the order
|
|
6937
|
+
* the fold is defined by.
|
|
6938
|
+
*/
|
|
6939
|
+
shaEntries = [];
|
|
6851
6940
|
moduleIdx = 0;
|
|
6852
6941
|
case 1:
|
|
6853
6942
|
if (!(moduleIdx < valModules.modules.length)) {
|
|
@@ -6950,40 +7039,27 @@ function _extractValModules() {
|
|
|
6950
7039
|
sources[pathM] = source;
|
|
6951
7040
|
schemas[pathM] = schema;
|
|
6952
7041
|
serializedSchemas[pathM] = serializedSchema;
|
|
6953
|
-
|
|
6954
|
-
path:
|
|
6955
|
-
source: source
|
|
6956
|
-
}));
|
|
6957
|
-
baseSha = hash(baseSha + JSON.stringify({
|
|
6958
|
-
path: path,
|
|
6959
|
-
schema: serializedSchema,
|
|
7042
|
+
shaEntries.push({
|
|
7043
|
+
path: pathM,
|
|
6960
7044
|
source: source,
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
// the schema alone left this SHA unchanged, so with no commitSha to fall
|
|
6967
|
-
// back on the client never refetched /schema.
|
|
6968
|
-
schemaSha = hash(schemaSha + JSON.stringify({
|
|
6969
|
-
path: path,
|
|
6970
|
-
schema: serializedSchema
|
|
6971
|
-
}));
|
|
7045
|
+
serializedSchema: serializedSchema,
|
|
7046
|
+
// The errors so far, which is what the base SHA used to mix in by hashing
|
|
7047
|
+
// the live array at this point in the loop. See `moduleErrorsAt`.
|
|
7048
|
+
moduleErrorsAt: moduleErrors.length
|
|
7049
|
+
});
|
|
6972
7050
|
case 17:
|
|
6973
7051
|
moduleIdx++;
|
|
6974
7052
|
_context.n = 1;
|
|
6975
7053
|
break;
|
|
6976
7054
|
case 18:
|
|
6977
|
-
return _context.a(2, {
|
|
7055
|
+
return _context.a(2, _objectSpread2(_objectSpread2({
|
|
6978
7056
|
sources: sources,
|
|
6979
7057
|
schemas: schemas,
|
|
6980
|
-
serializedSchemas: serializedSchemas
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
moduleErrors: moduleErrors
|
|
6986
|
-
});
|
|
7058
|
+
serializedSchemas: serializedSchemas
|
|
7059
|
+
}, computeValModuleShas(valModules.config, shaEntries, moduleErrors)), {}, {
|
|
7060
|
+
moduleErrors: moduleErrors,
|
|
7061
|
+
shaEntries: shaEntries
|
|
7062
|
+
}));
|
|
6987
7063
|
}
|
|
6988
7064
|
}, _callee, null, [[14, 15], [4, 6]]);
|
|
6989
7065
|
}));
|
|
@@ -8500,6 +8576,7 @@ var Internal = {
|
|
|
8500
8576
|
getSchema: getSchema,
|
|
8501
8577
|
getValPath: getValPath,
|
|
8502
8578
|
getSource: getSource,
|
|
8579
|
+
isValModule: isValModule,
|
|
8503
8580
|
resolvePath: resolvePath,
|
|
8504
8581
|
safeResolvePath: safeResolvePath,
|
|
8505
8582
|
splitModuleFilePathAndModulePath: splitModuleFilePathAndModulePath,
|
|
@@ -8626,6 +8703,7 @@ exports._createClass = _createClass;
|
|
|
8626
8703
|
exports._slicedToArray = _slicedToArray;
|
|
8627
8704
|
exports._toConsumableArray = _toConsumableArray;
|
|
8628
8705
|
exports._typeof = _typeof;
|
|
8706
|
+
exports.computeValModuleShas = computeValModuleShas;
|
|
8629
8707
|
exports.derefPatch = derefPatch;
|
|
8630
8708
|
exports.deserializeSchema = deserializeSchema;
|
|
8631
8709
|
exports.extractValModules = extractValModules;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_valbuildCore = require('./index-
|
|
5
|
+
var dist_valbuildCore = require('./index-2cef45cc.cjs.dev.js');
|
|
6
6
|
require('./result-bb1f436e.cjs.dev.js');
|
|
7
7
|
|
|
8
8
|
|
|
@@ -35,6 +35,7 @@ exports.Schema = dist_valbuildCore.Schema;
|
|
|
35
35
|
exports.StringSchema = dist_valbuildCore.StringSchema;
|
|
36
36
|
exports.UnionSchema = dist_valbuildCore.UnionSchema;
|
|
37
37
|
exports.VAL_EXTENSION = dist_valbuildCore.VAL_EXTENSION;
|
|
38
|
+
exports.computeValModuleShas = dist_valbuildCore.computeValModuleShas;
|
|
38
39
|
exports.derefPatch = dist_valbuildCore.derefPatch;
|
|
39
40
|
exports.deserializeSchema = dist_valbuildCore.deserializeSchema;
|
|
40
41
|
exports.extractValModules = dist_valbuildCore.extractValModules;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_valbuildCore = require('./index-
|
|
5
|
+
var dist_valbuildCore = require('./index-eaee0a0b.cjs.prod.js');
|
|
6
6
|
require('./result-787e35f6.cjs.prod.js');
|
|
7
7
|
|
|
8
8
|
|
|
@@ -35,6 +35,7 @@ exports.Schema = dist_valbuildCore.Schema;
|
|
|
35
35
|
exports.StringSchema = dist_valbuildCore.StringSchema;
|
|
36
36
|
exports.UnionSchema = dist_valbuildCore.UnionSchema;
|
|
37
37
|
exports.VAL_EXTENSION = dist_valbuildCore.VAL_EXTENSION;
|
|
38
|
+
exports.computeValModuleShas = dist_valbuildCore.computeValModuleShas;
|
|
38
39
|
exports.derefPatch = dist_valbuildCore.derefPatch;
|
|
39
40
|
exports.deserializeSchema = dist_valbuildCore.deserializeSchema;
|
|
40
41
|
exports.extractValModules = dist_valbuildCore.extractValModules;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as ArraySchema, B as BooleanSchema,
|
|
1
|
+
export { A as ArraySchema, B as BooleanSchema, y as CODE_LANGUAGES, q as COLOR_FORMATS, C as ColorSchema, e as DEFAULT_APP_HOST, r as DEFAULT_COLOR_FORMAT, D as DEFAULT_CONTENT_HOST, j as DEFAULT_VAL_REMOTE_HOST, p as DateSchema, t as DateTimeSchema, F as FATAL_ERROR_TYPES, o as FileSchema, G as GenericSelector, n as ImageSchema, I as Internal, K as KeyOfSchema, L as LiteralSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, v as RichTextSchema, u as RouteSchema, S as Schema, l as StringSchema, U as UnionSchema, V as VAL_EXTENSION, g as computeValModuleShas, k as derefPatch, w as deserializeSchema, f as extractValModules, z as getSourcePathFromRoute, h as hasRemoteFileSchema, i as initVal, m as modules, x as previewScope } from './index-193f19b4.esm.js';
|
|
2
2
|
import './result-daff1cae.esm.js';
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_valbuildCore = require('../../dist/index-
|
|
5
|
+
var dist_valbuildCore = require('../../dist/index-2cef45cc.cjs.dev.js');
|
|
6
6
|
var result = require('../../dist/result-bb1f436e.cjs.dev.js');
|
|
7
7
|
var util = require('../../dist/util-b213092b.cjs.dev.js');
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_valbuildCore = require('../../dist/index-
|
|
5
|
+
var dist_valbuildCore = require('../../dist/index-eaee0a0b.cjs.prod.js');
|
|
6
6
|
var result = require('../../dist/result-787e35f6.cjs.prod.js');
|
|
7
7
|
var util = require('../../dist/util-030d8a1f.cjs.prod.js');
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-
|
|
2
|
-
export { P as PatchError } from '../../dist/index-
|
|
1
|
+
import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-193f19b4.esm.js';
|
|
2
|
+
export { P as PatchError } from '../../dist/index-193f19b4.esm.js';
|
|
3
3
|
import { f as isNonEmpty, e as err, o as ok, m as map, g as flatMap, i as isErr, h as flatMapReduce, j as filterOrElse, k as mapErr, l as map$1, n as all, p as flatten, q as allT } from '../../dist/result-daff1cae.esm.js';
|
|
4
4
|
import { p as pipe } from '../../dist/util-18613e99.esm.js';
|
|
5
5
|
|