@valbuild/tanstack-build 0.150.1 → 0.150.12

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @valbuild/tanstack-build
2
2
 
3
+ ## 0.150.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [#980](https://github.com/valbuild/val/pull/980) [`46f07c7`](https://github.com/valbuild/val/commit/46f07c77f71b0d3b1f3964d648ff31eaf8e5eec3) Thanks [@freekh](https://github.com/freekh)! - Building a site in Safari (and every browser on an iPhone) no longer fails with "Cannot access '…' before initialization". The browser build loaded rolldown's bundler and its parser at the same time, and Safari could hand back the bundler before it had finished loading; they now load one after the other.
8
+
9
+ ## 0.150.9
10
+
11
+ ### Patch Changes
12
+
13
+ - [#971](https://github.com/valbuild/val/pull/971) [`fdb0280`](https://github.com/valbuild/val/commit/fdb02809830355e595127814c8e8676fdb0d5279) Thanks [@freekh](https://github.com/freekh)! - The Studio's files now also ship as plain files, so a host can serve them itself instead of from your app's server.
14
+
15
+ - `@valbuild/ui` includes `static/`: every Studio file, plus a `manifest.json` that says which request path under `/api/val/static` serves which file. Binary files are copied byte for byte. `@valbuild/ui/server` is unchanged, and so is every host that uses it.
16
+ - `@valbuild/tanstack-build` uses it on Val Build's hosting. When the platform says it serves build assets, the site's dependency layer leaves out the Studio copy embedded in `@valbuild/ui/server` and carries the Studio's files as build assets instead. The site's server then loads about 18 MB less JavaScript and uses roughly 80-100 MB less memory. That margin is what kept a Studio from loading on a hosted site: its server ran out of memory and was restarted on almost every request.
17
+
3
18
  ## 0.150.1
4
19
 
5
20
  ### Patch Changes
@@ -119,6 +119,21 @@ export interface BuildTarget {
119
119
  worker: Record<string, Array<string>>;
120
120
  browser: Record<string, Array<string>>;
121
121
  };
122
+ /**
123
+ * Whether this platform serves BUILD ASSETS: files a build names by
124
+ * content hash ({@link BuildAssets}), uploaded once and served by the
125
+ * platform itself rather than by the site's server.
126
+ *
127
+ * What a layer build reads it for is the Studio. `@valbuild/ui/server`
128
+ * carries every Studio file base64-embedded, which costs a server that
129
+ * loads it some 80-100 MB of heap -- inside a 128 MB isolate, too much.
130
+ * Where this is true the layer is built without that copy and carries the
131
+ * Studio's files as assets instead.
132
+ *
133
+ * Absent from a platform that predates it, and a layer is then built as
134
+ * it always was: a Studio without its files is worse than a heavy one.
135
+ */
136
+ buildAssets?: boolean;
122
137
  /** Where the chunks live, as seen from each kind of importer. */
123
138
  paths: {
124
139
  /** The base layer, from a project-layer chunk. */
@@ -169,3 +184,34 @@ export interface BuildTargetRev {
169
184
  rev: string | null;
170
185
  };
171
186
  }
187
+ /**
188
+ * One file a build names, by content: the platform stores it once, under its
189
+ * sha256, and serves it at every path a build maps to it.
190
+ */
191
+ export interface BuildAsset {
192
+ /** Lower-case hex sha256 of the bytes. Also the file's name in the store. */
193
+ sha256: string;
194
+ contentType: string;
195
+ cacheControl: string;
196
+ }
197
+ /**
198
+ * Files a build has the platform serve for it, by request path, before the
199
+ * request reaches the site's server.
200
+ *
201
+ * GENERIC on purpose. The Studio is the first thing served this way (see
202
+ * {@link BuildTarget}'s `base.buildAssets`), and the platform knows nothing
203
+ * of it: it follows this map. Anything else a build would rather not carry in
204
+ * its server -- a dependency's fonts, a site's own large files -- can be
205
+ * served the same way without the platform learning anything new.
206
+ */
207
+ export interface BuildAssets {
208
+ /** Request path (`/api/val/static/0.150.8/app`) -> the file served there. */
209
+ paths: Record<string, BuildAsset>;
210
+ /**
211
+ * What a path under `prefix` that is not in {@link paths} is answered with:
212
+ * a single-page app's index page. The longest matching prefix wins.
213
+ */
214
+ fallbacks: Array<BuildAsset & {
215
+ prefix: string;
216
+ }>;
217
+ }
@@ -1,4 +1,4 @@
1
- import type { BuildTarget } from "../contract.js";
1
+ import type { BuildAssets, BuildTarget } from "../contract.js";
2
2
  /**
3
3
  * Packages the base layer already provides.
4
4
  *
@@ -128,6 +128,20 @@ export interface VendorLayer {
128
128
  worker: Record<string, string>;
129
129
  /** Browser chunks, served under `/_pvendor/<rev>/`. */
130
130
  browser: Record<string, string>;
131
+ /**
132
+ * Files the platform serves for this layer, by request path: the Studio,
133
+ * where the platform serves build assets (`base.buildAssets`) and the
134
+ * project's `@valbuild/ui` ships its files (see `studioAssets.ts`). Absent
135
+ * otherwise.
136
+ */
137
+ assets?: BuildAssets;
138
+ /**
139
+ * The bytes {@link assets} names, base64, by sha256: for the publisher to
140
+ * upload, and never stored with the layer. The platform keeps each file
141
+ * once, by its hash, so a publisher asks which it is missing and sends
142
+ * only those.
143
+ */
144
+ assetBytes?: Record<string, string>;
131
145
  }
