@quilted/rollup 0.1.6 → 0.1.8

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,21 @@
1
1
  # @quilted/rollup
2
2
 
3
+ ## 0.1.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`86430876`](https://github.com/lemonmade/quilt/commit/864308760c9105cfe4b403ea54916c314af0e50b) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix asset manifest plugins
8
+
9
+ - [`e2038611`](https://github.com/lemonmade/quilt/commit/e203861184c39bc008ed7358f541944aa7db1cdd) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix 'use client' directive in server builds
10
+
11
+ ## 0.1.7
12
+
13
+ ### Patch Changes
14
+
15
+ - [`f450b0e4`](https://github.com/lemonmade/quilt/commit/f450b0e4ff5026dfd98f8fa044fb1fa26c0861bf) Thanks [@lemonmade](https://github.com/lemonmade)! - Actually fix Babel `target` option
16
+
17
+ - [`29564cdc`](https://github.com/lemonmade/quilt/commit/29564cdcd0f82cb5bb2eee6d76ad9314db28d14c) Thanks [@lemonmade](https://github.com/lemonmade)! - Add asset plugins
18
+
3
19
  ## 0.1.6
4
20
 
5
21
  ### Patch Changes
package/build/cjs/app.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var path = require('node:path');
4
+ var fs = require('node:fs/promises');
4
5
  var constants = require('./constants.cjs');
5
6
  var strings = require('./shared/strings.cjs');
6
7
  var rollup = require('./shared/rollup.cjs');
@@ -24,6 +25,7 @@ function _interopNamespaceDefault(e) {
24
25
  }
25
26
 
26
27
  var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
28
+ var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
27
29
 
28
30
  async function quiltAppBrowser({
29
31
  app,
@@ -35,8 +37,11 @@ async function quiltAppBrowser({
35
37
  } = {}) {
36
38
  const mode = (typeof env === 'object' ? env?.mode : undefined) ?? 'production';
37
39
  const minify = assets?.minify ?? mode === 'production';
40
+ const baseURL = assets?.baseURL ?? '/assets/';
38
41
  const [{
39
42
  visualizer
43
+ }, {
44
+ assetManifest
40
45
  }, {
41
46
  sourceCode
42
47
  }, {
@@ -46,12 +51,18 @@ async function quiltAppBrowser({
46
51
  staticAssets
47
52
  }, {
48
53
  systemJS
49
- }, nodePlugins] = await Promise.all([import('rollup-plugin-visualizer'), Promise.resolve().then(function () { return require('./features/source-code.cjs'); }), Promise.resolve().then(function () { return require('./features/css.cjs'); }), Promise.resolve().then(function () { return require('./features/assets.cjs'); }), Promise.resolve().then(function () { return require('./features/system-js.cjs'); }), rollup.getNodePlugins()]);
50
- const plugins = [...nodePlugins, systemJS(), sourceCode({
54
+ }, nodePlugins] = await Promise.all([import('rollup-plugin-visualizer'), import('@quilted/assets/rollup'), Promise.resolve().then(function () { return require('./features/source-code.cjs'); }), Promise.resolve().then(function () { return require('./features/css.cjs'); }), Promise.resolve().then(function () { return require('./features/assets.cjs'); }), Promise.resolve().then(function () { return require('./features/system-js.cjs'); }), rollup.getNodePlugins()]);
55
+ const plugins = [...nodePlugins, systemJS({
56
+ minify
57
+ }), sourceCode({
51
58
  mode
52
59
  }), css({
53
- minify
54
- }), rawAssets(), staticAssets()];
60
+ minify,
61
+ emit: true
62
+ }), rawAssets(), staticAssets({
63
+ baseURL,
64
+ emit: true
65
+ })];
55
66
  if (env) {
56
67
  const {
57
68
  magicModuleEnv,
@@ -93,11 +104,16 @@ async function quiltAppBrowser({
93
104
  } = await import('rollup-plugin-esbuild');
94
105
  plugins.push(minify());
95
106
  }
96
- plugins.push(visualizer({
107
+ plugins.push(
108
+ // @ts-expect-error The plugin still depends on Rollup 3
109
+ assetManifest({
110
+ baseUrl: baseURL,
111
+ path: path__namespace.resolve(`build/manifests/assets.json`)
112
+ }), visualizer({
97
113
  template: 'treemap',
98
114
  open: false,
99
115
  brotliSize: true,
100
- filename: path__namespace.resolve(`reports/bundle-visualizer.html`)
116
+ filename: path__namespace.resolve(`build/reports/bundle-visualizer.html`)
101
117
  }));
102
118
  return {
103
119
  input: entry,
@@ -144,7 +160,8 @@ async function quiltAppServer({
144
160
  const plugins = [...nodePlugins, sourceCode({
145
161
  mode
146
162
  }), css({
147
- emit: false
163
+ emit: false,
164
+ minify
148
165
  }), rawAssets(), staticAssets({
149
166
  emit: false
150
167
  })];
@@ -178,6 +195,7 @@ async function quiltAppServer({
178
195
  plugins.push(magicModuleAppRequestRouter({
179
196
  entry
180
197
  }));
198
+ plugins.push(magicModuleAppAssetManifests());
181
199
  if (graphql) {
182
200
  const {
183
201
  graphql
@@ -196,11 +214,19 @@ async function quiltAppServer({
196
214
  template: 'treemap',
197
215
  open: false,
198
216
  brotliSize: true,
199
- filename: path__namespace.resolve(`reports/bundle-visualizer.html`)
217
+ filename: path__namespace.resolve(`build/reports/bundle-visualizer.html`)
200
218
  }));
201
219
  return {
202
220
  input: entry,
203
221
  plugins,
222
+ onwarn(warning, defaultWarn) {
223
+ // Removes annoying warnings for React-focused libraries that
224
+ // include 'use client' directives.
225
+ if (warning.code === 'MODULE_LEVEL_DIRECTIVE' && /['"]use client['"]/.test(warning.message)) {
226
+ return;
227
+ }
228
+ defaultWarn(warning);
229
+ },
204
230
  output: {
205
231
  // format: isESM ? 'esm' : 'systemjs',
206
232
  format: 'esm',
@@ -279,6 +305,43 @@ function magicModuleAppBrowserEntry({
279
305
  }
280
306
  });
281
307
  }
308
+ function magicModuleAppAssetManifests() {
309
+ return magicModule.createMagicModulePlugin({
310
+ name: '@quilted/magic-module/asset-manifests',
311
+ module: constants.MAGIC_MODULE_BROWSER_ASSETS,
312
+ async source() {
313
+ const {
314
+ glob
315
+ } = await import('glob');
316
+ const manifestFiles = await glob('assets*.json', {
317
+ nodir: true,
318
+ absolute: true,
319
+ cwd: path__namespace.resolve(`build/manifests`)
320
+ });
321
+ const manifests = await Promise.all(manifestFiles.map(async file => JSON.parse(await fs__namespace.readFile(file, 'utf8'))));
322
+ manifests.sort((manifestA, manifestB) => (manifestA.priority ?? 0) - (manifestB.priority ?? 0));
323
+ return strings.multiline`
324
+ import {BrowserAssetsFromManifests} from '@quilted/quilt/server';
325
+
326
+ export class BrowserAssets extends BrowserAssetsFromManifests {
327
+ constructor() {
328
+ const manifests = JSON.parse(${JSON.stringify(JSON.stringify(manifests))});
329
+
330
+ // The default manifest is the last one, since it has the widest browser support.
331
+ const defaultManifest = manifests.at(-1);
332
+
333
+ super(manifests, {
334
+ defaultManifest,
335
+ cacheKey(request) {
336
+ return {};
337
+ },
338
+ });
339
+ }
340
+ }
341
+ `;
342
+ }
343
+ });
344
+ }
282
345
  const FRAMEWORK_CHUNK_NAME = 'framework';
283
346
  const POLYFILLS_CHUNK_NAME = 'polyfills';
284
347
  const VENDOR_CHUNK_NAME = 'vendor';
@@ -346,6 +409,7 @@ function createManualChunksSorter() {
346
409
  };
347
410
  }
348
411
 
412
+ exports.magicModuleAppAssetManifests = magicModuleAppAssetManifests;
349
413
  exports.magicModuleAppBrowserEntry = magicModuleAppBrowserEntry;
350
414
  exports.magicModuleAppComponent = magicModuleAppComponent;
351
415
  exports.magicModuleAppRequestRouter = magicModuleAppRequestRouter;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var path = require('node:path');
4
- var promises = require('node:fs/promises');
4
+ var fs = require('node:fs/promises');
5
5
  var node_crypto = require('node:crypto');
6
6
  var mime = require('mrmime');
7
7
 
@@ -48,7 +48,7 @@ function rawAssets() {
48
48
  }
49
49
  const moduleId = cleanModuleIdentifier(id);
50
50
  this.addWatchFile(moduleId);
51
- const file = await promises.readFile(moduleId, {
51
+ const file = await fs.readFile(moduleId, {
52
52
  encoding: 'utf-8'
53
53
  });
54
54
  return `export default ${JSON.stringify(file)}`;
@@ -75,7 +75,7 @@ function staticAssets({
75
75
  return cached;
76
76
  }
77
77
  const file = cleanModuleIdentifier(id);
78
- const content = await promises.readFile(file);
78
+ const content = await fs.readFile(file);
79
79
  let url;
80
80
  if (!file.endsWith('.svg') && content.length < inlineLimit) {
81
81
  // base64 inlined as a string
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var path = require('node:path');
4
- var promises = require('node:fs/promises');
4
+ var fs = require('node:fs/promises');
5
5
  var graphql$1 = require('graphql');
6
6
  var transform = require('./graphql/transform.cjs');
7
7
 
@@ -46,10 +46,10 @@ function graphql({
46
46
  operations[operation.id] = operation.source;
47
47
  }
48
48
  }
49
- await promises.mkdir(path.dirname(manifestPath), {
49
+ await fs.mkdir(path.dirname(manifestPath), {
50
50
  recursive: true
51
51
  });
52
- await promises.writeFile(manifestPath, JSON.stringify(operations, null, 2));
52
+ await fs.writeFile(manifestPath, JSON.stringify(operations, null, 2));
53
53
  }
54
54
  };
55
55
  }
@@ -71,7 +71,7 @@ async function loadDocument(code, file, plugin, add, level = 0, seen = new Set()
71
71
  throw new Error(`Could not find ${JSON.stringify(imported)} from ${JSON.stringify(file)}`);
72
72
  }
73
73
  plugin.addWatchFile(resolvedId.id);
74
- const contents = await promises.readFile(resolvedId.id, {
74
+ const contents = await fs.readFile(resolvedId.id, {
75
75
  encoding: 'utf8'
76
76
  });
77
77
  return loadDocument(contents, resolvedId.id, plugin, add, level + 1, seen);
@@ -30,7 +30,6 @@ function sourceCode({
30
30
  plugins: [[require$1.resolve('@babel/plugin-proposal-decorators'), {
31
31
  version: '2023-01'
32
32
  }]],
33
- targets,
34
33
  extensions: ['.ts', '.tsx', '.mts', '.mtsx', '.js', '.jsx', '.es6', '.es', '.mjs'],
35
34
  exclude: 'node_modules/**',
36
35
  babelHelpers: 'bundled',
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var promises = require('node:fs/promises');
3
+ var fs = require('node:fs/promises');
4
4
  var node_module = require('node:module');
5
5
 
6
6
  function systemJS({
@@ -19,7 +19,7 @@ function systemJS({
19
19
  const fileHandle = this.emitFile({
20
20
  type: 'asset',
21
21
  name: 'loader.js',
22
- source: (await promises.readFile(systemjs, {
22
+ source: (await fs.readFile(systemjs, {
23
23
  encoding: 'utf8'
24
24
  })).replace(
25
25
  // Remove the source map comment, if it is present, because we don’t upload the
package/build/esm/app.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as path from 'node:path';
2
+ import * as fs from 'node:fs/promises';
2
3
  import { MAGIC_MODULE_ENTRY, MAGIC_MODULE_APP_COMPONENT, MAGIC_MODULE_REQUEST_ROUTER, MAGIC_MODULE_BROWSER_ASSETS } from './constants.mjs';
3
4
  import { multiline } from './shared/strings.mjs';
4
5
  import { getNodePlugins } from './shared/rollup.mjs';
@@ -14,8 +15,11 @@ async function quiltAppBrowser({
14
15
  } = {}) {
15
16
  const mode = (typeof env === 'object' ? env?.mode : undefined) ?? 'production';
16
17
  const minify = assets?.minify ?? mode === 'production';
18
+ const baseURL = assets?.baseURL ?? '/assets/';
17
19
  const [{
18
20
  visualizer
21
+ }, {
22
+ assetManifest
19
23
  }, {
20
24
  sourceCode
21
25
  }, {
@@ -25,12 +29,18 @@ async function quiltAppBrowser({
25
29
  staticAssets
26
30
  }, {
27
31
  systemJS
28
- }, nodePlugins] = await Promise.all([import('rollup-plugin-visualizer'), import('./features/source-code.mjs'), import('./features/css.mjs'), import('./features/assets.mjs'), import('./features/system-js.mjs'), getNodePlugins()]);
29
- const plugins = [...nodePlugins, systemJS(), sourceCode({
32
+ }, nodePlugins] = await Promise.all([import('rollup-plugin-visualizer'), import('@quilted/assets/rollup'), import('./features/source-code.mjs'), import('./features/css.mjs'), import('./features/assets.mjs'), import('./features/system-js.mjs'), getNodePlugins()]);
33
+ const plugins = [...nodePlugins, systemJS({
34
+ minify
35
+ }), sourceCode({
30
36
  mode
31
37
  }), css({
32
- minify
33
- }), rawAssets(), staticAssets()];
38
+ minify,
39
+ emit: true
40
+ }), rawAssets(), staticAssets({
41
+ baseURL,
42
+ emit: true
43
+ })];
34
44
  if (env) {
35
45
  const {
36
46
  magicModuleEnv,
@@ -72,11 +82,16 @@ async function quiltAppBrowser({
72
82
  } = await import('rollup-plugin-esbuild');
73
83
  plugins.push(minify());
74
84
  }
75
- plugins.push(visualizer({
85
+ plugins.push(
86
+ // @ts-expect-error The plugin still depends on Rollup 3
87
+ assetManifest({
88
+ baseUrl: baseURL,
89
+ path: path.resolve(`build/manifests/assets.json`)
90
+ }), visualizer({
76
91
  template: 'treemap',
77
92
  open: false,
78
93
  brotliSize: true,
79
- filename: path.resolve(`reports/bundle-visualizer.html`)
94
+ filename: path.resolve(`build/reports/bundle-visualizer.html`)
80
95
  }));
81
96
  return {
82
97
  input: entry,
@@ -123,7 +138,8 @@ async function quiltAppServer({
123
138
  const plugins = [...nodePlugins, sourceCode({
124
139
  mode
125
140
  }), css({
126
- emit: false
141
+ emit: false,
142
+ minify
127
143
  }), rawAssets(), staticAssets({
128
144
  emit: false
129
145
  })];
@@ -157,6 +173,7 @@ async function quiltAppServer({
157
173
  plugins.push(magicModuleAppRequestRouter({
158
174
  entry
159
175
  }));
176
+ plugins.push(magicModuleAppAssetManifests());
160
177
  if (graphql) {
161
178
  const {
162
179
  graphql
@@ -175,11 +192,19 @@ async function quiltAppServer({
175
192
  template: 'treemap',
176
193
  open: false,
177
194
  brotliSize: true,
178
- filename: path.resolve(`reports/bundle-visualizer.html`)
195
+ filename: path.resolve(`build/reports/bundle-visualizer.html`)
179
196
  }));
180
197
  return {
181
198
  input: entry,
182
199
  plugins,
200
+ onwarn(warning, defaultWarn) {
201
+ // Removes annoying warnings for React-focused libraries that
202
+ // include 'use client' directives.
203
+ if (warning.code === 'MODULE_LEVEL_DIRECTIVE' && /['"]use client['"]/.test(warning.message)) {
204
+ return;
205
+ }
206
+ defaultWarn(warning);
207
+ },
183
208
  output: {
184
209
  // format: isESM ? 'esm' : 'systemjs',
185
210
  format: 'esm',
@@ -258,6 +283,43 @@ function magicModuleAppBrowserEntry({
258
283
  }
259
284
  });
260
285
  }
286
+ function magicModuleAppAssetManifests() {
287
+ return createMagicModulePlugin({
288
+ name: '@quilted/magic-module/asset-manifests',
289
+ module: MAGIC_MODULE_BROWSER_ASSETS,
290
+ async source() {
291
+ const {
292
+ glob
293
+ } = await import('glob');
294
+ const manifestFiles = await glob('assets*.json', {
295
+ nodir: true,
296
+ absolute: true,
297
+ cwd: path.resolve(`build/manifests`)
298
+ });
299
+ const manifests = await Promise.all(manifestFiles.map(async file => JSON.parse(await fs.readFile(file, 'utf8'))));
300
+ manifests.sort((manifestA, manifestB) => (manifestA.priority ?? 0) - (manifestB.priority ?? 0));
301
+ return multiline`
302
+ import {BrowserAssetsFromManifests} from '@quilted/quilt/server';
303
+
304
+ export class BrowserAssets extends BrowserAssetsFromManifests {
305
+ constructor() {
306
+ const manifests = JSON.parse(${JSON.stringify(JSON.stringify(manifests))});
307
+
308
+ // The default manifest is the last one, since it has the widest browser support.
309
+ const defaultManifest = manifests.at(-1);
310
+
311
+ super(manifests, {
312
+ defaultManifest,
313
+ cacheKey(request) {
314
+ return {};
315
+ },
316
+ });
317
+ }
318
+ }
319
+ `;
320
+ }
321
+ });
322
+ }
261
323
  const FRAMEWORK_CHUNK_NAME = 'framework';
262
324
  const POLYFILLS_CHUNK_NAME = 'polyfills';
263
325
  const VENDOR_CHUNK_NAME = 'vendor';
@@ -325,4 +387,4 @@ function createManualChunksSorter() {
325
387
  };
326
388
  }
327
389
 
328
- export { magicModuleAppBrowserEntry, magicModuleAppComponent, magicModuleAppRequestRouter, quiltAppBrowser, quiltAppServer };
390
+ export { magicModuleAppAssetManifests, magicModuleAppBrowserEntry, magicModuleAppComponent, magicModuleAppRequestRouter, quiltAppBrowser, quiltAppServer };
@@ -28,7 +28,6 @@ function sourceCode({
28
28
  plugins: [[require.resolve('@babel/plugin-proposal-decorators'), {
29
29
  version: '2023-01'
30
30
  }]],
31
- targets,
32
31
  extensions: ['.ts', '.tsx', '.mts', '.mtsx', '.js', '.jsx', '.es6', '.es', '.mjs'],
33
32
  exclude: 'node_modules/**',
34
33
  babelHelpers: 'bundled',
@@ -1,4 +1,5 @@
1
1
  import * as path from 'node:path';
2
+ import * as fs from 'node:fs/promises';
2
3
  import { MAGIC_MODULE_ENTRY, MAGIC_MODULE_APP_COMPONENT, MAGIC_MODULE_REQUEST_ROUTER, MAGIC_MODULE_BROWSER_ASSETS } from './constants.esnext';
3
4
  import { multiline } from './shared/strings.esnext';
4
5
  import { getNodePlugins } from './shared/rollup.esnext';
@@ -14,8 +15,11 @@ async function quiltAppBrowser({
14
15
  } = {}) {
15
16
  const mode = (typeof env === 'object' ? env?.mode : undefined) ?? 'production';
16
17
  const minify = assets?.minify ?? mode === 'production';
18
+ const baseURL = assets?.baseURL ?? '/assets/';
17
19
  const [{
18
20
  visualizer
21
+ }, {
22
+ assetManifest
19
23
  }, {
20
24
  sourceCode
21
25
  }, {
@@ -25,12 +29,18 @@ async function quiltAppBrowser({
25
29
  staticAssets
26
30
  }, {
27
31
  systemJS
28
- }, nodePlugins] = await Promise.all([import('rollup-plugin-visualizer'), import('./features/source-code.esnext'), import('./features/css.esnext'), import('./features/assets.esnext'), import('./features/system-js.esnext'), getNodePlugins()]);
29
- const plugins = [...nodePlugins, systemJS(), sourceCode({
32
+ }, nodePlugins] = await Promise.all([import('rollup-plugin-visualizer'), import('@quilted/assets/rollup'), import('./features/source-code.esnext'), import('./features/css.esnext'), import('./features/assets.esnext'), import('./features/system-js.esnext'), getNodePlugins()]);
33
+ const plugins = [...nodePlugins, systemJS({
34
+ minify
35
+ }), sourceCode({
30
36
  mode
31
37
  }), css({
32
- minify
33
- }), rawAssets(), staticAssets()];
38
+ minify,
39
+ emit: true
40
+ }), rawAssets(), staticAssets({
41
+ baseURL,
42
+ emit: true
43
+ })];
34
44
  if (env) {
35
45
  const {
36
46
  magicModuleEnv,
@@ -72,11 +82,16 @@ async function quiltAppBrowser({
72
82
  } = await import('rollup-plugin-esbuild');
73
83
  plugins.push(minify());
74
84
  }
75
- plugins.push(visualizer({
85
+ plugins.push(
86
+ // @ts-expect-error The plugin still depends on Rollup 3
87
+ assetManifest({
88
+ baseUrl: baseURL,
89
+ path: path.resolve(`build/manifests/assets.json`)
90
+ }), visualizer({
76
91
  template: 'treemap',
77
92
  open: false,
78
93
  brotliSize: true,
79
- filename: path.resolve(`reports/bundle-visualizer.html`)
94
+ filename: path.resolve(`build/reports/bundle-visualizer.html`)
80
95
  }));
81
96
  return {
82
97
  input: entry,
@@ -123,7 +138,8 @@ async function quiltAppServer({
123
138
  const plugins = [...nodePlugins, sourceCode({
124
139
  mode
125
140
  }), css({
126
- emit: false
141
+ emit: false,
142
+ minify
127
143
  }), rawAssets(), staticAssets({
128
144
  emit: false
129
145
  })];
@@ -157,6 +173,7 @@ async function quiltAppServer({
157
173
  plugins.push(magicModuleAppRequestRouter({
158
174
  entry
159
175
  }));
176
+ plugins.push(magicModuleAppAssetManifests());
160
177
  if (graphql) {
161
178
  const {
162
179
  graphql
@@ -175,11 +192,19 @@ async function quiltAppServer({
175
192
  template: 'treemap',
176
193
  open: false,
177
194
  brotliSize: true,
178
- filename: path.resolve(`reports/bundle-visualizer.html`)
195
+ filename: path.resolve(`build/reports/bundle-visualizer.html`)
179
196
  }));
180
197
  return {
181
198
  input: entry,
182
199
  plugins,
200
+ onwarn(warning, defaultWarn) {
201
+ // Removes annoying warnings for React-focused libraries that
202
+ // include 'use client' directives.
203
+ if (warning.code === 'MODULE_LEVEL_DIRECTIVE' && /['"]use client['"]/.test(warning.message)) {
204
+ return;
205
+ }
206
+ defaultWarn(warning);
207
+ },
183
208
  output: {
184
209
  // format: isESM ? 'esm' : 'systemjs',
185
210
  format: 'esm',
@@ -258,6 +283,43 @@ function magicModuleAppBrowserEntry({
258
283
  }
259
284
  });
260
285
  }
286
+ function magicModuleAppAssetManifests() {
287
+ return createMagicModulePlugin({
288
+ name: '@quilted/magic-module/asset-manifests',
289
+ module: MAGIC_MODULE_BROWSER_ASSETS,
290
+ async source() {
291
+ const {
292
+ glob
293
+ } = await import('glob');
294
+ const manifestFiles = await glob('assets*.json', {
295
+ nodir: true,
296
+ absolute: true,
297
+ cwd: path.resolve(`build/manifests`)
298
+ });
299
+ const manifests = await Promise.all(manifestFiles.map(async file => JSON.parse(await fs.readFile(file, 'utf8'))));
300
+ manifests.sort((manifestA, manifestB) => (manifestA.priority ?? 0) - (manifestB.priority ?? 0));
301
+ return multiline`
302
+ import {BrowserAssetsFromManifests} from '@quilted/quilt/server';
303
+
304
+ export class BrowserAssets extends BrowserAssetsFromManifests {
305
+ constructor() {
306
+ const manifests = JSON.parse(${JSON.stringify(JSON.stringify(manifests))});
307
+
308
+ // The default manifest is the last one, since it has the widest browser support.
309
+ const defaultManifest = manifests.at(-1);
310
+
311
+ super(manifests, {
312
+ defaultManifest,
313
+ cacheKey(request) {
314
+ return {};
315
+ },
316
+ });
317
+ }
318
+ }
319
+ `;
320
+ }
321
+ });
322
+ }
261
323
  const FRAMEWORK_CHUNK_NAME = 'framework';
262
324
  const POLYFILLS_CHUNK_NAME = 'polyfills';
263
325
  const VENDOR_CHUNK_NAME = 'vendor';
@@ -325,4 +387,4 @@ function createManualChunksSorter() {
325
387
  };
326
388
  }
327
389
 
328
- export { magicModuleAppBrowserEntry, magicModuleAppComponent, magicModuleAppRequestRouter, quiltAppBrowser, quiltAppServer };
390
+ export { magicModuleAppAssetManifests, magicModuleAppBrowserEntry, magicModuleAppComponent, magicModuleAppRequestRouter, quiltAppBrowser, quiltAppServer };
@@ -28,7 +28,6 @@ function sourceCode({
28
28
  plugins: [[require.resolve('@babel/plugin-proposal-decorators'), {
29
29
  version: '2023-01'
30
30
  }]],
31
- targets,
32
31
  extensions: ['.ts', '.tsx', '.mts', '.mtsx', '.js', '.jsx', '.es6', '.es', '.mjs'],
33
32
  exclude: 'node_modules/**',
34
33
  babelHelpers: 'bundled',