@valbuild/tanstack-build 0.145.1 → 0.146.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 +10 -0
- package/dist/declarations/src/index.d.ts +1 -0
- package/dist/declarations/src/valModules.d.ts +29 -0
- package/dist/valbuild-tanstack-build.cjs.dev.js +151 -1
- package/dist/valbuild-tanstack-build.cjs.prod.js +151 -1
- package/dist/valbuild-tanstack-build.esm.js +151 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @valbuild/tanstack-build
|
|
2
2
|
|
|
3
|
+
## 0.146.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#861](https://github.com/valbuild/val/pull/861) [`89b0fa8`](https://github.com/valbuild/val/commit/89b0fa82a3ae0d8ccd5d0282c1034f1f40cc4e26) Thanks [@freekh](https://github.com/freekh)! - Proposals can be brought up to date with the site, like a pull request.
|
|
8
|
+
|
|
9
|
+
- **Update from the site** merges what was published on the site since a proposal started into the proposal, field by field. Where the site and the proposal changed the same field, the Publish dialog shows both and asks which to keep.
|
|
10
|
+
- **With code:** a proposal that changes code, or a site whose code changed since the proposal started, is updated too. The Studio runs each version's schemas in the tab, and the merged code is built before it can be published.
|
|
11
|
+
- Publish offers **Update from the site** whenever the site has moved under the proposal.
|
|
12
|
+
|
|
3
13
|
## 0.145.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { BuildTarget } from "./contract.js";
|
|
2
|
+
/**
|
|
3
|
+
* A project's `val.modules.ts`, bundled to run: every `.val.ts` it imports,
|
|
4
|
+
* the `val.config` they share and the `.val.json` entries they name, as ONE
|
|
5
|
+
* ES module -- so it can be imported from a `blob:` URL, which cannot resolve
|
|
6
|
+
* a relative chunk -- with every npm import pointing at the site's own
|
|
7
|
+
* vendor chunks, at absolute URLs under `origin`.
|
|
8
|
+
*
|
|
9
|
+
* What the builder tab evaluates to learn a tree's schemas: Update from the
|
|
10
|
+
* site with code (valbuild/home `docs/hosted-publishing.md` step 8.2, slice
|
|
11
|
+
* 1b). The project's own `@valbuild/*` and dependencies are what run, as the
|
|
12
|
+
* site runs them -- the browser half of its layer, from `/_pvendor/<rev>/`,
|
|
13
|
+
* and the base layer from `/_vendor/`. Whoever imports it should do so off
|
|
14
|
+
* the Studio's page: `@valbuild/tanstack` brings React and patches its JSX.
|
|
15
|
+
*
|
|
16
|
+
* Nothing else of a build happens here: no route splitting, no server
|
|
17
|
+
* functions, no CSS -- a `.val.ts` has none of it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function bundleValModules(input: {
|
|
20
|
+
/** The tree, by path from the project root. */
|
|
21
|
+
files: Record<string, string>;
|
|
22
|
+
target: BuildTarget;
|
|
23
|
+
/** The site's origin, where its vendor chunks are served. */
|
|
24
|
+
origin: string;
|
|
25
|
+
/** The entry; the project's `val.modules.ts` unless said otherwise. */
|
|
26
|
+
entry?: string;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
code: string;
|
|
29
|
+
}>;
|
|
@@ -1101,7 +1101,7 @@ var packageJson = {
|
|
|
1101
1101
|
url: "git+https://github.com/valbuild/val.git"
|
|
1102
1102
|
},
|
|
1103
1103
|
license: "MIT",
|
|
1104
|
-
version: "0.
|
|
1104
|
+
version: "0.146.0",
|
|
1105
1105
|
sideEffects: false,
|
|
1106
1106
|
main: "dist/valbuild-tanstack-build.cjs.js",
|
|
1107
1107
|
module: "dist/valbuild-tanstack-build.esm.js",
|
|
@@ -4501,6 +4501,155 @@ function treeShaOfText(files) {
|
|
|
4501
4501
|
})));
|
|
4502
4502
|
}
|
|
4503
4503
|
|
|
4504
|
+
/**
|
|
4505
|
+
* A project's `val.modules.ts`, bundled to run: every `.val.ts` it imports,
|
|
4506
|
+
* the `val.config` they share and the `.val.json` entries they name, as ONE
|
|
4507
|
+
* ES module -- so it can be imported from a `blob:` URL, which cannot resolve
|
|
4508
|
+
* a relative chunk -- with every npm import pointing at the site's own
|
|
4509
|
+
* vendor chunks, at absolute URLs under `origin`.
|
|
4510
|
+
*
|
|
4511
|
+
* What the builder tab evaluates to learn a tree's schemas: Update from the
|
|
4512
|
+
* site with code (valbuild/home `docs/hosted-publishing.md` step 8.2, slice
|
|
4513
|
+
* 1b). The project's own `@valbuild/*` and dependencies are what run, as the
|
|
4514
|
+
* site runs them -- the browser half of its layer, from `/_pvendor/<rev>/`,
|
|
4515
|
+
* and the base layer from `/_vendor/`. Whoever imports it should do so off
|
|
4516
|
+
* the Studio's page: `@valbuild/tanstack` brings React and patches its JSX.
|
|
4517
|
+
*
|
|
4518
|
+
* Nothing else of a build happens here: no route splitting, no server
|
|
4519
|
+
* functions, no CSS -- a `.val.ts` has none of it.
|
|
4520
|
+
*/
|
|
4521
|
+
function bundleValModules(_x) {
|
|
4522
|
+
return _bundleValModules.apply(this, arguments);
|
|
4523
|
+
}
|
|
4524
|
+
function _bundleValModules() {
|
|
4525
|
+
_bundleValModules = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee(input) {
|
|
4526
|
+
var _input$entry;
|
|
4527
|
+
var files, target, origin, entry, warnings, aliases, base, project, resolveProjectPath, result, chunks, _t;
|
|
4528
|
+
return regeneratorValues._regenerator().w(function (_context) {
|
|
4529
|
+
while (1) switch (_context.p = _context.n) {
|
|
4530
|
+
case 0:
|
|
4531
|
+
files = input.files, target = input.target, origin = input.origin;
|
|
4532
|
+
entry = (_input$entry = input.entry) !== null && _input$entry !== void 0 ? _input$entry : ["val.modules.ts", "val.modules.js"].find(function (path) {
|
|
4533
|
+
return path in files;
|
|
4534
|
+
});
|
|
4535
|
+
if (!(entry === undefined || !(entry in files))) {
|
|
4536
|
+
_context.n = 1;
|
|
4537
|
+
break;
|
|
4538
|
+
}
|
|
4539
|
+
throw new Error("This project has no val.modules.ts, so its Val modules cannot be read.");
|
|
4540
|
+
case 1:
|
|
4541
|
+
warnings = [];
|
|
4542
|
+
aliases = aliasMap(files, function (message) {
|
|
4543
|
+
return warnings.push(message);
|
|
4544
|
+
});
|
|
4545
|
+
base = "".concat(origin, "/_vendor/");
|
|
4546
|
+
project = target.project.rev === null ? null : "".concat(origin, "/_pvendor/").concat(target.project.rev, "/");
|
|
4547
|
+
resolveProjectPath = function resolveProjectPath(path) {
|
|
4548
|
+
return resolveInFiles(path, files);
|
|
4549
|
+
};
|
|
4550
|
+
_context.p = 2;
|
|
4551
|
+
_context.n = 3;
|
|
4552
|
+
return browser.build({
|
|
4553
|
+
input: entry,
|
|
4554
|
+
// See `buildOnce`: required in the browser, inert here.
|
|
4555
|
+
cwd: "/",
|
|
4556
|
+
moduleTypes: {
|
|
4557
|
+
".css": "empty"
|
|
4558
|
+
},
|
|
4559
|
+
plugins: [{
|
|
4560
|
+
name: "val:modules",
|
|
4561
|
+
resolveId: function resolveId(source, importer) {
|
|
4562
|
+
if (source.startsWith(".")) {
|
|
4563
|
+
return resolveProjectPath(resolve(dirname(importer !== null && importer !== void 0 ? importer : entry), source));
|
|
4564
|
+
}
|
|
4565
|
+
if (source in files) return source;
|
|
4566
|
+
var baseChunk = target.base.modules[source];
|
|
4567
|
+
if (baseChunk) {
|
|
4568
|
+
return {
|
|
4569
|
+
id: "".concat(base).concat(baseChunk, ".js"),
|
|
4570
|
+
external: true
|
|
4571
|
+
};
|
|
4572
|
+
}
|
|
4573
|
+
var projectChunk = target.project.modules[source];
|
|
4574
|
+
if (projectChunk && project !== null) {
|
|
4575
|
+
if (target.project.workerOnly.includes(source)) {
|
|
4576
|
+
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."));
|
|
4577
|
+
}
|
|
4578
|
+
return {
|
|
4579
|
+
id: "".concat(project).concat(projectChunk, ".js"),
|
|
4580
|
+
external: true
|
|
4581
|
+
};
|
|
4582
|
+
}
|
|
4583
|
+
if (aliases) {
|
|
4584
|
+
var _iterator = regeneratorValues._createForOfIteratorHelper(aliases.candidates(source)),
|
|
4585
|
+
_step;
|
|
4586
|
+
try {
|
|
4587
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
4588
|
+
var candidate = _step.value;
|
|
4589
|
+
var _hit = resolveProjectPath(candidate);
|
|
4590
|
+
if (_hit) return _hit;
|
|
4591
|
+
}
|
|
4592
|
+
} catch (err) {
|
|
4593
|
+
_iterator.e(err);
|
|
4594
|
+
} finally {
|
|
4595
|
+
_iterator.f();
|
|
4596
|
+
}
|
|
4597
|
+
var fromBaseUrl = aliases.baseUrlCandidate(source);
|
|
4598
|
+
var hit = fromBaseUrl && resolveProjectPath(fromBaseUrl);
|
|
4599
|
+
if (hit) return hit;
|
|
4600
|
+
}
|
|
4601
|
+
// An error, not a warning: rolldown would otherwise leave the
|
|
4602
|
+
// specifier as it is, and it would fail when imported, unnamed.
|
|
4603
|
+
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(", "), "."));
|
|
4604
|
+
},
|
|
4605
|
+
load: function load(id) {
|
|
4606
|
+
return id in files ? files[id] : null;
|
|
4607
|
+
}
|
|
4608
|
+
}],
|
|
4609
|
+
transform: {
|
|
4610
|
+
jsx: {
|
|
4611
|
+
runtime: "automatic",
|
|
4612
|
+
importSource: "react"
|
|
4613
|
+
}
|
|
4614
|
+
},
|
|
4615
|
+
output: {
|
|
4616
|
+
format: "esm",
|
|
4617
|
+
minify: false,
|
|
4618
|
+
// One module: `def: () => import("./x.val")` stays a dynamic import of
|
|
4619
|
+
// something already in the file.
|
|
4620
|
+
codeSplitting: false
|
|
4621
|
+
},
|
|
4622
|
+
write: false
|
|
4623
|
+
});
|
|
4624
|
+
case 3:
|
|
4625
|
+
result = _context.v;
|
|
4626
|
+
_context.n = 5;
|
|
4627
|
+
break;
|
|
4628
|
+
case 4:
|
|
4629
|
+
_context.p = 4;
|
|
4630
|
+
_t = _context.v;
|
|
4631
|
+
throw new Error(["The Val modules could not be bundled."].concat(warnings, [_t instanceof Error ? _t.message : String(_t)]).join("\n"), {
|
|
4632
|
+
cause: _t
|
|
4633
|
+
});
|
|
4634
|
+
case 5:
|
|
4635
|
+
chunks = result.output.filter(function (output) {
|
|
4636
|
+
return output.type === "chunk";
|
|
4637
|
+
});
|
|
4638
|
+
if (!(chunks.length !== 1)) {
|
|
4639
|
+
_context.n = 6;
|
|
4640
|
+
break;
|
|
4641
|
+
}
|
|
4642
|
+
throw new Error("Bundling the Val modules made ".concat(chunks.length, " chunks rather than one."));
|
|
4643
|
+
case 6:
|
|
4644
|
+
return _context.a(2, {
|
|
4645
|
+
code: chunks[0].code
|
|
4646
|
+
});
|
|
4647
|
+
}
|
|
4648
|
+
}, _callee, null, [[2, 4]]);
|
|
4649
|
+
}));
|
|
4650
|
+
return _bundleValModules.apply(this, arguments);
|
|
4651
|
+
}
|
|
4652
|
+
|
|
4504
4653
|
exports.INLINE_LIMIT = regeneratorValues.INLINE_LIMIT;
|
|
4505
4654
|
exports.base64Bytes = regeneratorValues.base64Bytes;
|
|
4506
4655
|
exports.isAsset = regeneratorValues.isAsset;
|
|
@@ -4519,6 +4668,7 @@ exports.bakedJob = bakedJob;
|
|
|
4519
4668
|
exports.blobSha = blobSha;
|
|
4520
4669
|
exports.buildInputId = buildInputId;
|
|
4521
4670
|
exports.buildUserApp = buildUserApp;
|
|
4671
|
+
exports.bundleValModules = bundleValModules;
|
|
4522
4672
|
exports.fetchBuildTarget = fetchBuildTarget;
|
|
4523
4673
|
exports.fetchBuildTargetRev = fetchBuildTargetRev;
|
|
4524
4674
|
exports.isValProject = isValProject;
|
|
@@ -1101,7 +1101,7 @@ var packageJson = {
|
|
|
1101
1101
|
url: "git+https://github.com/valbuild/val.git"
|
|
1102
1102
|
},
|
|
1103
1103
|
license: "MIT",
|
|
1104
|
-
version: "0.
|
|
1104
|
+
version: "0.146.0",
|
|
1105
1105
|
sideEffects: false,
|
|
1106
1106
|
main: "dist/valbuild-tanstack-build.cjs.js",
|
|
1107
1107
|
module: "dist/valbuild-tanstack-build.esm.js",
|
|
@@ -4501,6 +4501,155 @@ function treeShaOfText(files) {
|
|
|
4501
4501
|
})));
|
|
4502
4502
|
}
|
|
4503
4503
|
|
|
4504
|
+
/**
|
|
4505
|
+
* A project's `val.modules.ts`, bundled to run: every `.val.ts` it imports,
|
|
4506
|
+
* the `val.config` they share and the `.val.json` entries they name, as ONE
|
|
4507
|
+
* ES module -- so it can be imported from a `blob:` URL, which cannot resolve
|
|
4508
|
+
* a relative chunk -- with every npm import pointing at the site's own
|
|
4509
|
+
* vendor chunks, at absolute URLs under `origin`.
|
|
4510
|
+
*
|
|
4511
|
+
* What the builder tab evaluates to learn a tree's schemas: Update from the
|
|
4512
|
+
* site with code (valbuild/home `docs/hosted-publishing.md` step 8.2, slice
|
|
4513
|
+
* 1b). The project's own `@valbuild/*` and dependencies are what run, as the
|
|
4514
|
+
* site runs them -- the browser half of its layer, from `/_pvendor/<rev>/`,
|
|
4515
|
+
* and the base layer from `/_vendor/`. Whoever imports it should do so off
|
|
4516
|
+
* the Studio's page: `@valbuild/tanstack` brings React and patches its JSX.
|
|
4517
|
+
*
|
|
4518
|
+
* Nothing else of a build happens here: no route splitting, no server
|
|
4519
|
+
* functions, no CSS -- a `.val.ts` has none of it.
|
|
4520
|
+
*/
|
|
4521
|
+
function bundleValModules(_x) {
|
|
4522
|
+
return _bundleValModules.apply(this, arguments);
|
|
4523
|
+
}
|
|
4524
|
+
function _bundleValModules() {
|
|
4525
|
+
_bundleValModules = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee(input) {
|
|
4526
|
+
var _input$entry;
|
|
4527
|
+
var files, target, origin, entry, warnings, aliases, base, project, resolveProjectPath, result, chunks, _t;
|
|
4528
|
+
return regeneratorValues._regenerator().w(function (_context) {
|
|
4529
|
+
while (1) switch (_context.p = _context.n) {
|
|
4530
|
+
case 0:
|
|
4531
|
+
files = input.files, target = input.target, origin = input.origin;
|
|
4532
|
+
entry = (_input$entry = input.entry) !== null && _input$entry !== void 0 ? _input$entry : ["val.modules.ts", "val.modules.js"].find(function (path) {
|
|
4533
|
+
return path in files;
|
|
4534
|
+
});
|
|
4535
|
+
if (!(entry === undefined || !(entry in files))) {
|
|
4536
|
+
_context.n = 1;
|
|
4537
|
+
break;
|
|
4538
|
+
}
|
|
4539
|
+
throw new Error("This project has no val.modules.ts, so its Val modules cannot be read.");
|
|
4540
|
+
case 1:
|
|
4541
|
+
warnings = [];
|
|
4542
|
+
aliases = aliasMap(files, function (message) {
|
|
4543
|
+
return warnings.push(message);
|
|
4544
|
+
});
|
|
4545
|
+
base = "".concat(origin, "/_vendor/");
|
|
4546
|
+
project = target.project.rev === null ? null : "".concat(origin, "/_pvendor/").concat(target.project.rev, "/");
|
|
4547
|
+
resolveProjectPath = function resolveProjectPath(path) {
|
|
4548
|
+
return resolveInFiles(path, files);
|
|
4549
|
+
};
|
|
4550
|
+
_context.p = 2;
|
|
4551
|
+
_context.n = 3;
|
|
4552
|
+
return browser.build({
|
|
4553
|
+
input: entry,
|
|
4554
|
+
// See `buildOnce`: required in the browser, inert here.
|
|
4555
|
+
cwd: "/",
|
|
4556
|
+
moduleTypes: {
|
|
4557
|
+
".css": "empty"
|
|
4558
|
+
},
|
|
4559
|
+
plugins: [{
|
|
4560
|
+
name: "val:modules",
|
|
4561
|
+
resolveId: function resolveId(source, importer) {
|
|
4562
|
+
if (source.startsWith(".")) {
|
|
4563
|
+
return resolveProjectPath(resolve(dirname(importer !== null && importer !== void 0 ? importer : entry), source));
|
|
4564
|
+
}
|
|
4565
|
+
if (source in files) return source;
|
|
4566
|
+
var baseChunk = target.base.modules[source];
|
|
4567
|
+
if (baseChunk) {
|
|
4568
|
+
return {
|
|
4569
|
+
id: "".concat(base).concat(baseChunk, ".js"),
|
|
4570
|
+
external: true
|
|
4571
|
+
};
|
|
4572
|
+
}
|
|
4573
|
+
var projectChunk = target.project.modules[source];
|
|
4574
|
+
if (projectChunk && project !== null) {
|
|
4575
|
+
if (target.project.workerOnly.includes(source)) {
|
|
4576
|
+
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."));
|
|
4577
|
+
}
|
|
4578
|
+
return {
|
|
4579
|
+
id: "".concat(project).concat(projectChunk, ".js"),
|
|
4580
|
+
external: true
|
|
4581
|
+
};
|
|
4582
|
+
}
|
|
4583
|
+
if (aliases) {
|
|
4584
|
+
var _iterator = regeneratorValues._createForOfIteratorHelper(aliases.candidates(source)),
|
|
4585
|
+
_step;
|
|
4586
|
+
try {
|
|
4587
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
4588
|
+
var candidate = _step.value;
|
|
4589
|
+
var _hit = resolveProjectPath(candidate);
|
|
4590
|
+
if (_hit) return _hit;
|
|
4591
|
+
}
|
|
4592
|
+
} catch (err) {
|
|
4593
|
+
_iterator.e(err);
|
|
4594
|
+
} finally {
|
|
4595
|
+
_iterator.f();
|
|
4596
|
+
}
|
|
4597
|
+
var fromBaseUrl = aliases.baseUrlCandidate(source);
|
|
4598
|
+
var hit = fromBaseUrl && resolveProjectPath(fromBaseUrl);
|
|
4599
|
+
if (hit) return hit;
|
|
4600
|
+
}
|
|
4601
|
+
// An error, not a warning: rolldown would otherwise leave the
|
|
4602
|
+
// specifier as it is, and it would fail when imported, unnamed.
|
|
4603
|
+
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(", "), "."));
|
|
4604
|
+
},
|
|
4605
|
+
load: function load(id) {
|
|
4606
|
+
return id in files ? files[id] : null;
|
|
4607
|
+
}
|
|
4608
|
+
}],
|
|
4609
|
+
transform: {
|
|
4610
|
+
jsx: {
|
|
4611
|
+
runtime: "automatic",
|
|
4612
|
+
importSource: "react"
|
|
4613
|
+
}
|
|
4614
|
+
},
|
|
4615
|
+
output: {
|
|
4616
|
+
format: "esm",
|
|
4617
|
+
minify: false,
|
|
4618
|
+
// One module: `def: () => import("./x.val")` stays a dynamic import of
|
|
4619
|
+
// something already in the file.
|
|
4620
|
+
codeSplitting: false
|
|
4621
|
+
},
|
|
4622
|
+
write: false
|
|
4623
|
+
});
|
|
4624
|
+
case 3:
|
|
4625
|
+
result = _context.v;
|
|
4626
|
+
_context.n = 5;
|
|
4627
|
+
break;
|
|
4628
|
+
case 4:
|
|
4629
|
+
_context.p = 4;
|
|
4630
|
+
_t = _context.v;
|
|
4631
|
+
throw new Error(["The Val modules could not be bundled."].concat(warnings, [_t instanceof Error ? _t.message : String(_t)]).join("\n"), {
|
|
4632
|
+
cause: _t
|
|
4633
|
+
});
|
|
4634
|
+
case 5:
|
|
4635
|
+
chunks = result.output.filter(function (output) {
|
|
4636
|
+
return output.type === "chunk";
|
|
4637
|
+
});
|
|
4638
|
+
if (!(chunks.length !== 1)) {
|
|
4639
|
+
_context.n = 6;
|
|
4640
|
+
break;
|
|
4641
|
+
}
|
|
4642
|
+
throw new Error("Bundling the Val modules made ".concat(chunks.length, " chunks rather than one."));
|
|
4643
|
+
case 6:
|
|
4644
|
+
return _context.a(2, {
|
|
4645
|
+
code: chunks[0].code
|
|
4646
|
+
});
|
|
4647
|
+
}
|
|
4648
|
+
}, _callee, null, [[2, 4]]);
|
|
4649
|
+
}));
|
|
4650
|
+
return _bundleValModules.apply(this, arguments);
|
|
4651
|
+
}
|
|
4652
|
+
|
|
4504
4653
|
exports.INLINE_LIMIT = regeneratorValues.INLINE_LIMIT;
|
|
4505
4654
|
exports.base64Bytes = regeneratorValues.base64Bytes;
|
|
4506
4655
|
exports.isAsset = regeneratorValues.isAsset;
|
|
@@ -4519,6 +4668,7 @@ exports.bakedJob = bakedJob;
|
|
|
4519
4668
|
exports.blobSha = blobSha;
|
|
4520
4669
|
exports.buildInputId = buildInputId;
|
|
4521
4670
|
exports.buildUserApp = buildUserApp;
|
|
4671
|
+
exports.bundleValModules = bundleValModules;
|
|
4522
4672
|
exports.fetchBuildTarget = fetchBuildTarget;
|
|
4523
4673
|
exports.fetchBuildTargetRev = fetchBuildTargetRev;
|
|
4524
4674
|
exports.isValProject = isValProject;
|
|
@@ -1100,7 +1100,7 @@ var packageJson = {
|
|
|
1100
1100
|
url: "git+https://github.com/valbuild/val.git"
|
|
1101
1101
|
},
|
|
1102
1102
|
license: "MIT",
|
|
1103
|
-
version: "0.
|
|
1103
|
+
version: "0.146.0",
|
|
1104
1104
|
sideEffects: false,
|
|
1105
1105
|
main: "dist/valbuild-tanstack-build.cjs.js",
|
|
1106
1106
|
module: "dist/valbuild-tanstack-build.esm.js",
|
|
@@ -4500,4 +4500,153 @@ function treeShaOfText(files) {
|
|
|
4500
4500
|
})));
|
|
4501
4501
|
}
|
|
4502
4502
|
|
|
4503
|
-
|
|
4503
|
+
/**
|
|
4504
|
+
* A project's `val.modules.ts`, bundled to run: every `.val.ts` it imports,
|
|
4505
|
+
* the `val.config` they share and the `.val.json` entries they name, as ONE
|
|
4506
|
+
* ES module -- so it can be imported from a `blob:` URL, which cannot resolve
|
|
4507
|
+
* a relative chunk -- with every npm import pointing at the site's own
|
|
4508
|
+
* vendor chunks, at absolute URLs under `origin`.
|
|
4509
|
+
*
|
|
4510
|
+
* What the builder tab evaluates to learn a tree's schemas: Update from the
|
|
4511
|
+
* site with code (valbuild/home `docs/hosted-publishing.md` step 8.2, slice
|
|
4512
|
+
* 1b). The project's own `@valbuild/*` and dependencies are what run, as the
|
|
4513
|
+
* site runs them -- the browser half of its layer, from `/_pvendor/<rev>/`,
|
|
4514
|
+
* and the base layer from `/_vendor/`. Whoever imports it should do so off
|
|
4515
|
+
* the Studio's page: `@valbuild/tanstack` brings React and patches its JSX.
|
|
4516
|
+
*
|
|
4517
|
+
* Nothing else of a build happens here: no route splitting, no server
|
|
4518
|
+
* functions, no CSS -- a `.val.ts` has none of it.
|
|
4519
|
+
*/
|
|
4520
|
+
function bundleValModules(_x) {
|
|
4521
|
+
return _bundleValModules.apply(this, arguments);
|
|
4522
|
+
}
|
|
4523
|
+
function _bundleValModules() {
|
|
4524
|
+
_bundleValModules = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(input) {
|
|
4525
|
+
var _input$entry;
|
|
4526
|
+
var files, target, origin, entry, warnings, aliases, base, project, resolveProjectPath, result, chunks, _t;
|
|
4527
|
+
return _regenerator().w(function (_context) {
|
|
4528
|
+
while (1) switch (_context.p = _context.n) {
|
|
4529
|
+
case 0:
|
|
4530
|
+
files = input.files, target = input.target, origin = input.origin;
|
|
4531
|
+
entry = (_input$entry = input.entry) !== null && _input$entry !== void 0 ? _input$entry : ["val.modules.ts", "val.modules.js"].find(function (path) {
|
|
4532
|
+
return path in files;
|
|
4533
|
+
});
|
|
4534
|
+
if (!(entry === undefined || !(entry in files))) {
|
|
4535
|
+
_context.n = 1;
|
|
4536
|
+
break;
|
|
4537
|
+
}
|
|
4538
|
+
throw new Error("This project has no val.modules.ts, so its Val modules cannot be read.");
|
|
4539
|
+
case 1:
|
|
4540
|
+
warnings = [];
|
|
4541
|
+
aliases = aliasMap(files, function (message) {
|
|
4542
|
+
return warnings.push(message);
|
|
4543
|
+
});
|
|
4544
|
+
base = "".concat(origin, "/_vendor/");
|
|
4545
|
+
project = target.project.rev === null ? null : "".concat(origin, "/_pvendor/").concat(target.project.rev, "/");
|
|
4546
|
+
resolveProjectPath = function resolveProjectPath(path) {
|
|
4547
|
+
return resolveInFiles(path, files);
|
|
4548
|
+
};
|
|
4549
|
+
_context.p = 2;
|
|
4550
|
+
_context.n = 3;
|
|
4551
|
+
return build({
|
|
4552
|
+
input: entry,
|
|
4553
|
+
// See `buildOnce`: required in the browser, inert here.
|
|
4554
|
+
cwd: "/",
|
|
4555
|
+
moduleTypes: {
|
|
4556
|
+
".css": "empty"
|
|
4557
|
+
},
|
|
4558
|
+
plugins: [{
|
|
4559
|
+
name: "val:modules",
|
|
4560
|
+
resolveId: function resolveId(source, importer) {
|
|
4561
|
+
if (source.startsWith(".")) {
|
|
4562
|
+
return resolveProjectPath(resolve(dirname(importer !== null && importer !== void 0 ? importer : entry), source));
|
|
4563
|
+
}
|
|
4564
|
+
if (source in files) return source;
|
|
4565
|
+
var baseChunk = target.base.modules[source];
|
|
4566
|
+
if (baseChunk) {
|
|
4567
|
+
return {
|
|
4568
|
+
id: "".concat(base).concat(baseChunk, ".js"),
|
|
4569
|
+
external: true
|
|
4570
|
+
};
|
|
4571
|
+
}
|
|
4572
|
+
var projectChunk = target.project.modules[source];
|
|
4573
|
+
if (projectChunk && project !== null) {
|
|
4574
|
+
if (target.project.workerOnly.includes(source)) {
|
|
4575
|
+
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."));
|
|
4576
|
+
}
|
|
4577
|
+
return {
|
|
4578
|
+
id: "".concat(project).concat(projectChunk, ".js"),
|
|
4579
|
+
external: true
|
|
4580
|
+
};
|
|
4581
|
+
}
|
|
4582
|
+
if (aliases) {
|
|
4583
|
+
var _iterator = _createForOfIteratorHelper(aliases.candidates(source)),
|
|
4584
|
+
_step;
|
|
4585
|
+
try {
|
|
4586
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
4587
|
+
var candidate = _step.value;
|
|
4588
|
+
var _hit = resolveProjectPath(candidate);
|
|
4589
|
+
if (_hit) return _hit;
|
|
4590
|
+
}
|
|
4591
|
+
} catch (err) {
|
|
4592
|
+
_iterator.e(err);
|
|
4593
|
+
} finally {
|
|
4594
|
+
_iterator.f();
|
|
4595
|
+
}
|
|
4596
|
+
var fromBaseUrl = aliases.baseUrlCandidate(source);
|
|
4597
|
+
var hit = fromBaseUrl && resolveProjectPath(fromBaseUrl);
|
|
4598
|
+
if (hit) return hit;
|
|
4599
|
+
}
|
|
4600
|
+
// An error, not a warning: rolldown would otherwise leave the
|
|
4601
|
+
// specifier as it is, and it would fail when imported, unnamed.
|
|
4602
|
+
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(", "), "."));
|
|
4603
|
+
},
|
|
4604
|
+
load: function load(id) {
|
|
4605
|
+
return id in files ? files[id] : null;
|
|
4606
|
+
}
|
|
4607
|
+
}],
|
|
4608
|
+
transform: {
|
|
4609
|
+
jsx: {
|
|
4610
|
+
runtime: "automatic",
|
|
4611
|
+
importSource: "react"
|
|
4612
|
+
}
|
|
4613
|
+
},
|
|
4614
|
+
output: {
|
|
4615
|
+
format: "esm",
|
|
4616
|
+
minify: false,
|
|
4617
|
+
// One module: `def: () => import("./x.val")` stays a dynamic import of
|
|
4618
|
+
// something already in the file.
|
|
4619
|
+
codeSplitting: false
|
|
4620
|
+
},
|
|
4621
|
+
write: false
|
|
4622
|
+
});
|
|
4623
|
+
case 3:
|
|
4624
|
+
result = _context.v;
|
|
4625
|
+
_context.n = 5;
|
|
4626
|
+
break;
|
|
4627
|
+
case 4:
|
|
4628
|
+
_context.p = 4;
|
|
4629
|
+
_t = _context.v;
|
|
4630
|
+
throw new Error(["The Val modules could not be bundled."].concat(warnings, [_t instanceof Error ? _t.message : String(_t)]).join("\n"), {
|
|
4631
|
+
cause: _t
|
|
4632
|
+
});
|
|
4633
|
+
case 5:
|
|
4634
|
+
chunks = result.output.filter(function (output) {
|
|
4635
|
+
return output.type === "chunk";
|
|
4636
|
+
});
|
|
4637
|
+
if (!(chunks.length !== 1)) {
|
|
4638
|
+
_context.n = 6;
|
|
4639
|
+
break;
|
|
4640
|
+
}
|
|
4641
|
+
throw new Error("Bundling the Val modules made ".concat(chunks.length, " chunks rather than one."));
|
|
4642
|
+
case 6:
|
|
4643
|
+
return _context.a(2, {
|
|
4644
|
+
code: chunks[0].code
|
|
4645
|
+
});
|
|
4646
|
+
}
|
|
4647
|
+
}, _callee, null, [[2, 4]]);
|
|
4648
|
+
}));
|
|
4649
|
+
return _bundleValModules.apply(this, arguments);
|
|
4650
|
+
}
|
|
4651
|
+
|
|
4652
|
+
export { ENTRY_CHUNK, PROJECT_SOURCE, PUBLIC_PREFIX, VAL_SERVER_PATH, aliasMap, bakedGit, bakedJob, blobSha, buildInputId, buildUserApp, bundleValModules, fetchBuildTarget, fetchBuildTargetRev, isValProject, isWired, publishArtifacts, publishPayload, rebakeGit, resolveInFiles, scanCandidates, treeSha, treeShaOfText, usesTailwind, wireUp, wiredValServer, withoutBakedJob };
|
package/package.json
CHANGED