132
146
  /**
133
147
  * Val's own entry points that are server-only by contract, built for the
@@ -457,4 +457,4 @@ function _regeneratorValues(e) {
457
457
  throw new TypeError(typeof e + " is not iterable");
458
458
  }
459
459
 
460
- export { ASSET_BASE as A, INLINE_LIMIT as I, _slicedToArray as _, _createForOfIteratorHelper as a, _asyncToGenerator as b, _regenerator as c, _toConsumableArray as d, _typeof as e, _objectSpread2 as f, _defineProperty as g, _regeneratorValues as h, assetModule as i, isAsset as j, base64Bytes as k, _toPropertyKey as l, resolveAsset as r, sha256Hex as s };
460
+ export { ASSET_BASE as A, INLINE_LIMIT as I, _asyncToGenerator as _, _regenerator as a, _createForOfIteratorHelper as b, _toConsumableArray as c, _slicedToArray as d, _typeof as e, _objectSpread2 as f, _defineProperty as g, _regeneratorValues as h, assetModule as i, isAsset as j, base64Bytes as k, _toPropertyKey as l, resolveAsset as r, sha256Hex as s };
@@ -64,15 +64,40 @@ function useRolldown(rolldown) {
64
64
  */
65
65
  function loadRolldown() {
66
66
  if (chosen === null) {
67
- var loading = Promise.all([Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@rolldown/browser')); }), Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@rolldown/browser/parseAst')); })]).then(function (_ref) {
68
- var _ref2 = regeneratorValues._slicedToArray(_ref, 2),
69
- bundler = _ref2[0],
70
- parser = _ref2[1];
71
- return {
72
- build: bundler.build,
73
- parseAstAsync: parser.parseAstAsync
67
+ /*
68
+ * One after the other, never together. Both import the WASI binding,
69
+ * whose top-level `await` fetches and instantiates the WebAssembly, and
70
+ * Safari (every iPhone browser) can settle the second import of a graph
71
+ * whose shared module is still awaiting before that import's own body
72
+ * has run. `build` is a hoisted function there and `rolldown` a `const`,
73
+ * so the build got a `build` it could call, which threw "Cannot access
74
+ * 'Ha' before initialization." (minified) on its first line -- home's
75
+ * upgrade page, on an iPhone, while Chrome built the same upgrade. Once
76
+ * the bundler has loaded, the binding has finished, and the parser's
77
+ * import has nothing left to wait for.
78
+ */
79
+ var loading = Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@rolldown/browser')); }).then(/*#__PURE__*/function () {
80
+ var _ref = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee(bundler) {
81
+ var _t, _t2;
82
+ return regeneratorValues._regenerator().w(function (_context) {
83
+ while (1) switch (_context.n) {
84
+ case 0:
85
+ _t = bundler.build;
86
+ _context.n = 1;
87
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@rolldown/browser/parseAst')); });
88
+ case 1:
89
+ _t2 = _context.v.parseAstAsync;
90
+ return _context.a(2, {
91
+ build: _t,
92
+ parseAstAsync: _t2
93
+ });
94
+ }
95
+ }, _callee);
96
+ }));
97
+ return function (_x) {
98
+ return _ref.apply(this, arguments);
74
99
  };
75
- });
100
+ }());
76
101
  // A load that failed is tried again by the next caller, not kept.
