@quilted/rollup 0.2.20 → 0.2.22

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.22
4
+
5
+ ### Patch Changes
6
+
7
+ - [`fd3760de`](https://github.com/lemonmade/quilt/commit/fd3760de3f26de96f4e6ec622416259a110dda3f) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix module entrypoint names
8
+
9
+ ## 0.2.21
10
+
11
+ ### Patch Changes
12
+
13
+ - [`704e17f0`](https://github.com/lemonmade/quilt/commit/704e17f0336e2cde642d5fd39badf23e9c072944) Thanks [@lemonmade](https://github.com/lemonmade)! - Improve `runtime` build option
14
+
3
15
  ## 0.2.20
4
16
 
5
17
  ### Patch Changes
package/build/esm/app.mjs CHANGED
@@ -335,7 +335,10 @@ async function quiltAppServerPlugins({
335
335
  import('./features/assets.mjs'),
336
336
  import('./features/async.mjs'),
337
337
  import('./features/esnext.mjs'),
338
- getNodePlugins({ bundle })
338
+ getNodePlugins({
339
+ bundle,
340
+ resolve: { exportConditions: runtime.resolve?.exportConditions }
341
+ })
339
342
  ]);
340
343
  const plugins = [
341
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 = [
@@ -98,7 +104,9 @@ async function resolveModuleEntry(entry, project) {
98
104
  if (entry) {
99
105
  if (typeof entry === "string") {
100
106
  const absolutePath = project.resolve(entry);
101
- return { [project.relative(absolutePath)]: absolutePath };
107
+ return {
108
+ [normalizeEntryName(project.relative(absolutePath))]: absolutePath
109
+ };
102
110
  } else {
103
111
  return Object.fromEntries(
104
112
  Object.entries(entry).map(([key, value]) => [
@@ -122,7 +130,9 @@ async function resolveModuleEntry(entry, project) {
122
130
  return { [normalizeEntryName(project.relative(sourceFile))]: sourceFile };
123
131
  }
124
132
  function normalizeEntryName(name) {
125
- return name === "." ? "index" : name.startsWith("./") ? name.slice(2) : name;
133
+ const resolvedDots = name === "." ? "index" : name.startsWith("./") ? name.slice(2) : name;
134
+ const extname = path.extname(resolvedDots);
135
+ return resolvedDots.slice(0, resolvedDots.length - extname.length);
126
136
  }
127
137
 
128
138
  export { quiltModule };
@@ -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"