@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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var regeneratorValues = require('./regeneratorValues-eb61e1b2.cjs.prod.js');
|
|
6
|
-
var projectPaths = require('./projectPaths-
|
|
6
|
+
var projectPaths = require('./projectPaths-d08a9ea7.cjs.prod.js');
|
|
7
7
|
var tailwindcss = require('tailwindcss');
|
|
8
8
|
var artifactKeys = require('./artifactKeys-700b9044.cjs.prod.js');
|
|
9
9
|
|
|
@@ -1210,7 +1210,7 @@ var packageJson = {
|
|
|
1210
1210
|
url: "git+https://github.com/valbuild/val.git"
|
|
1211
1211
|
},
|
|
1212
1212
|
license: "MIT",
|
|
1213
|
-
version: "0.
|
|
1213
|
+
version: "0.151.0",
|
|
1214
1214
|
sideEffects: false,
|
|
1215
1215
|
main: "dist/valbuild-tanstack-build.cjs.js",
|
|
1216
1216
|
module: "dist/valbuild-tanstack-build.esm.js",
|
|
@@ -1374,7 +1374,14 @@ var LEGACY_CONTROL_HOST = "platform.internal";
|
|
|
1374
1374
|
* existed -- which is every project already published, since a build in a tab
|
|
1375
1375
|
* rewrites single lines of its `val.server.ts` and never regenerates it.
|
|
1376
1376
|
*/
|
|
1377
|
-
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
|
|
1377
|
+
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";
|
|
1378
|
+
/**
|
|
1379
|
+
* {@link PROPOSAL_BLOCK} as it was generated before it read which modules
|
|
1380
|
+
* are staged and what the build was made of: rewritten to the current block
|
|
1381
|
+
* by {@link rebakeProposal}, exactly, so a site wired before it learns both
|
|
1382
|
+
* at its next build. Never generated.
|
|
1383
|
+
*/
|
|
1384
|
+
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";
|
|
1378
1385
|
/**
|
|
1379
1386
|
* THE CONTENT VERSION the site serves, when it differs from the one this build
|
|
1380
1387
|
* bundles (\`VAL_CONTENT\`). See valbuild/home \`docs/hosted-publishing.md\`,
|
|
@@ -1486,6 +1493,14 @@ function bakedJob(files) {
|
|
|
1486
1493
|
* as it is, and serves a proposal's address as its base build.
|
|
1487
1494
|
*/
|
|
1488
1495
|
function rebakeProposal(source) {
|
|
1496
|
+
// A block from before staged code was read: the current one in its place,
|
|
1497
|
+
// where it is exactly as generated.
|
|
1498
|
+
var at = source.indexOf(PROPOSAL_BLOCK_V1);
|
|
1499
|
+
if (at !== -1 && source.indexOf(PROPOSAL_BLOCK_V1, at + 1) === -1) {
|
|
1500
|
+
return source.replace(PROPOSAL_BLOCK_V1, function () {
|
|
1501
|
+
return PROPOSAL_BLOCK;
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1489
1504
|
if (source.includes("const proposal = (() => {")) return source;
|
|
1490
1505
|
var once = function once(needle) {
|
|
1491
1506
|
var at = source.indexOf(needle);
|
|
@@ -1895,6 +1910,402 @@ function canonicalJson(value) {
|
|
|
1895
1910
|
return JSON.stringify(value);
|
|
1896
1911
|
}
|
|
1897
1912
|
|
|
1913
|
+
/**
|
|
1914
|
+
* JSON with comments and trailing commas, which is what tsconfig.json is.
|
|
1915
|
+
*
|
|
1916
|
+
* Written as a scanner rather than a regex on purpose: `"url": "https://x"`
|
|
1917
|
+
* contains `//`, and a regex that strips comments without tracking string state
|
|
1918
|
+
* truncates the file there and throws a parse error pointing at the wrong line.
|
|
1919
|
+
*/
|
|
1920
|
+
function parseJsonc(text) {
|
|
1921
|
+
var out = "";
|
|
1922
|
+
var i = 0;
|
|
1923
|
+
while (i < text.length) {
|
|
1924
|
+
var ch = text[i];
|
|
1925
|
+
if (ch === '"') {
|
|
1926
|
+
// Copy the whole string literal, escapes included, untouched.
|
|
1927
|
+
out += ch;
|
|
1928
|
+
i++;
|
|
1929
|
+
while (i < text.length) {
|
|
1930
|
+
var c = text[i];
|
|
1931
|
+
out += c;
|
|
1932
|
+
i++;
|
|
1933
|
+
if (c === "\\") {
|
|
1934
|
+
if (i < text.length) out += text[i++];
|
|
1935
|
+
continue;
|
|
1936
|
+
}
|
|
1937
|
+
if (c === '"') break;
|
|
1938
|
+
}
|
|
1939
|
+
continue;
|
|
1940
|
+
}
|
|
1941
|
+
if (ch === "/" && text[i + 1] === "/") {
|
|
1942
|
+
while (i < text.length && text[i] !== "\n") i++;
|
|
1943
|
+
continue;
|
|
1944
|
+
}
|
|
1945
|
+
if (ch === "/" && text[i + 1] === "*") {
|
|
1946
|
+
i += 2;
|
|
1947
|
+
while (i < text.length && !(text[i] === "*" && text[i + 1] === "/")) i++;
|
|
1948
|
+
i += 2;
|
|
1949
|
+
continue;
|
|
1950
|
+
}
|
|
1951
|
+
out += ch;
|
|
1952
|
+
i++;
|
|
1953
|
+
}
|
|
1954
|
+
// Trailing commas, now that every remaining comma is structural.
|
|
1955
|
+
return JSON.parse(out.replace(/,(\s*[}\]])/g, "$1"));
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
/** One `paths` entry, pre-split on its wildcard. */
|
|
1959
|
+
|
|
1960
|
+
/**
|
|
1961
|
+
* Reads tsconfig.json out of the file record and builds the matcher.
|
|
1962
|
+
*
|
|
1963
|
+
* Returns null when the project configures no aliases, which is the common
|
|
1964
|
+
* case and costs nothing.
|
|
1965
|
+
*/
|
|
1966
|
+
function aliasMap(files, warn) {
|
|
1967
|
+
var _config$compilerOptio, _config$compilerOptio2;
|
|
1968
|
+
var entry = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "tsconfig.json";
|
|
1969
|
+
var config = readConfig(files, entry, warn, new Set());
|
|
1970
|
+
var paths = config === null || config === void 0 || (_config$compilerOptio = config.compilerOptions) === null || _config$compilerOptio === void 0 ? void 0 : _config$compilerOptio.paths;
|
|
1971
|
+
var baseUrl = config === null || config === void 0 || (_config$compilerOptio2 = config.compilerOptions) === null || _config$compilerOptio2 === void 0 ? void 0 : _config$compilerOptio2.baseUrl;
|
|
1972
|
+
// A project can configure either one without the other, and baseUrl alone is
|
|
1973
|
+
// enough to change how a bare specifier resolves.
|
|
1974
|
+
if ((!paths || Object.keys(paths).length === 0) && baseUrl === undefined) return null;
|
|
1975
|
+
|
|
1976
|
+
// `baseUrl` is relative to the tsconfig that declared it. Since TS 4.1 paths
|
|
1977
|
+
// work without one, resolved against the tsconfig's own directory -- so the
|
|
1978
|
+
// fallback here is the directory, not the project root.
|
|
1979
|
+
var base = resolve(dirname(entry), baseUrl !== null && baseUrl !== void 0 ? baseUrl : ".");
|
|
1980
|
+
var patterns = [];
|
|
1981
|
+
for (var _i = 0, _Object$entries = Object.entries(paths !== null && paths !== void 0 ? paths : {}); _i < _Object$entries.length; _i++) {
|
|
1982
|
+
var _Object$entries$_i = regeneratorValues._slicedToArray(_Object$entries[_i], 2),
|
|
1983
|
+
pattern = _Object$entries$_i[0],
|
|
1984
|
+
targets = _Object$entries$_i[1];
|
|
1985
|
+
var star = pattern.indexOf("*");
|
|
1986
|
+
if (star !== pattern.lastIndexOf("*")) {
|
|
1987
|
+
warn("tsconfig paths pattern '".concat(pattern, "' has more than one '*' and is ignored."));
|
|
1988
|
+
continue;
|
|
1989
|
+
}
|
|
1990
|
+
patterns.push({
|
|
1991
|
+
prefix: star === -1 ? pattern : pattern.slice(0, star),
|
|
1992
|
+
suffix: star === -1 ? "" : pattern.slice(star + 1),
|
|
1993
|
+
wildcard: star !== -1,
|
|
1994
|
+
targets: targets.map(function (target) {
|
|
1995
|
+
return resolve(base, target);
|
|
1996
|
+
})
|
|
1997
|
+
});
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
// TypeScript picks the pattern with the longest literal prefix, so `@/ui/*`
|
|
2001
|
+
// beats `@/*` for `@/ui/card` regardless of declaration order.
|
|
2002
|
+
patterns.sort(function (a, b) {
|
|
2003
|
+
return b.prefix.length - a.prefix.length;
|
|
2004
|
+
});
|
|
2005
|
+
return {
|
|
2006
|
+
patterns: Object.keys(paths !== null && paths !== void 0 ? paths : {}),
|
|
2007
|
+
baseUrlCandidate: function baseUrlCandidate(specifier) {
|
|
2008
|
+
return baseUrl === undefined ? null : resolve(base, specifier);
|
|
2009
|
+
},
|
|
2010
|
+
candidates: function candidates(specifier) {
|
|
2011
|
+
var _loop = function _loop() {
|
|
2012
|
+
var pattern = _patterns[_i2];
|
|
2013
|
+
if (!pattern.wildcard) {
|
|
2014
|
+
if (specifier === pattern.prefix) return {
|
|
2015
|
+
v: regeneratorValues._toConsumableArray(pattern.targets)
|
|
2016
|
+
};
|
|
2017
|
+
return 0; // continue
|
|
2018
|
+
}
|
|
2019
|
+
if (!specifier.startsWith(pattern.prefix) || !specifier.endsWith(pattern.suffix) || specifier.length < pattern.prefix.length + pattern.suffix.length) {
|
|
2020
|
+
return 0; // continue
|
|
2021
|
+
}
|
|
2022
|
+
var matched = specifier.slice(pattern.prefix.length, specifier.length - pattern.suffix.length);
|
|
2023
|
+
return {
|
|
2024
|
+
v: pattern.targets.map(function (target) {
|
|
2025
|
+
return target.replace("*", matched);
|
|
2026
|
+
})
|
|
2027
|
+
};
|
|
2028
|
+
},
|
|
2029
|
+
_ret;
|
|
2030
|
+
for (var _i2 = 0, _patterns = patterns; _i2 < _patterns.length; _i2++) {
|
|
2031
|
+
_ret = _loop();
|
|
2032
|
+
if (_ret === 0) continue;
|
|
2033
|
+
if (_ret) return _ret.v;
|
|
2034
|
+
}
|
|
2035
|
+
return [];
|
|
2036
|
+
}
|
|
2037
|
+
};
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
/** Follows `extends` through the file record. Package extends cannot be read. */
|
|
2041
|
+
function readConfig(files, path, warn, seen) {
|
|
2042
|
+
var _config, _config$compilerOptio4, _config$compilerOptio5, _parent$compilerOptio;
|
|
2043
|
+
if (seen.has(path)) return null; // a cycle; whatever we have is enough
|
|
2044
|
+
seen.add(path);
|
|
2045
|
+
var text = files[path];
|
|
2046
|
+
if (text === undefined) return null;
|
|
2047
|
+
var config;
|
|
2048
|
+
try {
|
|
2049
|
+
config = parseJsonc(text);
|
|
2050
|
+
} catch (error) {
|
|
2051
|
+
var _message;
|
|
2052
|
+
warn("Could not parse ".concat(path, ": ").concat(String((_message = error === null || error === void 0 ? void 0 : error.message) !== null && _message !== void 0 ? _message : error)));
|
|
2053
|
+
return null;
|
|
2054
|
+
}
|
|
2055
|
+
if (!((_config = config) !== null && _config !== void 0 && _config["extends"])) return config;
|
|
2056
|
+
|
|
2057
|
+
// Only a relative extends can be followed: a package one ("extends":
|
|
2058
|
+
// "@tsconfig/node20/tsconfig.json") lives in node_modules, which a browser
|
|
2059
|
+
// build does not have. Worth saying out loud rather than silently resolving
|
|
2060
|
+
// half the aliases, because the base config is where a monorepo usually puts
|
|
2061
|
+
// them.
|
|
2062
|
+
if (!config["extends"].startsWith(".")) {
|
|
2063
|
+
var _config$compilerOptio3;
|
|
2064
|
+
if (!((_config$compilerOptio3 = config.compilerOptions) !== null && _config$compilerOptio3 !== void 0 && _config$compilerOptio3.paths)) {
|
|
2065
|
+
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."));
|
|
2066
|
+
}
|
|
2067
|
+
return config;
|
|
2068
|
+
}
|
|
2069
|
+
var parentPath = resolveConfigPath(files, resolve(dirname(path), config["extends"]));
|
|
2070
|
+
var parent = parentPath ? readConfig(files, parentPath, warn, seen) : null;
|
|
2071
|
+
if (!parent) return config;
|
|
2072
|
+
|
|
2073
|
+
// The child wins, and `paths` replaces rather than merges -- which is what
|
|
2074
|
+
// TypeScript does.
|
|
2075
|
+
return {
|
|
2076
|
+
compilerOptions: regeneratorValues._objectSpread2(regeneratorValues._objectSpread2(regeneratorValues._objectSpread2({}, parent.compilerOptions), config.compilerOptions), {}, {
|
|
2077
|
+
// baseUrl in the parent was relative to the *parent*, and readConfig
|
|
2078
|
+
// returns it unresolved, so a parent baseUrl with a child that sets none
|
|
2079
|
+
// is the one case this gets wrong. Rare enough to name rather than model.
|
|
2080
|
+
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
|
|
2081
|
+
})
|
|
2082
|
+
};
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
/** `extends: './base'` may omit the .json. */
|
|
2086
|
+
function resolveConfigPath(files, path) {
|
|
2087
|
+
for (var _i3 = 0, _arr = [path, "".concat(path, ".json")]; _i3 < _arr.length; _i3++) {
|
|
2088
|
+
var candidate = _arr[_i3];
|
|
2089
|
+
if (candidate in files) return candidate;
|
|
2090
|
+
}
|
|
2091
|
+
return null;
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
/**
|
|
2095
|
+
* A project's `val.modules.ts`, bundled to run: every `.val.ts` it imports,
|
|
2096
|
+
* the `val.config` they share and the `.val.json` entries they name, as ONE
|
|
2097
|
+
* ES module -- so it can be imported from a `blob:` URL, which cannot resolve
|
|
2098
|
+
* a relative chunk -- with every npm import pointing at the site's own
|
|
2099
|
+
* vendor chunks, at absolute URLs under `origin`.
|
|
2100
|
+
*
|
|
2101
|
+
* What the builder tab evaluates to learn a tree's schemas: Update from the
|
|
2102
|
+
* site with code (valbuild/home `docs/hosted-publishing.md` step 8.2, slice
|
|
2103
|
+
* 1b). The project's own `@valbuild/*` and dependencies are what run, as the
|
|
2104
|
+
* site runs them -- the browser half of its layer, from `/_pvendor/<rev>/`,
|
|
2105
|
+
* and the base layer from `/_vendor/`. Whoever imports it should do so off
|
|
2106
|
+
* the Studio's page: `@valbuild/tanstack` brings React and patches its JSX.
|
|
2107
|
+
*
|
|
2108
|
+
* Nothing else of a build happens here: no route splitting, no server
|
|
2109
|
+
* functions, no CSS -- a `.val.ts` has none of it.
|
|
2110
|
+
*/
|
|
2111
|
+
function bundleValModules(_x) {
|
|
2112
|
+
return _bundleValModules.apply(this, arguments);
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
/**
|
|
2116
|
+
* A build's `val.modules` registry, as the build emits it beside its client
|
|
2117
|
+
* chunks: `{ "val-modules-<build>.js": code }`, served at `/_app/` with
|
|
2118
|
+
* them, its npm imports pointing at the site's vendor chunks on its own
|
|
2119
|
+
* origin (`/_vendor/`, `/_pvendor/<rev>/`) as the client bundle's do.
|
|
2120
|
+
*
|
|
2121
|
+
* What a Studio opened on an older build imports, once the server's
|
|
2122
|
+
* manifest names it (`registry`, from the build's name the platform hands
|
|
2123
|
+
* the server: `VAL_BUILD`), to take this build's schemas in WITHOUT
|
|
2124
|
+
* reloading the page: `HostStore.reloadCode` in `@valbuild/ui`, and phase 9
|
|
2125
|
+
* of `docs/plans/one-content-model.md` in valbuild/val.
|
|
2126
|
+
*
|
|
2127
|
+
* Empty -- and the build goes on -- for a project with no `val.modules.ts`,
|
|
2128
|
+
* or one whose Val modules cannot be bundled for the browser (a `.val.ts`
|
|
2129
|
+
* importing something server-only): such a build has no entry, and a Studio
|
|
2130
|
+
* that cannot import one reloads the page instead, as it did before. Said
|
|
2131
|
+
* in the build's warnings.
|
|
2132
|
+
*/
|
|
2133
|
+
function _bundleValModules() {
|
|
2134
|
+
_bundleValModules = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee(input) {
|
|
2135
|
+
var _input$entry;
|
|
2136
|
+
var files, target, origin, entry, warnings, aliases, base, project, resolveProjectPath, _yield$loadRolldown, build, result, chunks, _t;
|
|
2137
|
+
return regeneratorValues._regenerator().w(function (_context) {
|
|
2138
|
+
while (1) switch (_context.p = _context.n) {
|
|
2139
|
+
case 0:
|
|
2140
|
+
files = input.files, target = input.target, origin = input.origin;
|
|
2141
|
+
entry = (_input$entry = input.entry) !== null && _input$entry !== void 0 ? _input$entry : ["val.modules.ts", "val.modules.js"].find(function (path) {
|
|
2142
|
+
return path in files;
|
|
2143
|
+
});
|
|
2144
|
+
if (!(entry === undefined || !(entry in files))) {
|
|
2145
|
+
_context.n = 1;
|
|
2146
|
+
break;
|
|
2147
|
+
}
|
|
2148
|
+
throw new Error("This project has no val.modules.ts, so its Val modules cannot be read.");
|
|
2149
|
+
case 1:
|
|
2150
|
+
warnings = [];
|
|
2151
|
+
aliases = aliasMap(files, function (message) {
|
|
2152
|
+
return warnings.push(message);
|
|
2153
|
+
});
|
|
2154
|
+
base = "".concat(origin, "/_vendor/");
|
|
2155
|
+
project = target.project.rev === null ? null : "".concat(origin, "/_pvendor/").concat(target.project.rev, "/");
|
|
2156
|
+
resolveProjectPath = function resolveProjectPath(path) {
|
|
2157
|
+
return resolveInFiles(path, files);
|
|
2158
|
+
};
|
|
2159
|
+
_context.n = 2;
|
|
2160
|
+
return loadRolldown();
|
|
2161
|
+
case 2:
|
|
2162
|
+
_yield$loadRolldown = _context.v;
|
|
2163
|
+
build = _yield$loadRolldown.build;
|
|
2164
|
+
_context.p = 3;
|
|
2165
|
+
_context.n = 4;
|
|
2166
|
+
return build({
|
|
2167
|
+
input: entry,
|
|
2168
|
+
// See `buildOnce`: required in the browser, inert here.
|
|
2169
|
+
cwd: "/",
|
|
2170
|
+
moduleTypes: {
|
|
2171
|
+
".css": "empty"
|
|
2172
|
+
},
|
|
2173
|
+
plugins: [{
|
|
2174
|
+
name: "val:modules",
|
|
2175
|
+
resolveId: function resolveId(source, importer) {
|
|
2176
|
+
if (source.startsWith(".")) {
|
|
2177
|
+
return resolveProjectPath(resolve(dirname(importer !== null && importer !== void 0 ? importer : entry), source));
|
|
2178
|
+
}
|
|
2179
|
+
if (source in files) return source;
|
|
2180
|
+
var baseChunk = target.base.modules[source];
|
|
2181
|
+
if (baseChunk) {
|
|
2182
|
+
return {
|
|
2183
|
+
id: "".concat(base).concat(baseChunk, ".js"),
|
|
2184
|
+
external: true
|
|
2185
|
+
};
|
|
2186
|
+
}
|
|
2187
|
+
var projectChunk = target.project.modules[source];
|
|
2188
|
+
if (projectChunk && project !== null) {
|
|
2189
|
+
if (target.project.workerOnly.includes(source)) {
|
|
2190
|
+
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."));
|
|
2191
|
+
}
|
|
2192
|
+
return {
|
|
2193
|
+
id: "".concat(project).concat(projectChunk, ".js"),
|
|
2194
|
+
external: true
|
|
2195
|
+
};
|
|
2196
|
+
}
|
|
2197
|
+
if (aliases) {
|
|
2198
|
+
var _iterator = regeneratorValues._createForOfIteratorHelper(aliases.candidates(source)),
|
|
2199
|
+
_step;
|
|
2200
|
+
try {
|
|
2201
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2202
|
+
var candidate = _step.value;
|
|
2203
|
+
var _hit = resolveProjectPath(candidate);
|
|
2204
|
+
if (_hit) return _hit;
|
|
2205
|
+
}
|
|
2206
|
+
} catch (err) {
|
|
2207
|
+
_iterator.e(err);
|
|
2208
|
+
} finally {
|
|
2209
|
+
_iterator.f();
|
|
2210
|
+
}
|
|
2211
|
+
var fromBaseUrl = aliases.baseUrlCandidate(source);
|
|
2212
|
+
var hit = fromBaseUrl && resolveProjectPath(fromBaseUrl);
|
|
2213
|
+
if (hit) return hit;
|
|
2214
|
+
}
|
|
2215
|
+
// An error, not a warning: rolldown would otherwise leave the
|
|
2216
|
+
// specifier as it is, and it would fail when imported, unnamed.
|
|
2217
|
+
throw new Error("'".concat(source, "' is not an available dependency. Available: ").concat([].concat(regeneratorValues._toConsumableArray(Object.keys(target.base.modules)), regeneratorValues._toConsumableArray(Object.keys(target.project.modules))).join(", "), "."));
|
|
2218
|
+
},
|
|
2219
|
+
load: function load(id) {
|
|
2220
|
+
return id in files ? files[id] : null;
|
|
2221
|
+
}
|
|
2222
|
+
}],
|
|
2223
|
+
transform: {
|
|
2224
|
+
jsx: {
|
|
2225
|
+
runtime: "automatic",
|
|
2226
|
+
importSource: "react"
|
|
2227
|
+
}
|
|
2228
|
+
},
|
|
2229
|
+
output: {
|
|
2230
|
+
format: "esm",
|
|
2231
|
+
minify: false,
|
|
2232
|
+
// One module: `def: () => import("./x.val")` stays a dynamic import of
|
|
2233
|
+
// something already in the file.
|
|
2234
|
+
codeSplitting: false
|
|
2235
|
+
},
|
|
2236
|
+
write: false
|
|
2237
|
+
});
|
|
2238
|
+
case 4:
|
|
2239
|
+
result = _context.v;
|
|
2240
|
+
_context.n = 6;
|
|
2241
|
+
break;
|
|
2242
|
+
case 5:
|
|
2243
|
+
_context.p = 5;
|
|
2244
|
+
_t = _context.v;
|
|
2245
|
+
throw new Error(["The Val modules could not be bundled."].concat(warnings, [_t instanceof Error ? _t.message : String(_t)]).join("\n"), {
|
|
2246
|
+
cause: _t
|
|
2247
|
+
});
|
|
2248
|
+
case 6:
|
|
2249
|
+
chunks = result.output.filter(function (output) {
|
|
2250
|
+
return output.type === "chunk";
|
|
2251
|
+
});
|
|
2252
|
+
if (!(chunks.length !== 1)) {
|
|
2253
|
+
_context.n = 7;
|
|
2254
|
+
break;
|
|
2255
|
+
}
|
|
2256
|
+
throw new Error("Bundling the Val modules made ".concat(chunks.length, " chunks rather than one."));
|
|
2257
|
+
case 7:
|
|
2258
|
+
return _context.a(2, {
|
|
2259
|
+
code: chunks[0].code
|
|
2260
|
+
});
|
|
2261
|
+
}
|
|
2262
|
+
}, _callee, null, [[3, 5]]);
|
|
2263
|
+
}));
|
|
2264
|
+
return _bundleValModules.apply(this, arguments);
|
|
2265
|
+
}
|
|
2266
|
+
function valModulesEntry(_x2, _x3, _x4) {
|
|
2267
|
+
return _valModulesEntry.apply(this, arguments);
|
|
2268
|
+
}
|
|
2269
|
+
function _valModulesEntry() {
|
|
2270
|
+
_valModulesEntry = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee2(input, build, warnings) {
|
|
2271
|
+
var entry, _yield$bundleValModul, code, _t2;
|
|
2272
|
+
return regeneratorValues._regenerator().w(function (_context2) {
|
|
2273
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
2274
|
+
case 0:
|
|
2275
|
+
entry = ["val.modules.ts", "val.modules.js"].find(function (path) {
|
|
2276
|
+
return path in input.files;
|
|
2277
|
+
});
|
|
2278
|
+
if (!(entry === undefined)) {
|
|
2279
|
+
_context2.n = 1;
|
|
2280
|
+
break;
|
|
2281
|
+
}
|
|
2282
|
+
return _context2.a(2, {});
|
|
2283
|
+
case 1:
|
|
2284
|
+
_context2.p = 1;
|
|
2285
|
+
_context2.n = 2;
|
|
2286
|
+
return bundleValModules({
|
|
2287
|
+
files: input.files,
|
|
2288
|
+
target: input.target,
|
|
2289
|
+
// Root-relative, as the client bundle names its vendor chunks: the
|
|
2290
|
+
// entry is served on the site's own origin.
|
|
2291
|
+
origin: "",
|
|
2292
|
+
entry: entry
|
|
2293
|
+
});
|
|
2294
|
+
case 2:
|
|
2295
|
+
_yield$bundleValModul = _context2.v;
|
|
2296
|
+
code = _yield$bundleValModul.code;
|
|
2297
|
+
return _context2.a(2, regeneratorValues._defineProperty({}, projectPaths.valModulesEntryFile(build), code));
|
|
2298
|
+
case 3:
|
|
2299
|
+
_context2.p = 3;
|
|
2300
|
+
_t2 = _context2.v;
|
|
2301
|
+
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)));
|
|
2302
|
+
return _context2.a(2, {});
|
|
2303
|
+
}
|
|
2304
|
+
}, _callee2, null, [[1, 3]]);
|
|
2305
|
+
}));
|
|
2306
|
+
return _valModulesEntry.apply(this, arguments);
|
|
2307
|
+
}
|
|
2308
|
+
|
|
1898
2309
|
/** Cheap pre-filter: skip the parse unless one of these appears in the source. */
|
|
1899
2310
|
var MARKERS = ["createIsomorphicFn", "createServerOnlyFn", "createClientOnlyFn", "createMiddleware", "ClientOnly"];
|
|
1900
2311
|
|
|
@@ -2756,202 +3167,21 @@ function _transformRouteNodes() {
|
|
|
2756
3167
|
_iterator.f();
|
|
2757
3168
|
}
|
|
2758
3169
|
if (doomed.size) edits.push.apply(edits, regeneratorValues._toConsumableArray(deleteProperties(code, properties, doomed)));
|
|
2759
|
-
});
|
|
2760
|
-
if (!(edits.length === 0)) {
|
|
2761
|
-
_context.n = 5;
|
|
2762
|
-
break;
|
|
2763
|
-
}
|
|
2764
|
-
return _context.a(2, null);
|
|
2765
|
-
case 5:
|
|
2766
|
-
return _context.a(2, {
|
|
2767
|
-
code: applyEdits(code, edits),
|
|
2768
|
-
removed: removed
|
|
2769
|
-
});
|
|
2770
|
-
}
|
|
2771
|
-
}, _callee);
|
|
2772
|
-
}));
|
|
2773
|
-
return _transformRouteNodes.apply(this, arguments);
|
|
2774
|
-
}
|
|
2775
|
-
|
|
2776
|
-
/**
|
|
2777
|
-
* JSON with comments and trailing commas, which is what tsconfig.json is.
|
|
2778
|
-
*
|
|
2779
|
-
* Written as a scanner rather than a regex on purpose: `"url": "https://x"`
|
|
2780
|
-
* contains `//`, and a regex that strips comments without tracking string state
|
|
2781
|
-
* truncates the file there and throws a parse error pointing at the wrong line.
|
|
2782
|
-
*/
|
|
2783
|
-
function parseJsonc(text) {
|
|
2784
|
-
var out = "";
|
|
2785
|
-
var i = 0;
|
|
2786
|
-
while (i < text.length) {
|
|
2787
|
-
var ch = text[i];
|
|
2788
|
-
if (ch === '"') {
|
|
2789
|
-
// Copy the whole string literal, escapes included, untouched.
|
|
2790
|
-
out += ch;
|
|
2791
|
-
i++;
|
|
2792
|
-
while (i < text.length) {
|
|
2793
|
-
var c = text[i];
|
|
2794
|
-
out += c;
|
|
2795
|
-
i++;
|
|
2796
|
-
if (c === "\\") {
|
|
2797
|
-
if (i < text.length) out += text[i++];
|
|
2798
|
-
continue;
|
|
2799
|
-
}
|
|
2800
|
-
if (c === '"') break;
|
|
2801
|
-
}
|
|
2802
|
-
continue;
|
|
2803
|
-
}
|
|
2804
|
-
if (ch === "/" && text[i + 1] === "/") {
|
|
2805
|
-
while (i < text.length && text[i] !== "\n") i++;
|
|
2806
|
-
continue;
|
|
2807
|
-
}
|
|
2808
|
-
if (ch === "/" && text[i + 1] === "*") {
|
|
2809
|
-
i += 2;
|
|
2810
|
-
while (i < text.length && !(text[i] === "*" && text[i + 1] === "/")) i++;
|
|
2811
|
-
i += 2;
|
|
2812
|
-
continue;
|
|
2813
|
-
}
|
|
2814
|
-
out += ch;
|
|
2815
|
-
i++;
|
|
2816
|
-
}
|
|
2817
|
-
// Trailing commas, now that every remaining comma is structural.
|
|
2818
|
-
return JSON.parse(out.replace(/,(\s*[}\]])/g, "$1"));
|
|
2819
|
-
}
|
|
2820
|
-
|
|
2821
|
-
/** One `paths` entry, pre-split on its wildcard. */
|
|
2822
|
-
|
|
2823
|
-
/**
|
|
2824
|
-
* Reads tsconfig.json out of the file record and builds the matcher.
|
|
2825
|
-
*
|
|
2826
|
-
* Returns null when the project configures no aliases, which is the common
|
|
2827
|
-
* case and costs nothing.
|
|
2828
|
-
*/
|
|
2829
|
-
function aliasMap(files, warn) {
|
|
2830
|
-
var _config$compilerOptio, _config$compilerOptio2;
|
|
2831
|
-
var entry = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "tsconfig.json";
|
|
2832
|
-
var config = readConfig(files, entry, warn, new Set());
|
|
2833
|
-
var paths = config === null || config === void 0 || (_config$compilerOptio = config.compilerOptions) === null || _config$compilerOptio === void 0 ? void 0 : _config$compilerOptio.paths;
|
|
2834
|
-
var baseUrl = config === null || config === void 0 || (_config$compilerOptio2 = config.compilerOptions) === null || _config$compilerOptio2 === void 0 ? void 0 : _config$compilerOptio2.baseUrl;
|
|
2835
|
-
// A project can configure either one without the other, and baseUrl alone is
|
|
2836
|
-
// enough to change how a bare specifier resolves.
|
|
2837
|
-
if ((!paths || Object.keys(paths).length === 0) && baseUrl === undefined) return null;
|
|
2838
|
-
|
|
2839
|
-
// `baseUrl` is relative to the tsconfig that declared it. Since TS 4.1 paths
|
|
2840
|
-
// work without one, resolved against the tsconfig's own directory -- so the
|
|
2841
|
-
// fallback here is the directory, not the project root.
|
|
2842
|
-
var base = resolve(dirname(entry), baseUrl !== null && baseUrl !== void 0 ? baseUrl : ".");
|
|
2843
|
-
var patterns = [];
|
|
2844
|
-
for (var _i = 0, _Object$entries = Object.entries(paths !== null && paths !== void 0 ? paths : {}); _i < _Object$entries.length; _i++) {
|
|
2845
|
-
var _Object$entries$_i = regeneratorValues._slicedToArray(_Object$entries[_i], 2),
|
|
2846
|
-
pattern = _Object$entries$_i[0],
|
|
2847
|
-
targets = _Object$entries$_i[1];
|
|
2848
|
-
var star = pattern.indexOf("*");
|
|
2849
|
-
if (star !== pattern.lastIndexOf("*")) {
|
|
2850
|
-
warn("tsconfig paths pattern '".concat(pattern, "' has more than one '*' and is ignored."));
|
|
2851
|
-
continue;
|
|
2852
|
-
}
|
|
2853
|
-
patterns.push({
|
|
2854
|
-
prefix: star === -1 ? pattern : pattern.slice(0, star),
|
|
2855
|
-
suffix: star === -1 ? "" : pattern.slice(star + 1),
|
|
2856
|
-
wildcard: star !== -1,
|
|
2857
|
-
targets: targets.map(function (target) {
|
|
2858
|
-
return resolve(base, target);
|
|
2859
|
-
})
|
|
2860
|
-
});
|
|
2861
|
-
}
|
|
2862
|
-
|
|
2863
|
-
// TypeScript picks the pattern with the longest literal prefix, so `@/ui/*`
|
|
2864
|
-
// beats `@/*` for `@/ui/card` regardless of declaration order.
|
|
2865
|
-
patterns.sort(function (a, b) {
|
|
2866
|
-
return b.prefix.length - a.prefix.length;
|
|
2867
|
-
});
|
|
2868
|
-
return {
|
|
2869
|
-
patterns: Object.keys(paths !== null && paths !== void 0 ? paths : {}),
|
|
2870
|
-
baseUrlCandidate: function baseUrlCandidate(specifier) {
|
|
2871
|
-
return baseUrl === undefined ? null : resolve(base, specifier);
|
|
2872
|
-
},
|
|
2873
|
-
candidates: function candidates(specifier) {
|
|
2874
|
-
var _loop = function _loop() {
|
|
2875
|
-
var pattern = _patterns[_i2];
|
|
2876
|
-
if (!pattern.wildcard) {
|
|
2877
|
-
if (specifier === pattern.prefix) return {
|
|
2878
|
-
v: regeneratorValues._toConsumableArray(pattern.targets)
|
|
2879
|
-
};
|
|
2880
|
-
return 0; // continue
|
|
2881
|
-
}
|
|
2882
|
-
if (!specifier.startsWith(pattern.prefix) || !specifier.endsWith(pattern.suffix) || specifier.length < pattern.prefix.length + pattern.suffix.length) {
|
|
2883
|
-
return 0; // continue
|
|
3170
|
+
});
|
|
3171
|
+
if (!(edits.length === 0)) {
|
|
3172
|
+
_context.n = 5;
|
|
3173
|
+
break;
|
|
2884
3174
|
}
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
};
|
|
2891
|
-
},
|
|
2892
|
-
_ret;
|
|
2893
|
-
for (var _i2 = 0, _patterns = patterns; _i2 < _patterns.length; _i2++) {
|
|
2894
|
-
_ret = _loop();
|
|
2895
|
-
if (_ret === 0) continue;
|
|
2896
|
-
if (_ret) return _ret.v;
|
|
3175
|
+
return _context.a(2, null);
|
|
3176
|
+
case 5:
|
|
3177
|
+
return _context.a(2, {
|
|
3178
|
+
code: applyEdits(code, edits),
|
|
3179
|
+
removed: removed
|
|
3180
|
+
});
|
|
2897
3181
|
}
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
}
|
|
2902
|
-
|
|
2903
|
-
/** Follows `extends` through the file record. Package extends cannot be read. */
|
|
2904
|
-
function readConfig(files, path, warn, seen) {
|
|
2905
|
-
var _config, _config$compilerOptio4, _config$compilerOptio5, _parent$compilerOptio;
|
|
2906
|
-
if (seen.has(path)) return null; // a cycle; whatever we have is enough
|
|
2907
|
-
seen.add(path);
|
|
2908
|
-
var text = files[path];
|
|
2909
|
-
if (text === undefined) return null;
|
|
2910
|
-
var config;
|
|
2911
|
-
try {
|
|
2912
|
-
config = parseJsonc(text);
|
|
2913
|
-
} catch (error) {
|
|
2914
|
-
var _message;
|
|
2915
|
-
warn("Could not parse ".concat(path, ": ").concat(String((_message = error === null || error === void 0 ? void 0 : error.message) !== null && _message !== void 0 ? _message : error)));
|
|
2916
|
-
return null;
|
|
2917
|
-
}
|
|
2918
|
-
if (!((_config = config) !== null && _config !== void 0 && _config["extends"])) return config;
|
|
2919
|
-
|
|
2920
|
-
// Only a relative extends can be followed: a package one ("extends":
|
|
2921
|
-
// "@tsconfig/node20/tsconfig.json") lives in node_modules, which a browser
|
|
2922
|
-
// build does not have. Worth saying out loud rather than silently resolving
|
|
2923
|
-
// half the aliases, because the base config is where a monorepo usually puts
|
|
2924
|
-
// them.
|
|
2925
|
-
if (!config["extends"].startsWith(".")) {
|
|
2926
|
-
var _config$compilerOptio3;
|
|
2927
|
-
if (!((_config$compilerOptio3 = config.compilerOptions) !== null && _config$compilerOptio3 !== void 0 && _config$compilerOptio3.paths)) {
|
|
2928
|
-
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."));
|
|
2929
|
-
}
|
|
2930
|
-
return config;
|
|
2931
|
-
}
|
|
2932
|
-
var parentPath = resolveConfigPath(files, resolve(dirname(path), config["extends"]));
|
|
2933
|
-
var parent = parentPath ? readConfig(files, parentPath, warn, seen) : null;
|
|
2934
|
-
if (!parent) return config;
|
|
2935
|
-
|
|
2936
|
-
// The child wins, and `paths` replaces rather than merges -- which is what
|
|
2937
|
-
// TypeScript does.
|
|
2938
|
-
return {
|
|
2939
|
-
compilerOptions: regeneratorValues._objectSpread2(regeneratorValues._objectSpread2(regeneratorValues._objectSpread2({}, parent.compilerOptions), config.compilerOptions), {}, {
|
|
2940
|
-
// baseUrl in the parent was relative to the *parent*, and readConfig
|
|
2941
|
-
// returns it unresolved, so a parent baseUrl with a child that sets none
|
|
2942
|
-
// is the one case this gets wrong. Rare enough to name rather than model.
|
|
2943
|
-
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
|
|
2944
|
-
})
|
|
2945
|
-
};
|
|
2946
|
-
}
|
|
2947
|
-
|
|
2948
|
-
/** `extends: './base'` may omit the .json. */
|
|
2949
|
-
function resolveConfigPath(files, path) {
|
|
2950
|
-
for (var _i3 = 0, _arr = [path, "".concat(path, ".json")]; _i3 < _arr.length; _i3++) {
|
|
2951
|
-
var candidate = _arr[_i3];
|
|
2952
|
-
if (candidate in files) return candidate;
|
|
2953
|
-
}
|
|
2954
|
-
return null;
|
|
3182
|
+
}, _callee);
|
|
3183
|
+
}));
|
|
3184
|
+
return _transformRouteNodes.apply(this, arguments);
|
|
2955
3185
|
}
|
|
2956
3186
|
|
|
2957
3187
|
// autoCodeSplitting.
|
|
@@ -4020,7 +4250,7 @@ function buildUserApp(_x6) {
|
|
|
4020
4250
|
function _buildUserApp() {
|
|
4021
4251
|
_buildUserApp = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee3(input) {
|
|
4022
4252
|
var _input$target$project;
|
|
4023
|
-
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;
|
|
4253
|
+
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;
|
|
4024
4254
|
return regeneratorValues._regenerator().w(function (_context3) {
|
|
4025
4255
|
while (1) switch (_context3.n) {
|
|
4026
4256
|
case 0:
|
|
@@ -4120,14 +4350,27 @@ function _buildUserApp() {
|
|
|
4120
4350
|
return buildOnce(input, "/_vendor/", "/_pvendor/".concat(rev, "/"), "client", warnings, clientModules, false, assetUrls, css.modules, aliases);
|
|
4121
4351
|
case 12:
|
|
4122
4352
|
clientBuild = _context3.v;
|
|
4123
|
-
client = performance.now() - clientStarted;
|
|
4124
|
-
|
|
4125
|
-
|
|
4353
|
+
client = performance.now() - clientStarted;
|
|
4354
|
+
/*
|
|
4355
|
+
* The build's `val.modules` registry, as an ES module of its own beside
|
|
4356
|
+
* the client chunks and named after the build: what a Studio opened on an
|
|
4357
|
+
* older build imports to take this one's code in, rather than reloading
|
|
4358
|
+
* the page (`valModulesEntry`). The build's name is a hash of its inputs,
|
|
4359
|
+
* so it is known before anything is emitted.
|
|
4360
|
+
*/
|
|
4361
|
+
_context3.n = 13;
|
|
4362
|
+
return buildInputId(input);
|
|
4363
|
+
case 13:
|
|
4364
|
+
hash = _context3.v;
|
|
4365
|
+
_context3.n = 14;
|
|
4366
|
+
return valModulesEntry(input, hash, warnings);
|
|
4367
|
+
case 14:
|
|
4368
|
+
registryEntry = _context3.v;
|
|
4126
4369
|
if (!input.rsc) {
|
|
4127
|
-
_context3.n =
|
|
4370
|
+
_context3.n = 16;
|
|
4128
4371
|
break;
|
|
4129
4372
|
}
|
|
4130
|
-
_context3.n =
|
|
4373
|
+
_context3.n = 15;
|
|
4131
4374
|
return buildOnce(
|
|
4132
4375
|
// `../pvendor/`, with no revision segment: the revision belongs in the
|
|
4133
4376
|
// browser URL, where it buys immutable caching. Inside the module map
|
|
@@ -4135,13 +4378,13 @@ function _buildUserApp() {
|
|
|
4135
4378
|
// revision here is a path segment that does not exist -- and the cold
|
|
4136
4379
|
// isolate is where you would find that out.
|
|
4137
4380
|
input, "../vendor-rsc/", "../pvendor/", "server", warnings, clientModules, true, assetUrls, css.modules, aliases);
|
|
4138
|
-
case
|
|
4381
|
+
case 15:
|
|
4139
4382
|
_t2 = _context3.v;
|
|
4140
|
-
_context3.n =
|
|
4383
|
+
_context3.n = 17;
|
|
4141
4384
|
break;
|
|
4142
|
-
case
|
|
4385
|
+
case 16:
|
|
4143
4386
|
_t2 = undefined;
|
|
4144
|
-
case
|
|
4387
|
+
case 17:
|
|
4145
4388
|
rscBuild = _t2;
|
|
4146
4389
|
// Stripped of the `public/` prefix here rather than at every consumer: the
|
|
4147
4390
|
// prefix is a convention of the project layout, and what the loader needs is
|
|
@@ -4154,7 +4397,7 @@ function _buildUserApp() {
|
|
|
4154
4397
|
_t3 = serverBuild.code;
|
|
4155
4398
|
_t4 = clientBuild.code;
|
|
4156
4399
|
_t5 = serverBuild.chunks;
|
|
4157
|
-
_t6 = clientBuild.chunks;
|
|
4400
|
+
_t6 = regeneratorValues._objectSpread2(regeneratorValues._objectSpread2({}, clientBuild.chunks), registryEntry);
|
|
4158
4401
|
_t7 = assetFiles;
|
|
4159
4402
|
_t8 = publicFiles;
|
|
4160
4403
|
_t9 = styles;
|
|
@@ -4165,15 +4408,12 @@ function _buildUserApp() {
|
|
|
4165
4408
|
_t10 = rscBuild === null || rscBuild === void 0 ? void 0 : rscBuild.chunks;
|
|
4166
4409
|
_t11 = input.rsc ? clientModules : undefined;
|
|
4167
4410
|
_t12 = input.target.base.rev;
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
case 16:
|
|
4171
|
-
_t13 = _context3.v;
|
|
4172
|
-
_context3.n = 17;
|
|
4411
|
+
_t13 = hash;
|
|
4412
|
+
_context3.n = 18;
|
|
4173
4413
|
return regeneratorValues.sha256Hex([input.target.base.rev, rev, styles].concat(regeneratorValues._toConsumableArray(Object.entries(assetFiles).flat()), regeneratorValues._toConsumableArray(Object.entries(publicFiles).flat()), regeneratorValues._toConsumableArray([serverBuild, clientBuild, rscBuild].flatMap(function (built) {
|
|
4174
4414
|
return built ? [built.code].concat(regeneratorValues._toConsumableArray(Object.entries(built.chunks).flat())) : [];
|
|
4175
|
-
}))).join("\0"));
|
|
4176
|
-
case
|
|
4415
|
+
})), regeneratorValues._toConsumableArray(Object.entries(registryEntry).flat())).join("\0"));
|
|
4416
|
+
case 18:
|
|
4177
4417
|
_t14 = _context3.v.slice(0, 32);
|
|
4178
4418
|
_t15 = {
|
|
4179
4419
|
server: server,
|
|
@@ -4630,160 +4870,6 @@ function treeShaOfText(files) {
|
|
|
4630
4870
|
})));
|
|
4631
4871
|
}
|
|
4632
4872
|
|
|
4633
|
-
/**
|
|
4634
|
-
* A project's `val.modules.ts`, bundled to run: every `.val.ts` it imports,
|
|
4635
|
-
* the `val.config` they share and the `.val.json` entries they name, as ONE
|
|
4636
|
-
* ES module -- so it can be imported from a `blob:` URL, which cannot resolve
|
|
4637
|
-
* a relative chunk -- with every npm import pointing at the site's own
|
|
4638
|
-
* vendor chunks, at absolute URLs under `origin`.
|
|
4639
|
-
*
|
|
4640
|
-
* What the builder tab evaluates to learn a tree's schemas: Update from the
|
|
4641
|
-
* site with code (valbuild/home `docs/hosted-publishing.md` step 8.2, slice
|
|
4642
|
-
* 1b). The project's own `@valbuild/*` and dependencies are what run, as the
|
|
4643
|
-
* site runs them -- the browser half of its layer, from `/_pvendor/<rev>/`,
|
|
4644
|
-
* and the base layer from `/_vendor/`. Whoever imports it should do so off
|
|
4645
|
-
* the Studio's page: `@valbuild/tanstack` brings React and patches its JSX.
|
|
4646
|
-
*
|
|
4647
|
-
* Nothing else of a build happens here: no route splitting, no server
|
|
4648
|
-
* functions, no CSS -- a `.val.ts` has none of it.
|
|
4649
|
-
*/
|
|
4650
|
-
function bundleValModules(_x) {
|
|
4651
|
-
return _bundleValModules.apply(this, arguments);
|
|
4652
|
-
}
|
|
4653
|
-
function _bundleValModules() {
|
|
4654
|
-
_bundleValModules = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee(input) {
|
|
4655
|
-
var _input$entry;
|
|
4656
|
-
var files, target, origin, entry, warnings, aliases, base, project, resolveProjectPath, _yield$loadRolldown, build, result, chunks, _t;
|
|
4657
|
-
return regeneratorValues._regenerator().w(function (_context) {
|
|
4658
|
-
while (1) switch (_context.p = _context.n) {
|
|
4659
|
-
case 0:
|
|
4660
|
-
files = input.files, target = input.target, origin = input.origin;
|
|
4661
|
-
entry = (_input$entry = input.entry) !== null && _input$entry !== void 0 ? _input$entry : ["val.modules.ts", "val.modules.js"].find(function (path) {
|
|
4662
|
-
return path in files;
|
|
4663
|
-
});
|
|
4664
|
-
if (!(entry === undefined || !(entry in files))) {
|
|
4665
|
-
_context.n = 1;
|
|
4666
|
-
break;
|
|
4667
|
-
}
|
|
4668
|
-
throw new Error("This project has no val.modules.ts, so its Val modules cannot be read.");
|
|
4669
|
-
case 1:
|
|
4670
|
-
warnings = [];
|
|
4671
|
-
aliases = aliasMap(files, function (message) {
|
|
4672
|
-
return warnings.push(message);
|
|
4673
|
-
});
|
|
4674
|
-
base = "".concat(origin, "/_vendor/");
|
|
4675
|
-
project = target.project.rev === null ? null : "".concat(origin, "/_pvendor/").concat(target.project.rev, "/");
|
|
4676
|
-
resolveProjectPath = function resolveProjectPath(path) {
|
|
4677
|
-
return resolveInFiles(path, files);
|
|
4678
|
-
};
|
|
4679
|
-
_context.n = 2;
|
|
4680
|
-
return loadRolldown();
|
|
4681
|
-
case 2:
|
|
4682
|
-
_yield$loadRolldown = _context.v;
|
|
4683
|
-
build = _yield$loadRolldown.build;
|
|
4684
|
-
_context.p = 3;
|
|
4685
|
-
_context.n = 4;
|
|
4686
|
-
return build({
|
|
4687
|
-
input: entry,
|
|
4688
|
-
// See `buildOnce`: required in the browser, inert here.
|
|
4689
|
-
cwd: "/",
|
|
4690
|
-
moduleTypes: {
|
|
4691
|
-
".css": "empty"
|
|
4692
|
-
},
|
|
4693
|
-
plugins: [{
|
|
4694
|
-
name: "val:modules",
|
|
4695
|
-
resolveId: function resolveId(source, importer) {
|
|
4696
|
-
if (source.startsWith(".")) {
|
|
4697
|
-
return resolveProjectPath(resolve(dirname(importer !== null && importer !== void 0 ? importer : entry), source));
|
|
4698
|
-
}
|
|
4699
|
-
if (source in files) return source;
|
|
4700
|
-
var baseChunk = target.base.modules[source];
|
|
4701
|
-
if (baseChunk) {
|
|
4702
|
-
return {
|
|
4703
|
-
id: "".concat(base).concat(baseChunk, ".js"),
|
|
4704
|
-
external: true
|
|
4705
|
-
};
|
|
4706
|
-
}
|
|
4707
|
-
var projectChunk = target.project.modules[source];
|
|
4708
|
-
if (projectChunk && project !== null) {
|
|
4709
|
-
if (target.project.workerOnly.includes(source)) {
|
|
4710
|
-
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."));
|
|
4711
|
-
}
|
|
4712
|
-
return {
|
|
4713
|
-
id: "".concat(project).concat(projectChunk, ".js"),
|
|
4714
|
-
external: true
|
|
4715
|
-
};
|
|
4716
|
-
}
|
|
4717
|
-
if (aliases) {
|
|
4718
|
-
var _iterator = regeneratorValues._createForOfIteratorHelper(aliases.candidates(source)),
|
|
4719
|
-
_step;
|
|
4720
|
-
try {
|
|
4721
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
4722
|
-
var candidate = _step.value;
|
|
4723
|
-
var _hit = resolveProjectPath(candidate);
|
|
4724
|
-
if (_hit) return _hit;
|
|
4725
|
-
}
|
|
4726
|
-
} catch (err) {
|
|
4727
|
-
_iterator.e(err);
|
|
4728
|
-
} finally {
|
|
4729
|
-
_iterator.f();
|
|
4730
|
-
}
|
|
4731
|
-
var fromBaseUrl = aliases.baseUrlCandidate(source);
|
|
4732
|
-
var hit = fromBaseUrl && resolveProjectPath(fromBaseUrl);
|
|
4733
|
-
if (hit) return hit;
|
|
4734
|
-
}
|
|
4735
|
-
// An error, not a warning: rolldown would otherwise leave the
|
|
4736
|
-
// specifier as it is, and it would fail when imported, unnamed.
|
|
4737
|
-
throw new Error("'".concat(source, "' is not an available dependency. Available: ").concat([].concat(regeneratorValues._toConsumableArray(Object.keys(target.base.modules)), regeneratorValues._toConsumableArray(Object.keys(target.project.modules))).join(", "), "."));
|
|
4738
|
-
},
|
|
4739
|
-
load: function load(id) {
|
|
4740
|
-
return id in files ? files[id] : null;
|
|
4741
|
-
}
|
|
4742
|
-
}],
|
|
4743
|
-
transform: {
|
|
4744
|
-
jsx: {
|
|
4745
|
-
runtime: "automatic",
|
|
4746
|
-
importSource: "react"
|
|
4747
|
-
}
|
|
4748
|
-
},
|
|
4749
|
-
output: {
|
|
4750
|
-
format: "esm",
|
|
4751
|
-
minify: false,
|
|
4752
|
-
// One module: `def: () => import("./x.val")` stays a dynamic import of
|
|
4753
|
-
// something already in the file.
|
|
4754
|
-
codeSplitting: false
|
|
4755
|
-
},
|
|
4756
|
-
write: false
|
|
4757
|
-
});
|
|
4758
|
-
case 4:
|
|
4759
|
-
result = _context.v;
|
|
4760
|
-
_context.n = 6;
|
|
4761
|
-
break;
|
|
4762
|
-
case 5:
|
|
4763
|
-
_context.p = 5;
|
|
4764
|
-
_t = _context.v;
|
|
4765
|
-
throw new Error(["The Val modules could not be bundled."].concat(warnings, [_t instanceof Error ? _t.message : String(_t)]).join("\n"), {
|
|
4766
|
-
cause: _t
|
|
4767
|
-
});
|
|
4768
|
-
case 6:
|
|
4769
|
-
chunks = result.output.filter(function (output) {
|
|
4770
|
-
return output.type === "chunk";
|
|
4771
|
-
});
|
|
4772
|
-
if (!(chunks.length !== 1)) {
|
|
4773
|
-
_context.n = 7;
|
|
4774
|
-
break;
|
|
4775
|
-
}
|
|
4776
|
-
throw new Error("Bundling the Val modules made ".concat(chunks.length, " chunks rather than one."));
|
|
4777
|
-
case 7:
|
|
4778
|
-
return _context.a(2, {
|
|
4779
|
-
code: chunks[0].code
|
|
4780
|
-
});
|
|
4781
|
-
}
|
|
4782
|
-
}, _callee, null, [[3, 5]]);
|
|
4783
|
-
}));
|
|
4784
|
-
return _bundleValModules.apply(this, arguments);
|
|
4785
|
-
}
|
|
4786
|
-
|
|
4787
4873
|
exports.INLINE_LIMIT = regeneratorValues.INLINE_LIMIT;
|
|
4788
4874
|
exports.base64Bytes = regeneratorValues.base64Bytes;
|
|
4789
4875
|
exports.isAsset = regeneratorValues.isAsset;
|