77
102
  loading["catch"](function () {
78
103
  if (chosen === loading) chosen = null;
@@ -1185,7 +1210,7 @@ var packageJson = {
1185
1210
  url: "git+https://github.com/valbuild/val.git"
1186
1211
  },
1187
1212
  license: "MIT",
1188
- version: "0.150.1",
1213
+ version: "0.150.12",
1189
1214
  sideEffects: false,
1190
1215
  main: "dist/valbuild-tanstack-build.cjs.js",
1191
1216
  module: "dist/valbuild-tanstack-build.esm.js",
@@ -64,15 +64,40 @@ function useRolldown(rolldown) {
64
64
  */
65
65
  function loadRolldown() {
66
66
  if (chosen === null) {
67
- var loading = Promise.all([Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@rolldown/browser')); }), Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@rolldown/browser/parseAst')); })]).then(function (_ref) {
68
- var _ref2 = regeneratorValues._slicedToArray(_ref, 2),
69
- bundler = _ref2[0],
70
- parser = _ref2[1];
71
- return {
72
- build: bundler.build,
73
- parseAstAsync: parser.parseAstAsync
67
+ /*
68
+ * One after the other, never together. Both import the WASI binding,
69
+ * whose top-level `await` fetches and instantiates the WebAssembly, and
70
+ * Safari (every iPhone browser) can settle the second import of a graph
71
+ * whose shared module is still awaiting before that import's own body
72
+ * has run. `build` is a hoisted function there and `rolldown` a `const`,
73
+ * so the build got a `build` it could call, which threw "Cannot access
74
+ * 'Ha' before initialization." (minified) on its first line -- home's
75
+ * upgrade page, on an iPhone, while Chrome built the same upgrade. Once
76
+ * the bundler has loaded, the binding has finished, and the parser's
77
+ * import has nothing left to wait for.
78
+ */
79
+ var loading = Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@rolldown/browser')); }).then(/*#__PURE__*/function () {
80
+ var _ref = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee(bundler) {
81
+ var _t, _t2;
82
+ return regeneratorValues._regenerator().w(function (_context) {
83
+ while (1) switch (_context.n) {
84
+ case 0:
85
+ _t = bundler.build;
86
+ _context.n = 1;
87
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@rolldown/browser/parseAst')); });
88
+ case 1:
89
+ _t2 = _context.v.parseAstAsync;
90
+ return _context.a(2, {
91
+ build: _t,
92
+ parseAstAsync: _t2
93
+ });
94
+ }
95
+ }, _callee);
96
+ }));
97
+ return function (_x) {
98
+ return _ref.apply(this, arguments);
74
99
  };
75
- });
100
+ }());
76
101
  // A load that failed is tried again by the next caller, not kept.
