@valbuild/tanstack-build 0.150.12 → 0.151.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/README.md +5 -0
- package/constants/dist/valbuild-tanstack-build-constants.cjs.dev.js +1 -1
- package/constants/dist/valbuild-tanstack-build-constants.cjs.prod.js +1 -1
- package/constants/dist/valbuild-tanstack-build-constants.esm.js +1 -1
- package/dist/declarations/src/projectPaths.d.ts +12 -0
- package/dist/declarations/src/valModules.d.ts +22 -0
- package/dist/{projectPaths-5e4defea.esm.js → projectPaths-521a37ed.esm.js} +16 -1
- package/dist/{projectPaths-9cbecebf.cjs.prod.js → projectPaths-cb474a60.cjs.dev.js} +16 -0
- package/dist/{projectPaths-f222255a.cjs.dev.js → projectPaths-d08a9ea7.cjs.prod.js} +16 -0
- package/dist/valbuild-tanstack-build.cjs.dev.js +455 -369
- package/dist/valbuild-tanstack-build.cjs.prod.js +455 -369
- package/dist/valbuild-tanstack-build.esm.js +456 -370
- package/node/dist/valbuild-tanstack-build-node.cjs.dev.js +1 -1
- package/node/dist/valbuild-tanstack-build-node.cjs.prod.js +1 -1
- package/node/dist/valbuild-tanstack-build-node.esm.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as _asyncToGenerator, a as _regenerator, b as _createForOfIteratorHelper, c as _toConsumableArray, d as _slicedToArray, s as sha256Hex, e as _typeof, f as _objectSpread2, g as _defineProperty, h as _regeneratorValues, r as resolveAsset, i as assetModule, j as isAsset } from './regeneratorValues-56b72784.esm.js';
|
|
2
2
|
export { I as INLINE_LIMIT, k as base64Bytes, j as isAsset } from './regeneratorValues-56b72784.esm.js';
|
|
3
|
-
import { T as TREE, E as ENTRY } from './projectPaths-
|
|
4
|
-
export { E as ENTRY, R as ROUTES_DIR, T as TREE } from './projectPaths-
|
|
3
|
+
import { T as TREE, v as valModulesEntryFile, E as ENTRY } from './projectPaths-521a37ed.esm.js';
|
|
4
|
+
export { E as ENTRY, R as ROUTES_DIR, T as TREE } from './projectPaths-521a37ed.esm.js';
|
|
5
5
|
import { compile } from 'tailwindcss';
|
|
6
6
|
import { A as ARTIFACT_KEYS, a as ARTIFACT_PREFIXES } from './artifactKeys-3a40f3a0.esm.js';
|
|
7
7
|
export { A as ARTIFACT_KEYS, a as ARTIFACT_PREFIXES } from './artifactKeys-3a40f3a0.esm.js';
|
|
@@ -1191,7 +1191,7 @@ var packageJson = {
|
|
|
1191
1191
|
url: "git+https://github.com/valbuild/val.git"
|
|
1192
1192
|
},
|
|
1193
1193
|
license: "MIT",
|
|
1194
|
-
version: "0.
|
|
1194
|
+
version: "0.151.0",
|
|
1195
1195
|
sideEffects: false,
|
|
1196
1196
|
main: "dist/valbuild-tanstack-build.cjs.js",
|
|
1197
1197
|
module: "dist/valbuild-tanstack-build.esm.js",
|
|
@@ -1355,7 +1355,14 @@ var LEGACY_CONTROL_HOST = "platform.internal";
|
|
|
1355
1355
|
* existed -- which is every project already published, since a build in a tab
|
|
1356
1356
|
* rewrites single lines of its `val.server.ts` and never regenerates it.
|
|
1357
1357
|
*/
|
|
1358
|
-
var PROPOSAL_BLOCK = "/*\n * THE PROPOSAL this isolate serves the address of, when it does: its name and\n * content branch, and the content it has saved (`VAL_OVERLAY`: the save's\n * commit, its Source by module
|
|
1358
|
+
var PROPOSAL_BLOCK = "/*\n * THE PROPOSAL this isolate serves the address of, when it does: its name and\n * content branch, and the content it has saved (`VAL_OVERLAY`: the save's\n * commit, its Source by module, its `.val.ts` text by path, and which\n * modules' code is staged). Val reads that Source instead of the bundle's,\n * commits a save to the proposal, and names the save as its position. And\n * which staging this build was made of (`VAL_BUILD_INPUTS`), so Val can tell\n * a staged module this build evaluated from one staged after it.\n * valbuild/home `docs/proposals.md`, \"Saving\" and \"Staged schemas\".\n *\n * Parsed here rather than with `proposalFromEnv` from @valbuild/server,\n * because this file is compiled against whatever @valbuild/tanstack the\n * PROJECT installed, and one from before proposals has no such export -- it\n * also ignores the `proposal` key below, and serves the base build, which\n * is the best an old app can do. A snapshot that does not parse is thrown,\n * not served as the base: a reviewer must not be shown the wrong content as\n * though it were the proposal.\n */\nconst proposal = (() => {\n const name = secret(\"VAL_PROPOSAL\");\n const branch = secret(\"VAL_BRANCH\");\n if (!name || !branch) return undefined;\n const overlay: {\n commit?: string | null;\n modules?: Record<string, unknown>;\n files?: Record<string, string>;\n staged?: Record<string, string>;\n } = JSON.parse(secret(\"VAL_OVERLAY\") ?? \"{}\");\n // Checked as `proposalFromEnv` checks them: read wrong, a save would\n // apply to staged code as though the build had it, or the other way round.\n const staged = overlay.staged ?? {};\n for (const [path, version] of Object.entries(staged)) {\n if (\n !path.startsWith(\"/\") ||\n typeof version !== \"string\" ||\n !version.startsWith(\"staged:\")\n ) {\n throw new Error(\n `Val: proposal ${name}: VAL_OVERLAY's staged must name module files with staged:<inputs> versions (${JSON.stringify(path)})`,\n );\n }\n }\n const inputs = secret(\"VAL_BUILD_INPUTS\");\n if (inputs && !/^[0-9a-f]{64}$/.test(inputs)) {\n throw new Error(\n `Val: proposal ${name}: VAL_BUILD_INPUTS is not a build's staged inputs (64 hex)`,\n );\n }\n return {\n name,\n branch,\n commit: overlay.commit ?? null,\n modules: overlay.modules ?? {},\n files: overlay.files ?? {},\n staged,\n buildInputs: inputs || null,\n };\n})();\n";
|
|
1359
|
+
/**
|
|
1360
|
+
* {@link PROPOSAL_BLOCK} as it was generated before it read which modules
|
|
1361
|
+
* are staged and what the build was made of: rewritten to the current block
|
|
1362
|
+
* by {@link rebakeProposal}, exactly, so a site wired before it learns both
|
|
1363
|
+
* at its next build. Never generated.
|
|
1364
|
+
*/
|
|
1365
|
+
var PROPOSAL_BLOCK_V1 = "/*\n * THE PROPOSAL this isolate serves the address of, when it does: its name and\n * content branch, and the content it has saved (`VAL_OVERLAY`: the save's\n * commit, its Source by module and its `.val.ts` text by path). Val reads\n * that Source instead of the bundle's, commits a save to the proposal, and\n * names the save as its position. valbuild/home `docs/proposals.md`,\n * \"Saving\".\n *\n * Parsed here rather than with `proposalFromEnv` from @valbuild/server,\n * because this file is compiled against whatever @valbuild/tanstack the\n * PROJECT installed, and one from before proposals has no such export -- it\n * also ignores the `proposal` key below, and serves the base build, which\n * is the best an old app can do. A snapshot that does not parse is thrown,\n * not served as the base: a reviewer must not be shown the wrong content as\n * though it were the proposal.\n */\nconst proposal = (() => {\n const name = secret(\"VAL_PROPOSAL\");\n const branch = secret(\"VAL_BRANCH\");\n if (!name || !branch) return undefined;\n const overlay: {\n commit?: string | null;\n modules?: Record<string, unknown>;\n files?: Record<string, string>;\n } = JSON.parse(secret(\"VAL_OVERLAY\") ?? \"{}\");\n return {\n name,\n branch,\n commit: overlay.commit ?? null,\n modules: overlay.modules ?? {},\n files: overlay.files ?? {},\n };\n})();\n";
|
|
1359
1366
|
/**
|
|
1360
1367
|
* THE CONTENT VERSION the site serves, when it differs from the one this build
|
|
1361
1368
|
* bundles (\`VAL_CONTENT\`). See valbuild/home \`docs/hosted-publishing.md\`,
|
|
@@ -1467,6 +1474,14 @@ function bakedJob(files) {
|
|
|
1467
1474
|
* as it is, and serves a proposal's address as its base build.
|
|
1468
1475
|
*/
|
|
1469
1476
|
function rebakeProposal(source) {
|
|
1477
|
+
// A block from before staged code was read: the current one in its place,
|
|
1478
|
+
// where it is exactly as generated.
|
|
1479
|
+
var at = source.indexOf(PROPOSAL_BLOCK_V1);
|
|
1480
|
+
if (at !== -1 && source.indexOf(PROPOSAL_BLOCK_V1, at + 1) === -1) {
|
|
1481
|
+
return source.replace(PROPOSAL_BLOCK_V1, function () {
|
|
1482
|
+
return PROPOSAL_BLOCK;
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1470
1485
|
if (source.includes("const proposal = (() => {")) return source;
|
|
1471
1486
|
var once = function once(needle) {
|
|
1472
1487
|
var at = source.indexOf(needle);
|
|
@@ -1876,6 +1891,402 @@ function canonicalJson(value) {
|
|
|
1876
1891
|
return JSON.stringify(value);
|
|
1877
1892
|
}
|
|
1878
1893
|
|
|
1894
|
+
/**
|
|
1895
|
+
* JSON with comments and trailing commas, which is what tsconfig.json is.
|
|
1896
|
+
*
|
|
1897
|
+
* Written as a scanner rather than a regex on purpose: `"url": "https://x"`
|
|
1898
|
+
* contains `//`, and a regex that strips comments without tracking string state
|
|
1899
|
+
* truncates the file there and throws a parse error pointing at the wrong line.
|
|
1900
|
+
*/
|
|
1901
|
+
function parseJsonc(text) {
|
|
1902
|
+
var out = "";
|
|
1903
|
+
var i = 0;
|
|
1904
|
+
while (i < text.length) {
|
|
1905
|
+
var ch = text[i];
|
|
1906
|
+
if (ch === '"') {
|
|
1907
|
+
// Copy the whole string literal, escapes included, untouched.
|
|
1908
|
+
out += ch;
|
|
1909
|
+
i++;
|
|
1910
|
+
while (i < text.length) {
|
|
1911
|
+
var c = text[i];
|
|
1912
|
+
out += c;
|
|
1913
|
+
i++;
|
|
1914
|
+
if (c === "\\") {
|
|
1915
|
+
if (i < text.length) out += text[i++];
|
|
1916
|
+
continue;
|
|
1917
|
+
}
|
|
1918
|
+
if (c === '"') break;
|
|
1919
|
+
}
|
|
1920
|
+
continue;
|
|
1921
|
+
}
|
|
1922
|
+
if (ch === "/" && text[i + 1] === "/") {
|
|
1923
|
+
while (i < text.length && text[i] !== "\n") i++;
|
|
1924
|
+
continue;
|
|
1925
|
+
}
|
|
1926
|
+
if (ch === "/" && text[i + 1] === "*") {
|
|
1927
|
+
i += 2;
|
|
1928
|
+
while (i < text.length && !(text[i] === "*" && text[i + 1] === "/")) i++;
|
|
1929
|
+
i += 2;
|
|
1930
|
+
continue;
|
|
1931
|
+
}
|
|
1932
|
+
out += ch;
|
|
1933
|
+
i++;
|
|
1934
|
+
}
|
|
1935
|
+
// Trailing commas, now that every remaining comma is structural.
|
|
1936
|
+
return JSON.parse(out.replace(/,(\s*[}\]])/g, "$1"));
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
/** One `paths` entry, pre-split on its wildcard. */
|
|
1940
|
+
|
|
1941
|
+
/**
|
|
1942
|
+
* Reads tsconfig.json out of the file record and builds the matcher.
|
|
1943
|
+
*
|
|
1944
|
+
* Returns null when the project configures no aliases, which is the common
|
|
1945
|
+
* case and costs nothing.
|
|
1946
|
+
*/
|
|
1947
|
+
function aliasMap(files, warn) {
|
|
1948
|
+
var _config$compilerOptio, _config$compilerOptio2;
|
|
1949
|
+
var entry = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "tsconfig.json";
|
|
1950
|
+
var config = readConfig(files, entry, warn, new Set());
|
|
1951
|
+
var paths = config === null || config === void 0 || (_config$compilerOptio = config.compilerOptions) === null || _config$compilerOptio === void 0 ? void 0 : _config$compilerOptio.paths;
|
|
1952
|
+
var baseUrl = config === null || config === void 0 || (_config$compilerOptio2 = config.compilerOptions) === null || _config$compilerOptio2 === void 0 ? void 0 : _config$compilerOptio2.baseUrl;
|
|
1953
|
+
// A project can configure either one without the other, and baseUrl alone is
|
|
1954
|
+
// enough to change how a bare specifier resolves.
|
|
1955
|
+
if ((!paths || Object.keys(paths).length === 0) && baseUrl === undefined) return null;
|
|
1956
|
+
|
|
1957
|
+
// `baseUrl` is relative to the tsconfig that declared it. Since TS 4.1 paths
|
|
1958
|
+
// work without one, resolved against the tsconfig's own directory -- so the
|
|
1959
|
+
// fallback here is the directory, not the project root.
|
|
1960
|
+
var base = resolve(dirname(entry), baseUrl !== null && baseUrl !== void 0 ? baseUrl : ".");
|
|
1961
|
+
var patterns = [];
|
|
1962
|
+
for (var _i = 0, _Object$entries = Object.entries(paths !== null && paths !== void 0 ? paths : {}); _i < _Object$entries.length; _i++) {
|
|
1963
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
1964
|
+
pattern = _Object$entries$_i[0],
|
|
1965
|
+
targets = _Object$entries$_i[1];
|
|
1966
|
+
var star = pattern.indexOf("*");
|
|
1967
|
+
if (star !== pattern.lastIndexOf("*")) {
|
|
1968
|
+
warn("tsconfig paths pattern '".concat(pattern, "' has more than one '*' and is ignored."));
|
|
1969
|
+
continue;
|
|
1970
|
+
}
|
|
1971
|
+
patterns.push({
|
|
1972
|
+
prefix: star === -1 ? pattern : pattern.slice(0, star),
|
|
1973
|
+
suffix: star === -1 ? "" : pattern.slice(star + 1),
|
|
1974
|
+
wildcard: star !== -1,
|
|
1975
|
+
targets: targets.map(function (target) {
|
|
1976
|
+
return resolve(base, target);
|
|
1977
|
+
})
|
|
1978
|
+
});
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
// TypeScript picks the pattern with the longest literal prefix, so `@/ui/*`
|
|
1982
|
+
// beats `@/*` for `@/ui/card` regardless of declaration order.
|
|
1983
|
+
patterns.sort(function (a, b) {
|
|
1984
|
+
return b.prefix.length - a.prefix.length;
|
|
1985
|
+
});
|
|
1986
|
+
return {
|
|
1987
|
+
patterns: Object.keys(paths !== null && paths !== void 0 ? paths : {}),
|
|
1988
|
+
baseUrlCandidate: function baseUrlCandidate(specifier) {
|
|
1989
|
+
return baseUrl === undefined ? null : resolve(base, specifier);
|
|
1990
|
+
},
|
|
1991
|
+
candidates: function candidates(specifier) {
|
|
1992
|
+
var _loop = function _loop() {
|
|
1993
|
+
var pattern = _patterns[_i2];
|
|
1994
|
+
if (!pattern.wildcard) {
|
|
1995
|
+
if (specifier === pattern.prefix) return {
|
|
1996
|
+
v: _toConsumableArray(pattern.targets)
|
|
1997
|
+
};
|
|
1998
|
+
return 0; // continue
|
|
1999
|
+
}
|
|
2000
|
+
if (!specifier.startsWith(pattern.prefix) || !specifier.endsWith(pattern.suffix) || specifier.length < pattern.prefix.length + pattern.suffix.length) {
|
|
2001
|
+
return 0; // continue
|
|
2002
|
+
}
|
|
2003
|
+
var matched = specifier.slice(pattern.prefix.length, specifier.length - pattern.suffix.length);
|
|
2004
|
+
return {
|
|
2005
|
+
v: pattern.targets.map(function (target) {
|
|
2006
|
+
return target.replace("*", matched);
|
|
2007
|
+
})
|
|
2008
|
+
};
|
|
2009
|
+
},
|
|
2010
|
+
_ret;
|
|
2011
|
+
for (var _i2 = 0, _patterns = patterns; _i2 < _patterns.length; _i2++) {
|
|
2012
|
+
_ret = _loop();
|
|
2013
|
+
if (_ret === 0) continue;
|
|
2014
|
+
if (_ret) return _ret.v;
|
|
2015
|
+
}
|
|
2016
|
+
return [];
|
|
2017
|
+
}
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
/** Follows `extends` through the file record. Package extends cannot be read. */
|
|
2022
|
+
function readConfig(files, path, warn, seen) {
|
|
2023
|
+
var _config, _config$compilerOptio4, _config$compilerOptio5, _parent$compilerOptio;
|
|
2024
|
+
if (seen.has(path)) return null; // a cycle; whatever we have is enough
|
|
2025
|
+
seen.add(path);
|
|
2026
|
+
var text = files[path];
|
|
2027
|
+
if (text === undefined) return null;
|
|
2028
|
+
var config;
|
|
2029
|
+
try {
|
|
2030
|
+
config = parseJsonc(text);
|
|
2031
|
+
} catch (error) {
|
|
2032
|
+
var _message;
|
|
2033
|
+
warn("Could not parse ".concat(path, ": ").concat(String((_message = error === null || error === void 0 ? void 0 : error.message) !== null && _message !== void 0 ? _message : error)));
|
|
2034
|
+
return null;
|
|
2035
|
+
}
|
|
2036
|
+
if (!((_config = config) !== null && _config !== void 0 && _config["extends"])) return config;
|
|
2037
|
+
|
|
2038
|
+
// Only a relative extends can be followed: a package one ("extends":
|
|
2039
|
+
// "@tsconfig/node20/tsconfig.json") lives in node_modules, which a browser
|
|
2040
|
+
// build does not have. Worth saying out loud rather than silently resolving
|
|
2041
|
+
// half the aliases, because the base config is where a monorepo usually puts
|
|
2042
|
+
// them.
|
|
2043
|
+
if (!config["extends"].startsWith(".")) {
|
|
2044
|
+
var _config$compilerOptio3;
|
|
2045
|
+
if (!((_config$compilerOptio3 = config.compilerOptions) !== null && _config$compilerOptio3 !== void 0 && _config$compilerOptio3.paths)) {
|
|
2046
|
+
warn("".concat(path, " extends '").concat(config["extends"], "', which is a package and cannot be read here. ") + "Any 'paths' it declares will not apply -- declare them in ".concat(path, " instead."));
|
|
2047
|
+
}
|
|
2048
|
+
return config;
|
|
2049
|
+
}
|
|
2050
|
+
var parentPath = resolveConfigPath(files, resolve(dirname(path), config["extends"]));
|
|
2051
|
+
var parent = parentPath ? readConfig(files, parentPath, warn, seen) : null;
|
|
2052
|
+
if (!parent) return config;
|
|
2053
|
+
|
|
2054
|
+
// The child wins, and `paths` replaces rather than merges -- which is what
|
|
2055
|
+
// TypeScript does.
|
|
2056
|
+
return {
|
|
2057
|
+
compilerOptions: _objectSpread2(_objectSpread2(_objectSpread2({}, parent.compilerOptions), config.compilerOptions), {}, {
|
|
2058
|
+
// baseUrl in the parent was relative to the *parent*, and readConfig
|
|
2059
|
+
// returns it unresolved, so a parent baseUrl with a child that sets none
|
|
2060
|
+
// is the one case this gets wrong. Rare enough to name rather than model.
|
|
2061
|
+
paths: (_config$compilerOptio4 = (_config$compilerOptio5 = config.compilerOptions) === null || _config$compilerOptio5 === void 0 ? void 0 : _config$compilerOptio5.paths) !== null && _config$compilerOptio4 !== void 0 ? _config$compilerOptio4 : (_parent$compilerOptio = parent.compilerOptions) === null || _parent$compilerOptio === void 0 ? void 0 : _parent$compilerOptio.paths
|
|
2062
|
+
})
|
|
2063
|
+
};
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
/** `extends: './base'` may omit the .json. */
|
|
2067
|
+
function resolveConfigPath(files, path) {
|
|
2068
|
+
for (var _i3 = 0, _arr = [path, "".concat(path, ".json")]; _i3 < _arr.length; _i3++) {
|
|
2069
|
+
var candidate = _arr[_i3];
|
|
2070
|
+
if (candidate in files) return candidate;
|
|
2071
|
+
}
|
|
2072
|
+
return null;
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
/**
|
|
2076
|
+
* A project's `val.modules.ts`, bundled to run: every `.val.ts` it imports,
|
|
2077
|
+
* the `val.config` they share and the `.val.json` entries they name, as ONE
|
|
2078
|
+
* ES module -- so it can be imported from a `blob:` URL, which cannot resolve
|
|
2079
|
+
* a relative chunk -- with every npm import pointing at the site's own
|
|
2080
|
+
* vendor chunks, at absolute URLs under `origin`.
|
|
2081
|
+
*
|
|
2082
|
+
* What the builder tab evaluates to learn a tree's schemas: Update from the
|
|
2083
|
+
* site with code (valbuild/home `docs/hosted-publishing.md` step 8.2, slice
|
|
2084
|
+
* 1b). The project's own `@valbuild/*` and dependencies are what run, as the
|
|
2085
|
+
* site runs them -- the browser half of its layer, from `/_pvendor/<rev>/`,
|
|
2086
|
+
* and the base layer from `/_vendor/`. Whoever imports it should do so off
|
|
2087
|
+
* the Studio's page: `@valbuild/tanstack` brings React and patches its JSX.
|
|
2088
|
+
*
|
|
2089
|
+
* Nothing else of a build happens here: no route splitting, no server
|
|
2090
|
+
* functions, no CSS -- a `.val.ts` has none of it.
|
|
2091
|
+
*/
|
|
2092
|
+
function bundleValModules(_x) {
|
|
2093
|
+
return _bundleValModules.apply(this, arguments);
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
/**
|
|
2097
|
+
* A build's `val.modules` registry, as the build emits it beside its client
|
|
2098
|
+
* chunks: `{ "val-modules-<build>.js": code }`, served at `/_app/` with
|
|
2099
|
+
* them, its npm imports pointing at the site's vendor chunks on its own
|
|
2100
|
+
* origin (`/_vendor/`, `/_pvendor/<rev>/`) as the client bundle's do.
|
|
2101
|
+
*
|
|
2102
|
+
* What a Studio opened on an older build imports, once the server's
|
|
2103
|
+
* manifest names it (`registry`, from the build's name the platform hands
|
|
2104
|
+
* the server: `VAL_BUILD`), to take this build's schemas in WITHOUT
|
|
2105
|
+
* reloading the page: `HostStore.reloadCode` in `@valbuild/ui`, and phase 9
|
|
2106
|
+
* of `docs/plans/one-content-model.md` in valbuild/val.
|
|
2107
|
+
*
|
|
2108
|
+
* Empty -- and the build goes on -- for a project with no `val.modules.ts`,
|
|
2109
|
+
* or one whose Val modules cannot be bundled for the browser (a `.val.ts`
|
|
2110
|
+
* importing something server-only): such a build has no entry, and a Studio
|
|
2111
|
+
* that cannot import one reloads the page instead, as it did before. Said
|
|
2112
|
+
* in the build's warnings.
|
|
2113
|
+
*/
|
|
2114
|
+
function _bundleValModules() {
|
|
2115
|
+
_bundleValModules = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(input) {
|
|
2116
|
+
var _input$entry;
|
|
2117
|
+
var files, target, origin, entry, warnings, aliases, base, project, resolveProjectPath, _yield$loadRolldown, build, result, chunks, _t;
|
|
2118
|
+
return _regenerator().w(function (_context) {
|
|
2119
|
+
while (1) switch (_context.p = _context.n) {
|
|
2120
|
+
case 0:
|
|
2121
|
+
files = input.files, target = input.target, origin = input.origin;
|
|
2122
|
+
entry = (_input$entry = input.entry) !== null && _input$entry !== void 0 ? _input$entry : ["val.modules.ts", "val.modules.js"].find(function (path) {
|
|
2123
|
+
return path in files;
|
|
2124
|
+
});
|
|
2125
|
+
if (!(entry === undefined || !(entry in files))) {
|
|
2126
|
+
_context.n = 1;
|
|
2127
|
+
break;
|
|
2128
|
+
}
|
|
2129
|
+
throw new Error("This project has no val.modules.ts, so its Val modules cannot be read.");
|
|
2130
|
+
case 1:
|
|
2131
|
+
warnings = [];
|
|
2132
|
+
aliases = aliasMap(files, function (message) {
|
|
2133
|
+
return warnings.push(message);
|
|
2134
|
+
});
|
|
2135
|
+
base = "".concat(origin, "/_vendor/");
|
|
2136
|
+
project = target.project.rev === null ? null : "".concat(origin, "/_pvendor/").concat(target.project.rev, "/");
|
|
2137
|
+
resolveProjectPath = function resolveProjectPath(path) {
|
|
2138
|
+
return resolveInFiles(path, files);
|
|
2139
|
+
};
|
|
2140
|
+
_context.n = 2;
|
|
2141
|
+
return loadRolldown();
|
|
2142
|
+
case 2:
|
|
2143
|
+
_yield$loadRolldown = _context.v;
|
|
2144
|
+
build = _yield$loadRolldown.build;
|
|
2145
|
+
_context.p = 3;
|
|
2146
|
+
_context.n = 4;
|
|
2147
|
+
return build({
|
|
2148
|
+
input: entry,
|
|
2149
|
+
// See `buildOnce`: required in the browser, inert here.
|
|
2150
|
+
cwd: "/",
|
|
2151
|
+
moduleTypes: {
|
|
2152
|
+
".css": "empty"
|
|
2153
|
+
},
|
|
2154
|
+
plugins: [{
|
|
2155
|
+
name: "val:modules",
|
|
2156
|
+
resolveId: function resolveId(source, importer) {
|
|
2157
|
+
if (source.startsWith(".")) {
|
|
2158
|
+
return resolveProjectPath(resolve(dirname(importer !== null && importer !== void 0 ? importer : entry), source));
|
|
2159
|
+
}
|
|
2160
|
+
if (source in files) return source;
|
|
2161
|
+
var baseChunk = target.base.modules[source];
|
|
2162
|
+
if (baseChunk) {
|
|
2163
|
+
return {
|
|
2164
|
+
id: "".concat(base).concat(baseChunk, ".js"),
|
|
2165
|
+
external: true
|
|
2166
|
+
};
|
|
2167
|
+
}
|
|
2168
|
+
var projectChunk = target.project.modules[source];
|
|
2169
|
+
if (projectChunk && project !== null) {
|
|
2170
|
+
if (target.project.workerOnly.includes(source)) {
|
|
2171
|
+
throw new Error("'".concat(source, "' is server-only in this project's vendor layer, so a .val.ts importing it cannot be read in the browser."));
|
|
2172
|
+
}
|
|
2173
|
+
return {
|
|
2174
|
+
id: "".concat(project).concat(projectChunk, ".js"),
|
|
2175
|
+
external: true
|
|
2176
|
+
};
|
|
2177
|
+
}
|
|
2178
|
+
if (aliases) {
|
|
2179
|
+
var _iterator = _createForOfIteratorHelper(aliases.candidates(source)),
|
|
2180
|
+
_step;
|
|
2181
|
+
try {
|
|
2182
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2183
|
+
var candidate = _step.value;
|
|
2184
|
+
var _hit = resolveProjectPath(candidate);
|
|
2185
|
+
if (_hit) return _hit;
|
|
2186
|
+
}
|
|
2187
|
+
} catch (err) {
|
|
2188
|
+
_iterator.e(err);
|
|
2189
|
+
} finally {
|
|
2190
|
+
_iterator.f();
|
|
2191
|
+
}
|
|
2192
|
+
var fromBaseUrl = aliases.baseUrlCandidate(source);
|
|
2193
|
+
var hit = fromBaseUrl && resolveProjectPath(fromBaseUrl);
|
|
2194
|
+
if (hit) return hit;
|
|
2195
|
+
}
|
|
2196
|
+
// An error, not a warning: rolldown would otherwise leave the
|
|
2197
|
+
// specifier as it is, and it would fail when imported, unnamed.
|
|
2198
|
+
throw new Error("'".concat(source, "' is not an available dependency. Available: ").concat([].concat(_toConsumableArray(Object.keys(target.base.modules)), _toConsumableArray(Object.keys(target.project.modules))).join(", "), "."));
|
|
2199
|
+
},
|
|
2200
|
+
load: function load(id) {
|
|
2201
|
+
return id in files ? files[id] : null;
|
|
2202
|
+
}
|
|
2203
|
+
}],
|
|
2204
|
+
transform: {
|
|
2205
|
+
jsx: {
|
|
2206
|
+
runtime: "automatic",
|
|
2207
|
+
importSource: "react"
|
|
2208
|
+
}
|
|
2209
|
+
},
|
|
2210
|
+
output: {
|
|
2211
|
+
format: "esm",
|
|
2212
|
+
minify: false,
|
|
2213
|
+
// One module: `def: () => import("./x.val")` stays a dynamic import of
|
|
2214
|
+
// something already in the file.
|
|
2215
|
+
codeSplitting: false
|
|
2216
|
+
},
|
|
2217
|
+
write: false
|
|
2218
|
+
});
|
|
2219
|
+
case 4:
|
|
2220
|
+
result = _context.v;
|
|
2221
|
+
_context.n = 6;
|
|
2222
|
+
break;
|
|
2223
|
+
case 5:
|
|
2224
|
+
_context.p = 5;
|
|
2225
|
+
_t = _context.v;
|
|
2226
|
+
throw new Error(["The Val modules could not be bundled."].concat(warnings, [_t instanceof Error ? _t.message : String(_t)]).join("\n"), {
|
|
2227
|
+
cause: _t
|
|
2228
|
+
});
|
|
2229
|
+
case 6:
|
|
2230
|
+
chunks = result.output.filter(function (output) {
|
|
2231
|
+
return output.type === "chunk";
|
|
2232
|
+
});
|
|
2233
|
+
if (!(chunks.length !== 1)) {
|
|
2234
|
+
_context.n = 7;
|
|
2235
|
+
break;
|
|
2236
|
+
}
|
|
2237
|
+
throw new Error("Bundling the Val modules made ".concat(chunks.length, " chunks rather than one."));
|
|
2238
|
+
case 7:
|
|
2239
|
+
return _context.a(2, {
|
|
2240
|
+
code: chunks[0].code
|
|
2241
|
+
});
|
|
2242
|
+
}
|
|
2243
|
+
}, _callee, null, [[3, 5]]);
|
|
2244
|
+
}));
|
|
2245
|
+
return _bundleValModules.apply(this, arguments);
|
|
2246
|
+
}
|
|
2247
|
+
function valModulesEntry(_x2, _x3, _x4) {
|
|
2248
|
+
return _valModulesEntry.apply(this, arguments);
|
|
2249
|
+
}
|
|
2250
|
+
function _valModulesEntry() {
|
|
2251
|
+
_valModulesEntry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input, build, warnings) {
|
|
2252
|
+
var entry, _yield$bundleValModul, code, _t2;
|
|
2253
|
+
return _regenerator().w(function (_context2) {
|
|
2254
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
2255
|
+
case 0:
|
|
2256
|
+
entry = ["val.modules.ts", "val.modules.js"].find(function (path) {
|
|
2257
|
+
return path in input.files;
|
|
2258
|
+
});
|
|
2259
|
+
if (!(entry === undefined)) {
|
|
2260
|
+
_context2.n = 1;
|
|
2261
|
+
break;
|
|
2262
|
+
}
|
|
2263
|
+
return _context2.a(2, {});
|
|
2264
|
+
case 1:
|
|
2265
|
+
_context2.p = 1;
|
|
2266
|
+
_context2.n = 2;
|
|
2267
|
+
return bundleValModules({
|
|
2268
|
+
files: input.files,
|
|
2269
|
+
target: input.target,
|
|
2270
|
+
// Root-relative, as the client bundle names its vendor chunks: the
|
|
2271
|
+
// entry is served on the site's own origin.
|
|
2272
|
+
origin: "",
|
|
2273
|
+
entry: entry
|
|
2274
|
+
});
|
|
2275
|
+
case 2:
|
|
2276
|
+
_yield$bundleValModul = _context2.v;
|
|
2277
|
+
code = _yield$bundleValModul.code;
|
|
2278
|
+
return _context2.a(2, _defineProperty({}, valModulesEntryFile(build), code));
|
|
2279
|
+
case 3:
|
|
2280
|
+
_context2.p = 3;
|
|
2281
|
+
_t2 = _context2.v;
|
|
2282
|
+
warnings.push("The Val modules were not emitted for the Studio, so an open Studio reloads the page to take this build's code: ".concat(_t2 instanceof Error ? _t2.message : String(_t2)));
|
|
2283
|
+
return _context2.a(2, {});
|
|
2284
|
+
}
|
|
2285
|
+
}, _callee2, null, [[1, 3]]);
|
|
2286
|
+
}));
|
|
2287
|
+
return _valModulesEntry.apply(this, arguments);
|
|
2288
|
+
}
|
|
2289
|
+
|
|
1879
2290
|
/** Cheap pre-filter: skip the parse unless one of these appears in the source. */
|
|
1880
2291
|
var MARKERS = ["createIsomorphicFn", "createServerOnlyFn", "createClientOnlyFn", "createMiddleware", "ClientOnly"];
|
|
1881
2292
|
|
|
@@ -2737,202 +3148,21 @@ function _transformRouteNodes() {
|
|
|
2737
3148
|
_iterator.f();
|
|
2738
3149
|
}
|
|
2739
3150
|
if (doomed.size) edits.push.apply(edits, _toConsumableArray(deleteProperties(code, properties, doomed)));
|
|
2740
|
-
});
|
|
2741
|
-
if (!(edits.length === 0)) {
|
|
2742
|
-
_context.n = 5;
|
|
2743
|
-
break;
|
|
2744
|
-
}
|
|
2745
|
-
return _context.a(2, null);
|
|
2746
|
-
case 5:
|
|
2747
|
-
return _context.a(2, {
|
|
2748
|
-
code: applyEdits(code, edits),
|
|
2749
|
-
removed: removed
|
|
2750
|
-
});
|
|
2751
|
-
}
|
|
2752
|
-
}, _callee);
|
|
2753
|
-
}));
|
|
2754
|
-
return _transformRouteNodes.apply(this, arguments);
|
|
2755
|
-
}
|
|
2756
|
-
|
|
2757
|
-
/**
|
|
2758
|
-
* JSON with comments and trailing commas, which is what tsconfig.json is.
|
|
2759
|
-
*
|
|
2760
|
-
* Written as a scanner rather than a regex on purpose: `"url": "https://x"`
|
|
2761
|
-
* contains `//`, and a regex that strips comments without tracking string state
|
|
2762
|
-
* truncates the file there and throws a parse error pointing at the wrong line.
|
|
2763
|
-
*/
|
|
2764
|
-
function parseJsonc(text) {
|
|
2765
|
-
var out = "";
|
|
2766
|
-
var i = 0;
|
|
2767
|
-
while (i < text.length) {
|
|
2768
|
-
var ch = text[i];
|
|
2769
|
-
if (ch === '"') {
|
|
2770
|
-
// Copy the whole string literal, escapes included, untouched.
|
|
2771
|
-
out += ch;
|
|
2772
|
-
i++;
|
|
2773
|
-
while (i < text.length) {
|
|
2774
|
-
var c = text[i];
|
|
2775
|
-
out += c;
|
|
2776
|
-
i++;
|
|
2777
|
-
if (c === "\\") {
|
|
2778
|
-
if (i < text.length) out += text[i++];
|
|
2779
|
-
continue;
|
|
2780
|
-
}
|
|
2781
|
-
if (c === '"') break;
|
|
2782
|
-
}
|
|
2783
|
-
continue;
|
|
2784
|
-
}
|
|
2785
|
-
if (ch === "/" && text[i + 1] === "/") {
|
|
2786
|
-
while (i < text.length && text[i] !== "\n") i++;
|
|
2787
|
-
continue;
|
|
2788
|
-
}
|
|
2789
|
-
if (ch === "/" && text[i + 1] === "*") {
|
|
2790
|
-
i += 2;
|
|
2791
|
-
while (i < text.length && !(text[i] === "*" && text[i + 1] === "/")) i++;
|
|
2792
|
-
i += 2;
|
|
2793
|
-
continue;
|
|
2794
|
-
}
|
|
2795
|
-
out += ch;
|
|
2796
|
-
i++;
|
|
2797
|
-
}
|
|
2798
|
-
// Trailing commas, now that every remaining comma is structural.
|
|
2799
|
-
return JSON.parse(out.replace(/,(\s*[}\]])/g, "$1"));
|
|
2800
|
-
}
|
|
2801
|
-
|
|
2802
|
-
/** One `paths` entry, pre-split on its wildcard. */
|
|
2803
|
-
|
|
2804
|
-
/**
|
|
2805
|
-
* Reads tsconfig.json out of the file record and builds the matcher.
|
|
2806
|
-
*
|
|
2807
|
-
* Returns null when the project configures no aliases, which is the common
|
|
2808
|
-
* case and costs nothing.
|
|
2809
|
-
*/
|
|
2810
|
-
function aliasMap(files, warn) {
|
|
2811
|
-
var _config$compilerOptio, _config$compilerOptio2;
|
|
2812
|
-
var entry = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "tsconfig.json";
|
|
2813
|
-
var config = readConfig(files, entry, warn, new Set());
|
|
2814
|
-
var paths = config === null || config === void 0 || (_config$compilerOptio = config.compilerOptions) === null || _config$compilerOptio === void 0 ? void 0 : _config$compilerOptio.paths;
|
|
2815
|
-
var baseUrl = config === null || config === void 0 || (_config$compilerOptio2 = config.compilerOptions) === null || _config$compilerOptio2 === void 0 ? void 0 : _config$compilerOptio2.baseUrl;
|
|
2816
|
-
// A project can configure either one without the other, and baseUrl alone is
|
|
2817
|
-
// enough to change how a bare specifier resolves.
|
|
2818
|
-
if ((!paths || Object.keys(paths).length === 0) && baseUrl === undefined) return null;
|
|
2819
|
-
|
|
2820
|
-
// `baseUrl` is relative to the tsconfig that declared it. Since TS 4.1 paths
|
|
2821
|
-
// work without one, resolved against the tsconfig's own directory -- so the
|
|
2822
|
-
// fallback here is the directory, not the project root.
|
|
2823
|
-
var base = resolve(dirname(entry), baseUrl !== null && baseUrl !== void 0 ? baseUrl : ".");
|
|
2824
|
-
var patterns = [];
|
|
2825
|
-
for (var _i = 0, _Object$entries = Object.entries(paths !== null && paths !== void 0 ? paths : {}); _i < _Object$entries.length; _i++) {
|
|
2826
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
2827
|
-
pattern = _Object$entries$_i[0],
|
|
2828
|
-
targets = _Object$entries$_i[1];
|
|
2829
|
-
var star = pattern.indexOf("*");
|
|
2830
|
-
if (star !== pattern.lastIndexOf("*")) {
|
|
2831
|
-
warn("tsconfig paths pattern '".concat(pattern, "' has more than one '*' and is ignored."));
|
|
2832
|
-
continue;
|
|
2833
|
-
}
|
|
2834
|
-
patterns.push({
|
|
2835
|
-
prefix: star === -1 ? pattern : pattern.slice(0, star),
|
|
2836
|
-
suffix: star === -1 ? "" : pattern.slice(star + 1),
|
|
2837
|
-
wildcard: star !== -1,
|
|
2838
|
-
targets: targets.map(function (target) {
|
|
2839
|
-
return resolve(base, target);
|
|
2840
|
-
})
|
|
2841
|
-
});
|
|
2842
|
-
}
|
|
2843
|
-
|
|
2844
|
-
// TypeScript picks the pattern with the longest literal prefix, so `@/ui/*`
|
|
2845
|
-
// beats `@/*` for `@/ui/card` regardless of declaration order.
|
|
2846
|
-
patterns.sort(function (a, b) {
|
|
2847
|
-
return b.prefix.length - a.prefix.length;
|
|
2848
|
-
});
|
|
2849
|
-
return {
|
|
2850
|
-
patterns: Object.keys(paths !== null && paths !== void 0 ? paths : {}),
|
|
2851
|
-
baseUrlCandidate: function baseUrlCandidate(specifier) {
|
|
2852
|
-
return baseUrl === undefined ? null : resolve(base, specifier);
|
|
2853
|
-
},
|
|
2854
|
-
candidates: function candidates(specifier) {
|
|
2855
|
-
var _loop = function _loop() {
|
|
2856
|
-
var pattern = _patterns[_i2];
|
|
2857
|
-
if (!pattern.wildcard) {
|
|
2858
|
-
if (specifier === pattern.prefix) return {
|
|
2859
|
-
v: _toConsumableArray(pattern.targets)
|
|
2860
|
-
};
|
|
2861
|
-
return 0; // continue
|
|
2862
|
-
}
|
|
2863
|
-
if (!specifier.startsWith(pattern.prefix) || !specifier.endsWith(pattern.suffix) || specifier.length < pattern.prefix.length + pattern.suffix.length) {
|
|
2864
|
-
return 0; // continue
|
|
3151
|
+
});
|
|
3152
|
+
if (!(edits.length === 0)) {
|
|
3153
|
+
_context.n = 5;
|
|
3154
|
+
break;
|
|
2865
3155
|
}
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
};
|
|
2872
|
-
},
|
|
2873
|
-
_ret;
|
|
2874
|
-
for (var _i2 = 0, _patterns = patterns; _i2 < _patterns.length; _i2++) {
|
|
2875
|
-
_ret = _loop();
|
|
2876
|
-
if (_ret === 0) continue;
|
|
2877
|
-
if (_ret) return _ret.v;
|
|
3156
|
+
return _context.a(2, null);
|
|
3157
|
+
case 5:
|
|
3158
|
+
return _context.a(2, {
|
|
3159
|
+
code: applyEdits(code, edits),
|
|
3160
|
+
removed: removed
|
|
3161
|
+
});
|
|
2878
3162
|
}
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
}
|
|
2883
|
-
|
|
2884
|
-
/** Follows `extends` through the file record. Package extends cannot be read. */
|
|
2885
|
-
function readConfig(files, path, warn, seen) {
|
|
2886
|
-
var _config, _config$compilerOptio4, _config$compilerOptio5, _parent$compilerOptio;
|
|
2887
|
-
if (seen.has(path)) return null; // a cycle; whatever we have is enough
|
|
2888
|
-
seen.add(path);
|
|
2889
|
-
var text = files[path];
|
|
2890
|
-
if (text === undefined) return null;
|
|
2891
|
-
var config;
|
|
2892
|
-
try {
|
|
2893
|
-
config = parseJsonc(text);
|
|
2894
|
-
} catch (error) {
|
|
2895
|
-
var _message;
|
|
2896
|
-
warn("Could not parse ".concat(path, ": ").concat(String((_message = error === null || error === void 0 ? void 0 : error.message) !== null && _message !== void 0 ? _message : error)));
|
|
2897
|
-
return null;
|
|
2898
|
-
}
|
|
2899
|
-
if (!((_config = config) !== null && _config !== void 0 && _config["extends"])) return config;
|
|
2900
|
-
|
|
2901
|
-
// Only a relative extends can be followed: a package one ("extends":
|
|
2902
|
-
// "@tsconfig/node20/tsconfig.json") lives in node_modules, which a browser
|
|
2903
|
-
// build does not have. Worth saying out loud rather than silently resolving
|
|
2904
|
-
// half the aliases, because the base config is where a monorepo usually puts
|
|
2905
|
-
// them.
|
|
2906
|
-
if (!config["extends"].startsWith(".")) {
|
|
2907
|
-
var _config$compilerOptio3;
|
|
2908
|
-
if (!((_config$compilerOptio3 = config.compilerOptions) !== null && _config$compilerOptio3 !== void 0 && _config$compilerOptio3.paths)) {
|
|
2909
|
-
warn("".concat(path, " extends '").concat(config["extends"], "', which is a package and cannot be read here. ") + "Any 'paths' it declares will not apply -- declare them in ".concat(path, " instead."));
|
|
2910
|
-
}
|
|
2911
|
-
return config;
|
|
2912
|
-
}
|
|
2913
|
-
var parentPath = resolveConfigPath(files, resolve(dirname(path), config["extends"]));
|
|
2914
|
-
var parent = parentPath ? readConfig(files, parentPath, warn, seen) : null;
|
|
2915
|
-
if (!parent) return config;
|
|
2916
|
-
|
|
2917
|
-
// The child wins, and `paths` replaces rather than merges -- which is what
|
|
2918
|
-
// TypeScript does.
|
|
2919
|
-
return {
|
|
2920
|
-
compilerOptions: _objectSpread2(_objectSpread2(_objectSpread2({}, parent.compilerOptions), config.compilerOptions), {}, {
|
|
2921
|
-
// baseUrl in the parent was relative to the *parent*, and readConfig
|
|
2922
|
-
// returns it unresolved, so a parent baseUrl with a child that sets none
|
|
2923
|
-
// is the one case this gets wrong. Rare enough to name rather than model.
|
|
2924
|
-
paths: (_config$compilerOptio4 = (_config$compilerOptio5 = config.compilerOptions) === null || _config$compilerOptio5 === void 0 ? void 0 : _config$compilerOptio5.paths) !== null && _config$compilerOptio4 !== void 0 ? _config$compilerOptio4 : (_parent$compilerOptio = parent.compilerOptions) === null || _parent$compilerOptio === void 0 ? void 0 : _parent$compilerOptio.paths
|
|
2925
|
-
})
|
|
2926
|
-
};
|
|
2927
|
-
}
|
|
2928
|
-
|
|
2929
|
-
/** `extends: './base'` may omit the .json. */
|
|
2930
|
-
function resolveConfigPath(files, path) {
|
|
2931
|
-
for (var _i3 = 0, _arr = [path, "".concat(path, ".json")]; _i3 < _arr.length; _i3++) {
|
|
2932
|
-
var candidate = _arr[_i3];
|
|
2933
|
-
if (candidate in files) return candidate;
|
|
2934
|
-
}
|
|
2935
|
-
return null;
|
|
3163
|
+
}, _callee);
|
|
3164
|
+
}));
|
|
3165
|
+
return _transformRouteNodes.apply(this, arguments);
|
|
2936
3166
|
}
|
|
2937
3167
|
|
|
2938
3168
|
// autoCodeSplitting.
|
|
@@ -4001,7 +4231,7 @@ function buildUserApp(_x6) {
|
|
|
4001
4231
|
function _buildUserApp() {
|
|
4002
4232
|
_buildUserApp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(input) {
|
|
4003
4233
|
var _input$target$project;
|
|
4004
|
-
var warnings, started, rev, clientModules, assetUrls, assetFiles, _i3, _Object$entries3, _input$assets2, _Object$entries3$_i, path, base64, resolved, aliases, css, styles, tailwindMs, compiled, serverStarted, serverBuild, server, clientStarted, clientBuild, client, rscBuild, publicFiles, _i4, _Object$entries4, _input$publicFiles, _Object$entries4$_i, _path, _base, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16;
|
|
4234
|
+
var warnings, started, rev, clientModules, assetUrls, assetFiles, _i3, _Object$entries3, _input$assets2, _Object$entries3$_i, path, base64, resolved, aliases, css, styles, tailwindMs, compiled, serverStarted, serverBuild, server, clientStarted, clientBuild, client, hash, registryEntry, rscBuild, publicFiles, _i4, _Object$entries4, _input$publicFiles, _Object$entries4$_i, _path, _base, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16;
|
|
4005
4235
|
return _regenerator().w(function (_context3) {
|
|
4006
4236
|
while (1) switch (_context3.n) {
|
|
4007
4237
|
case 0:
|
|
@@ -4101,14 +4331,27 @@ function _buildUserApp() {
|
|
|
4101
4331
|
return buildOnce(input, "/_vendor/", "/_pvendor/".concat(rev, "/"), "client", warnings, clientModules, false, assetUrls, css.modules, aliases);
|
|
4102
4332
|
case 12:
|
|
4103
4333
|
clientBuild = _context3.v;
|
|
4104
|
-
client = performance.now() - clientStarted;
|
|
4105
|
-
|
|
4106
|
-
|
|
4334
|
+
client = performance.now() - clientStarted;
|
|
4335
|
+
/*
|
|
4336
|
+
* The build's `val.modules` registry, as an ES module of its own beside
|
|
4337
|
+
* the client chunks and named after the build: what a Studio opened on an
|
|
4338
|
+
* older build imports to take this one's code in, rather than reloading
|
|
4339
|
+
* the page (`valModulesEntry`). The build's name is a hash of its inputs,
|
|
4340
|
+
* so it is known before anything is emitted.
|
|
4341
|
+
*/
|
|
4342
|
+
_context3.n = 13;
|
|
4343
|
+
return buildInputId(input);
|
|
4344
|
+
case 13:
|
|
4345
|
+
hash = _context3.v;
|
|
4346
|
+
_context3.n = 14;
|
|
4347
|
+
return valModulesEntry(input, hash, warnings);
|
|
4348
|
+
case 14:
|
|
4349
|
+
registryEntry = _context3.v;
|
|
4107
4350
|
if (!input.rsc) {
|
|
4108
|
-
_context3.n =
|
|
4351
|
+
_context3.n = 16;
|
|
4109
4352
|
break;
|
|
4110
4353
|
}
|
|
4111
|
-
_context3.n =
|
|
4354
|
+
_context3.n = 15;
|
|
4112
4355
|
return buildOnce(
|
|
4113
4356
|
// `../pvendor/`, with no revision segment: the revision belongs in the
|
|
4114
4357
|
// browser URL, where it buys immutable caching. Inside the module map
|
|
@@ -4116,13 +4359,13 @@ function _buildUserApp() {
|
|
|
4116
4359
|
// revision here is a path segment that does not exist -- and the cold
|
|
4117
4360
|
// isolate is where you would find that out.
|
|
4118
4361
|
input, "../vendor-rsc/", "../pvendor/", "server", warnings, clientModules, true, assetUrls, css.modules, aliases);
|
|
4119
|
-
case
|
|
4362
|
+
case 15:
|
|
4120
4363
|
_t2 = _context3.v;
|
|
4121
|
-
_context3.n =
|
|
4364
|
+
_context3.n = 17;
|
|
4122
4365
|
break;
|
|
4123
|
-
case
|
|
4366
|
+
case 16:
|
|
4124
4367
|
_t2 = undefined;
|
|
4125
|
-
case
|
|
4368
|
+
case 17:
|
|
4126
4369
|
rscBuild = _t2;
|
|
4127
4370
|
// Stripped of the `public/` prefix here rather than at every consumer: the
|
|
4128
4371
|
// prefix is a convention of the project layout, and what the loader needs is
|
|
@@ -4135,7 +4378,7 @@ function _buildUserApp() {
|
|
|
4135
4378
|
_t3 = serverBuild.code;
|
|
4136
4379
|
_t4 = clientBuild.code;
|
|
4137
4380
|
_t5 = serverBuild.chunks;
|
|
4138
|
-
_t6 = clientBuild.chunks;
|
|
4381
|
+
_t6 = _objectSpread2(_objectSpread2({}, clientBuild.chunks), registryEntry);
|
|
4139
4382
|
_t7 = assetFiles;
|
|
4140
4383
|
_t8 = publicFiles;
|
|
4141
4384
|
_t9 = styles;
|
|
@@ -4146,15 +4389,12 @@ function _buildUserApp() {
|
|
|
4146
4389
|
_t10 = rscBuild === null || rscBuild === void 0 ? void 0 : rscBuild.chunks;
|
|
4147
4390
|
_t11 = input.rsc ? clientModules : undefined;
|
|
4148
4391
|
_t12 = input.target.base.rev;
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
case 16:
|
|
4152
|
-
_t13 = _context3.v;
|
|
4153
|
-
_context3.n = 17;
|
|
4392
|
+
_t13 = hash;
|
|
4393
|
+
_context3.n = 18;
|
|
4154
4394
|
return sha256Hex([input.target.base.rev, rev, styles].concat(_toConsumableArray(Object.entries(assetFiles).flat()), _toConsumableArray(Object.entries(publicFiles).flat()), _toConsumableArray([serverBuild, clientBuild, rscBuild].flatMap(function (built) {
|
|
4155
4395
|
return built ? [built.code].concat(_toConsumableArray(Object.entries(built.chunks).flat())) : [];
|
|
4156
|
-
}))).join("\0"));
|
|
4157
|
-
case
|
|
4396
|
+
})), _toConsumableArray(Object.entries(registryEntry).flat())).join("\0"));
|
|
4397
|
+
case 18:
|
|
4158
4398
|
_t14 = _context3.v.slice(0, 32);
|
|
4159
4399
|
_t15 = {
|
|
4160
4400
|
server: server,
|
|
@@ -4611,158 +4851,4 @@ function treeShaOfText(files) {
|
|
|
4611
4851
|
})));
|
|
4612
4852
|
}
|
|
4613
4853
|
|
|
4614
|
-
/**
|
|
4615
|
-
* A project's `val.modules.ts`, bundled to run: every `.val.ts` it imports,
|
|
4616
|
-
* the `val.config` they share and the `.val.json` entries they name, as ONE
|
|
4617
|
-
* ES module -- so it can be imported from a `blob:` URL, which cannot resolve
|
|
4618
|
-
* a relative chunk -- with every npm import pointing at the site's own
|
|
4619
|
-
* vendor chunks, at absolute URLs under `origin`.
|
|
4620
|
-
*
|
|
4621
|
-
* What the builder tab evaluates to learn a tree's schemas: Update from the
|
|
4622
|
-
* site with code (valbuild/home `docs/hosted-publishing.md` step 8.2, slice
|
|
4623
|
-
* 1b). The project's own `@valbuild/*` and dependencies are what run, as the
|
|
4624
|
-
* site runs them -- the browser half of its layer, from `/_pvendor/<rev>/`,
|
|
4625
|
-
* and the base layer from `/_vendor/`. Whoever imports it should do so off
|
|
4626
|
-
* the Studio's page: `@valbuild/tanstack` brings React and patches its JSX.
|
|
4627
|
-
*
|
|
4628
|
-
* Nothing else of a build happens here: no route splitting, no server
|
|
4629
|
-
* functions, no CSS -- a `.val.ts` has none of it.
|
|
4630
|
-
*/
|
|
4631
|
-
function bundleValModules(_x) {
|
|
4632
|
-
return _bundleValModules.apply(this, arguments);
|
|
4633
|
-
}
|
|
4634
|
-
function _bundleValModules() {
|
|
4635
|
-
_bundleValModules = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(input) {
|
|
4636
|
-
var _input$entry;
|
|
4637
|
-
var files, target, origin, entry, warnings, aliases, base, project, resolveProjectPath, _yield$loadRolldown, build, result, chunks, _t;
|
|
4638
|
-
return _regenerator().w(function (_context) {
|
|
4639
|
-
while (1) switch (_context.p = _context.n) {
|
|
4640
|
-
case 0:
|
|
4641
|
-
files = input.files, target = input.target, origin = input.origin;
|
|
4642
|
-
entry = (_input$entry = input.entry) !== null && _input$entry !== void 0 ? _input$entry : ["val.modules.ts", "val.modules.js"].find(function (path) {
|
|
4643
|
-
return path in files;
|
|
4644
|
-
});
|
|
4645
|
-
if (!(entry === undefined || !(entry in files))) {
|
|
4646
|
-
_context.n = 1;
|
|
4647
|
-
break;
|
|
4648
|
-
}
|
|
4649
|
-
throw new Error("This project has no val.modules.ts, so its Val modules cannot be read.");
|
|
4650
|
-
case 1:
|
|
4651
|
-
warnings = [];
|
|
4652
|
-
aliases = aliasMap(files, function (message) {
|
|
4653
|
-
return warnings.push(message);
|
|
4654
|
-
});
|
|
4655
|
-
base = "".concat(origin, "/_vendor/");
|
|
4656
|
-
project = target.project.rev === null ? null : "".concat(origin, "/_pvendor/").concat(target.project.rev, "/");
|
|
4657
|
-
resolveProjectPath = function resolveProjectPath(path) {
|
|
4658
|
-
return resolveInFiles(path, files);
|
|
4659
|
-
};
|
|
4660
|
-
_context.n = 2;
|
|
4661
|
-
return loadRolldown();
|
|
4662
|
-
case 2:
|
|
4663
|
-
_yield$loadRolldown = _context.v;
|
|
4664
|
-
build = _yield$loadRolldown.build;
|
|
4665
|
-
_context.p = 3;
|
|
4666
|
-
_context.n = 4;
|
|
4667
|
-
return build({
|
|
4668
|
-
input: entry,
|
|
4669
|
-
// See `buildOnce`: required in the browser, inert here.
|
|
4670
|
-
cwd: "/",
|
|
4671
|
-
moduleTypes: {
|
|
4672
|
-
".css": "empty"
|
|
4673
|
-
},
|
|
4674
|
-
plugins: [{
|
|
4675
|
-
name: "val:modules",
|
|
4676
|
-
resolveId: function resolveId(source, importer) {
|
|
4677
|
-
if (source.startsWith(".")) {
|
|
4678
|
-
return resolveProjectPath(resolve(dirname(importer !== null && importer !== void 0 ? importer : entry), source));
|
|
4679
|
-
}
|
|
4680
|
-
if (source in files) return source;
|
|
4681
|
-
var baseChunk = target.base.modules[source];
|
|
4682
|
-
if (baseChunk) {
|
|
4683
|
-
return {
|
|
4684
|
-
id: "".concat(base).concat(baseChunk, ".js"),
|
|
4685
|
-
external: true
|
|
4686
|
-
};
|
|
4687
|
-
}
|
|
4688
|
-
var projectChunk = target.project.modules[source];
|
|
4689
|
-
if (projectChunk && project !== null) {
|
|
4690
|
-
if (target.project.workerOnly.includes(source)) {
|
|
4691
|
-
throw new Error("'".concat(source, "' is server-only in this project's vendor layer, so a .val.ts importing it cannot be read in the browser."));
|
|
4692
|
-
}
|
|
4693
|
-
return {
|
|
4694
|
-
id: "".concat(project).concat(projectChunk, ".js"),
|
|
4695
|
-
external: true
|
|
4696
|
-
};
|
|
4697
|
-
}
|
|
4698
|
-
if (aliases) {
|
|
4699
|
-
var _iterator = _createForOfIteratorHelper(aliases.candidates(source)),
|
|
4700
|
-
_step;
|
|
4701
|
-
try {
|
|
4702
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
4703
|
-
var candidate = _step.value;
|
|
4704
|
-
var _hit = resolveProjectPath(candidate);
|
|
4705
|
-
if (_hit) return _hit;
|
|
4706
|
-
}
|
|
4707
|
-
} catch (err) {
|
|
4708
|
-
_iterator.e(err);
|
|
4709
|
-
} finally {
|
|
4710
|
-
_iterator.f();
|
|
4711
|
-
}
|
|
4712
|
-
var fromBaseUrl = aliases.baseUrlCandidate(source);
|
|
4713
|
-
var hit = fromBaseUrl && resolveProjectPath(fromBaseUrl);
|
|
4714
|
-
if (hit) return hit;
|
|
4715
|
-
}
|
|
4716
|
-
// An error, not a warning: rolldown would otherwise leave the
|
|
4717
|
-
// specifier as it is, and it would fail when imported, unnamed.
|
|
4718
|
-
throw new Error("'".concat(source, "' is not an available dependency. Available: ").concat([].concat(_toConsumableArray(Object.keys(target.base.modules)), _toConsumableArray(Object.keys(target.project.modules))).join(", "), "."));
|
|
4719
|
-
},
|
|
4720
|
-
load: function load(id) {
|
|
4721
|
-
return id in files ? files[id] : null;
|
|
4722
|
-
}
|
|
4723
|
-
}],
|
|
4724
|
-
transform: {
|
|
4725
|
-
jsx: {
|
|
4726
|
-
runtime: "automatic",
|
|
4727
|
-
importSource: "react"
|
|
4728
|
-
}
|
|
4729
|
-
},
|
|
4730
|
-
output: {
|
|
4731
|
-
format: "esm",
|
|
4732
|
-
minify: false,
|
|
4733
|
-
// One module: `def: () => import("./x.val")` stays a dynamic import of
|
|
4734
|
-
// something already in the file.
|
|
4735
|
-
codeSplitting: false
|
|
4736
|
-
},
|
|
4737
|
-
write: false
|
|
4738
|
-
});
|
|
4739
|
-
case 4:
|
|
4740
|
-
result = _context.v;
|
|
4741
|
-
_context.n = 6;
|
|
4742
|
-
break;
|
|
4743
|
-
case 5:
|
|
4744
|
-
_context.p = 5;
|
|
4745
|
-
_t = _context.v;
|
|
4746
|
-
throw new Error(["The Val modules could not be bundled."].concat(warnings, [_t instanceof Error ? _t.message : String(_t)]).join("\n"), {
|
|
4747
|
-
cause: _t
|
|
4748
|
-
});
|
|
4749
|
-
case 6:
|
|
4750
|
-
chunks = result.output.filter(function (output) {
|
|
4751
|
-
return output.type === "chunk";
|
|
4752
|
-
});
|
|
4753
|
-
if (!(chunks.length !== 1)) {
|
|
4754
|
-
_context.n = 7;
|
|
4755
|
-
break;
|
|
4756
|
-
}
|
|
4757
|
-
throw new Error("Bundling the Val modules made ".concat(chunks.length, " chunks rather than one."));
|
|
4758
|
-
case 7:
|
|
4759
|
-
return _context.a(2, {
|
|
4760
|
-
code: chunks[0].code
|
|
4761
|
-
});
|
|
4762
|
-
}
|
|
4763
|
-
}, _callee, null, [[3, 5]]);
|
|
4764
|
-
}));
|
|
4765
|
-
return _bundleValModules.apply(this, arguments);
|
|
4766
|
-
}
|
|
4767
|
-
|
|
4768
4854
|
export { ENTRY_CHUNK, PROJECT_SOURCE, PUBLIC_PREFIX, VAL_SERVER_PATH, aliasMap, bakedGit, bakedJob, blobSha, buildInputId, buildUserApp, bundleValModules, fetchBuildTarget, fetchBuildTargetRev, isValProject, isWired, loadRolldown, publishArtifacts, publishPayload, rebakeGit, resolveInFiles, scanCandidates, treeSha, treeShaOfText, useRolldown, usesTailwind, wireUp, wiredValServer, withoutBakedJob };
|