@quilted/rollup 0.2.19 → 0.2.21

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,17 @@
1
1
  # @quilted/rollup
2
2
 
3
+ ## 0.2.21
4
+
5
+ ### Patch Changes
6
+
7
+ - [`704e17f0`](https://github.com/lemonmade/quilt/commit/704e17f0336e2cde642d5fd39badf23e9c072944) Thanks [@lemonmade](https://github.com/lemonmade)! - Improve `runtime` build option
8
+
9
+ ## 0.2.20
10
+
11
+ ### Patch Changes
12
+
13
+ - [`545ec714`](https://github.com/lemonmade/quilt/commit/545ec714275700c550e6586c7a0490b1ee321b6d) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix server output directory
14
+
3
15
  ## 0.2.19
4
16
 
5
17
  ### Patch Changes
package/build/esm/app.mjs CHANGED
@@ -276,12 +276,13 @@ async function quiltAppServer(options = {}) {
276
276
  } = options;
277
277
  const project = Project.load(root);
278
278
  const hash = output?.hash ?? "async-only";
279
+ const format = runtime.output?.format ?? "esm";
279
280
  const plugins = await quiltAppServerPlugins({ ...options, root, runtime });
280
281
  return {
281
282
  plugins,
282
283
  output: {
283
- format: "esm",
284
- dir: project.resolve(`build/server`),
284
+ format: format === "cjs" || format === "commonjs" ? "commonjs" : "esm",
285
+ dir: project.resolve(runtime.output?.directory ?? `build/server`),
285
286
  entryFileNames: `[name]${hash === true ? `.[hash]` : ""}.js`,
286
287
  chunkFileNames: `[name]${hash === true || hash === "async-only" ? `.[hash]` : ""}.js`,
287
288
  assetFileNames: `[name]${hash === true ? `.[hash]` : ""}.[ext]`,
@@ -305,7 +306,9 @@ async function quiltAppServerPlugins({
305
306
  const mode = (typeof env === "object" ? env?.mode : env) ?? "production";
306
307
  const baseURL = assets?.baseURL ?? "/assets/";
307
308
  const assetsInline = assets?.inline ?? true;
308
- const outputDirectory = project.resolve("build/server");
309
+ const outputDirectory = project.resolve(
310
+ runtime.output?.directory ?? "build/server"
311
+ );
309
312
  const reportsDirectory = path.resolve(outputDirectory, "../reports");
310
313
  const bundle = output?.bundle ?? runtime.output?.bundle;
311
314
  const minify = output?.minify ?? false;
@@ -332,7 +335,10 @@ async function quiltAppServerPlugins({
332
335
  import('./features/assets.mjs'),
333
336
  import('./features/async.mjs'),
334
337
  import('./features/esnext.mjs'),
335
- getNodePlugins({ bundle })
338
+ getNodePlugins({
339
+ bundle,
340
+ resolve: { exportConditions: runtime.resolve?.exportConditions }
341
+ })
336
342
  ]);
337
343
  const plugins = [
338
344
  quiltAppServerInput({ root: project.root, entry, format }),
@@ -9,15 +9,18 @@ async function quiltModule({
9
9
  entry,
10
10
  env,
11
11
  assets,
12
- graphql = true
12
+ graphql = true,
13
+ runtime
13
14
  } = {}) {
14
15
  const project = Project.load(root);
15
16
  const mode = (typeof env === "object" ? env?.mode : env) ?? "production";
16
- const outputDirectory = project.resolve("build/output");
17
+ const outputDirectory = project.resolve(
18
+ runtime?.output?.directory ?? "build/output"
19
+ );
17
20
  const reportDirectory = path.join(outputDirectory, "../reports");
18
21
  const minify = assets?.minify ?? true;
19
22
  const hash = assets?.hash ?? "async-only";
20
- const bundle = assets?.bundle ?? true;
23
+ const bundle = assets?.bundle ?? runtime?.output?.bundle ?? true;
21
24
  const browserGroup = await getBrowserGroupTargetDetails(assets?.targets, {
22
25
  root: project.root
23
26
  });
@@ -39,7 +42,10 @@ async function quiltModule({
39
42
  import('./features/node.mjs'),
40
43
  import('./features/react.mjs'),
41
44
  import('./features/esnext.mjs'),
42
- getNodePlugins({ bundle })
45
+ getNodePlugins({
46
+ bundle,
47
+ resolve: { exportConditions: runtime?.resolve?.exportConditions }
48
+ })
43
49
  ]);
44
50
  const finalEntry = await resolveModuleEntry(entry, project);
45
51
  const plugins = [
@@ -41,7 +41,10 @@ async function quiltServer({
41
41
  import('./features/node.mjs'),
42
42
  import('./features/react.mjs'),
43
43
  import('./features/esnext.mjs'),
44
- getNodePlugins({ bundle })
44
+ getNodePlugins({
45
+ bundle,
46
+ resolve: { exportConditions: runtime.resolve?.exportConditions }
47
+ })
45
48
  ]);
46
49
  const serverEntry = entry ? project.resolve(entry) : await sourceForServer(project);
47
50
  const finalEntry = format === "request-router" ? MAGIC_MODULE_ENTRY : serverEntry ?? MAGIC_MODULE_ENTRY;
@@ -121,6 +124,9 @@ function nodeServerRuntime({
121
124
  format: format === "commonjs" || format === "cjs" ? "cjs" : "esm"
122
125
  }
123
126
  },
127
+ resolve: {
128
+ exportConditions: ["node"]
129
+ },
124
130
  requestRouter() {
125
131
  return multiline`
126
132
  import requestRouter from ${JSON.stringify(
@@ -32,7 +32,8 @@ function normalizeRollupInput(input) {
32
32
  return Array.isArray(input) && input.length === 0 ? void 0 : input;
33
33
  }
34
34
  async function getNodePlugins({
35
- bundle = {}
35
+ bundle = {},
36
+ resolve = {}
36
37
  } = {}) {
37
38
  const [
38
39
  { default: commonjs },
@@ -49,7 +50,7 @@ async function getNodePlugins({
49
50
  if (bundle === true) {
50
51
  nodeExternalsOptions = {
51
52
  builtins: true,
52
- builtinsPrefix: "strip",
53
+ builtinsPrefix: "add",
53
54
  deps: false,
54
55
  devDeps: false,
55
56
  peerDeps: false,
@@ -75,7 +76,7 @@ async function getNodePlugins({
75
76
  } = bundle;
76
77
  nodeExternalsOptions = {
77
78
  builtins: !bundleBuiltins,
78
- builtinsPrefix: bundleBuiltins ? "strip" : "add",
79
+ builtinsPrefix: "add",
79
80
  deps: !bundleDependencies,
80
81
  devDeps: !bundleDevDependencies,
81
82
  peerDeps: !bundlePeerDependencies,
@@ -93,6 +94,7 @@ async function getNodePlugins({
93
94
  exportConditions: [
94
95
  "esnext",
95
96
  "quilt:esnext",
97
+ ...resolve.exportConditions ?? [],
96
98
  "default",
97
99
  "module",
98
100
  "import"