77
102
  loading["catch"](function () {
78
103
  if (chosen === loading) chosen = null;
@@ -1185,7 +1210,7 @@ var packageJson = {
1185
1210
  url: "git+https://github.com/valbuild/val.git"
1186
1211
  },
1187
1212
  license: "MIT",
1188
- version: "0.150.1",
1213
+ version: "0.150.12",
1189
1214
  sideEffects: false,
1190
1215
  main: "dist/valbuild-tanstack-build.cjs.js",
1191
1216
  module: "dist/valbuild-tanstack-build.esm.js",
@@ -1,5 +1,5 @@
1
- import { _ as _slicedToArray, a as _createForOfIteratorHelper, b as _asyncToGenerator, c as _regenerator, d as _toConsumableArray, 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-a8bd356a.esm.js';
2
- export { I as INLINE_LIMIT, k as base64Bytes, j as isAsset } from './regeneratorValues-a8bd356a.esm.js';
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
+ export { I as INLINE_LIMIT, k as base64Bytes, j as isAsset } from './regeneratorValues-56b72784.esm.js';
3
3
  import { T as TREE, E as ENTRY } from './projectPaths-5e4defea.esm.js';
4
4
  export { E as ENTRY, R as ROUTES_DIR, T as TREE } from './projectPaths-5e4defea.esm.js';
5
5
  import { compile } from 'tailwindcss';
@@ -45,15 +45,40 @@ function useRolldown(rolldown) {
45
45
  */
46
46
  function loadRolldown() {
47
47
  if (chosen === null) {
48
- var loading = Promise.all([import('@rolldown/browser'), import('@rolldown/browser/parseAst')]).then(function (_ref) {
49
- var _ref2 = _slicedToArray(_ref, 2),
50
- bundler = _ref2[0],
51
- parser = _ref2[1];
52
- return {
53
- build: bundler.build,
54
- parseAstAsync: parser.parseAstAsync
48
+ /*
49
+ * One after the other, never together. Both import the WASI binding,
50
+ * whose top-level `await` fetches and instantiates the WebAssembly, and
51
+ * Safari (every iPhone browser) can settle the second import of a graph
52
+ * whose shared module is still awaiting before that import's own body
53
+ * has run. `build` is a hoisted function there and `rolldown` a `const`,
54
+ * so the build got a `build` it could call, which threw "Cannot access
55
+ * 'Ha' before initialization." (minified) on its first line -- home's
56
+ * upgrade page, on an iPhone, while Chrome built the same upgrade. Once
57
+ * the bundler has loaded, the binding has finished, and the parser's
58
+ * import has nothing left to wait for.
59
+ */
60
+ var loading = import('@rolldown/browser').then(/*#__PURE__*/function () {
61
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(bundler) {
62
+ var _t, _t2;
63
+ return _regenerator().w(function (_context) {
64
+ while (1) switch (_context.n) {
65
+ case 0:
66
+ _t = bundler.build;
67
+ _context.n = 1;
68
+ return import('@rolldown/browser/parseAst');
69
+ case 1:
70
+ _t2 = _context.v.parseAstAsync;
71
+ return _context.a(2, {
72
+ build: _t,
73
+ parseAstAsync: _t2
74
+ });
75
+ }
76
+ }, _callee);
77
+ }));
78
+ return function (_x) {
79
+ return _ref.apply(this, arguments);
55
80
  };
56
- });
81
+ }());
57
82
  // A load that failed is tried again by the next caller, not kept.
58
83
  loading["catch"](function () {
59
84
  if (chosen === loading) chosen = null;
@@ -1166,7 +1191,7 @@ var packageJson = {
1166
1191
  url: "git+https://github.com/valbuild/val.git"
1167
1192
  },
1168
1193
  license: "MIT",
1169
- version: "0.150.1",
1194
+ version: "0.150.12",
1170
1195
  sideEffects: false,
1171
1196
  main: "dist/valbuild-tanstack-build.cjs.js",
1172
1197
  module: "dist/valbuild-tanstack-build.esm.js",