@bleedingdev/modern-js-app-tools 3.2.0-ultramodern.124 → 3.2.0-ultramodern.126

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.
@@ -55,6 +55,20 @@ const JS_OR_TS_EXTS = [
55
55
  '.mjs',
56
56
  '.cjs'
57
57
  ];
58
+ const CLOUDFLARE_WORKER_NODE_BUILTINS = [
59
+ 'async_hooks',
60
+ 'buffer',
61
+ 'crypto',
62
+ 'events',
63
+ 'fs/promises',
64
+ 'module',
65
+ 'path',
66
+ 'process',
67
+ 'stream',
68
+ 'string_decoder',
69
+ 'url',
70
+ 'util'
71
+ ];
58
72
  const CLOUDFLARE_WORKER_COMPAT_TEMPLATE_DIR = external_node_path_default().resolve(__dirname, '../../plugins/deploy/platforms/templates');
59
73
  function findExistingFile(candidates) {
60
74
  return candidates.find((candidate)=>external_node_fs_default().existsSync(candidate));
@@ -98,6 +112,21 @@ function setAliasIfPresent(alias, name, value) {
98
112
  function getCloudflareWorkerCompatFile(file) {
99
113
  return external_node_path_default().join(CLOUDFLARE_WORKER_COMPAT_TEMPLATE_DIR, file);
100
114
  }
115
+ function getCloudflareWorkerNodeExternals() {
116
+ return Object.fromEntries(CLOUDFLARE_WORKER_NODE_BUILTINS.flatMap((builtin)=>{
117
+ const nodeBuiltin = `node:${builtin}`;
118
+ return [
119
+ [
120
+ builtin,
121
+ `module-import ${nodeBuiltin}`
122
+ ],
123
+ [
124
+ nodeBuiltin,
125
+ `module-import ${nodeBuiltin}`
126
+ ]
127
+ ];
128
+ }));
129
+ }
101
130
  function getEffectBffEntry(normalizedConfig, appContext) {
102
131
  if (!normalizedConfig.bff || 'hono' === normalizedConfig.bff.runtimeFramework) return;
103
132
  const configuredEntry = normalizedConfig.bff.effect?.entry;
@@ -220,16 +249,12 @@ function getBuilderEnvironments(normalizedConfig, appContext, tempBuilderConfig)
220
249
  experiments: {
221
250
  outputModule: true
222
251
  },
223
- externals: {
224
- async_hooks: 'node:async_hooks',
225
- 'node:async_hooks': 'node:async_hooks'
226
- },
227
- externalsType: 'module'
252
+ externals: getCloudflareWorkerNodeExternals(),
253
+ externalsType: 'module-import'
228
254
  });
229
255
  chain.output.module(true).library({
230
256
  type: 'module'
231
257
  }).chunkFormat('module').chunkLoading('import').workerChunkLoading('import');
232
- chain.target('webworker');
233
258
  chain.plugins.delete('plugin-module-federation');
234
259
  if (tanstackRouterSsrServerFile) {
235
260
  chain.resolve.alias.set('@tanstack/router-core/ssr/server$', tanstackRouterSsrServerFile);
@@ -12,6 +12,20 @@ const JS_OR_TS_EXTS = [
12
12
  '.mjs',
13
13
  '.cjs'
14
14
  ];
15
+ const CLOUDFLARE_WORKER_NODE_BUILTINS = [
16
+ 'async_hooks',
17
+ 'buffer',
18
+ 'crypto',
19
+ 'events',
20
+ 'fs/promises',
21
+ 'module',
22
+ 'path',
23
+ 'process',
24
+ 'stream',
25
+ 'string_decoder',
26
+ 'url',
27
+ 'util'
28
+ ];
15
29
  const CLOUDFLARE_WORKER_COMPAT_TEMPLATE_DIR = node_path.resolve(__dirname, '../../plugins/deploy/platforms/templates');
16
30
  function findExistingFile(candidates) {
17
31
  return candidates.find((candidate)=>node_fs.existsSync(candidate));
@@ -55,6 +69,21 @@ function setAliasIfPresent(alias, name, value) {
55
69
  function getCloudflareWorkerCompatFile(file) {
56
70
  return node_path.join(CLOUDFLARE_WORKER_COMPAT_TEMPLATE_DIR, file);
57
71
  }
72
+ function getCloudflareWorkerNodeExternals() {
73
+ return Object.fromEntries(CLOUDFLARE_WORKER_NODE_BUILTINS.flatMap((builtin)=>{
74
+ const nodeBuiltin = `node:${builtin}`;
75
+ return [
76
+ [
77
+ builtin,
78
+ `module-import ${nodeBuiltin}`
79
+ ],
80
+ [
81
+ nodeBuiltin,
82
+ `module-import ${nodeBuiltin}`
83
+ ]
84
+ ];
85
+ }));
86
+ }
58
87
  function getEffectBffEntry(normalizedConfig, appContext) {
59
88
  if (!normalizedConfig.bff || 'hono' === normalizedConfig.bff.runtimeFramework) return;
60
89
  const configuredEntry = normalizedConfig.bff.effect?.entry;
@@ -177,16 +206,12 @@ function getBuilderEnvironments(normalizedConfig, appContext, tempBuilderConfig)
177
206
  experiments: {
178
207
  outputModule: true
179
208
  },
180
- externals: {
181
- async_hooks: 'node:async_hooks',
182
- 'node:async_hooks': 'node:async_hooks'
183
- },
184
- externalsType: 'module'
209
+ externals: getCloudflareWorkerNodeExternals(),
210
+ externalsType: 'module-import'
185
211
  });
186
212
  chain.output.module(true).library({
187
213
  type: 'module'
188
214
  }).chunkFormat('module').chunkLoading('import').workerChunkLoading('import');
189
- chain.target('webworker');
190
215
  chain.plugins.delete('plugin-module-federation');
191
216
  if (tanstackRouterSsrServerFile) {
192
217
  chain.resolve.alias.set('@tanstack/router-core/ssr/server$', tanstackRouterSsrServerFile);
@@ -17,6 +17,20 @@ const JS_OR_TS_EXTS = [
17
17
  '.mjs',
18
18
  '.cjs'
19
19
  ];
20
+ const CLOUDFLARE_WORKER_NODE_BUILTINS = [
21
+ 'async_hooks',
22
+ 'buffer',
23
+ 'crypto',
24
+ 'events',
25
+ 'fs/promises',
26
+ 'module',
27
+ 'path',
28
+ 'process',
29
+ 'stream',
30
+ 'string_decoder',
31
+ 'url',
32
+ 'util'
33
+ ];
20
34
  const CLOUDFLARE_WORKER_COMPAT_TEMPLATE_DIR = node_path.resolve(getBuilderEnvironments_dirname, '../../plugins/deploy/platforms/templates');
21
35
  function findExistingFile(candidates) {
22
36
  return candidates.find((candidate)=>node_fs.existsSync(candidate));
@@ -60,6 +74,21 @@ function setAliasIfPresent(alias, name, value) {
60
74
  function getCloudflareWorkerCompatFile(file) {
61
75
  return node_path.join(CLOUDFLARE_WORKER_COMPAT_TEMPLATE_DIR, file);
62
76
  }
77
+ function getCloudflareWorkerNodeExternals() {
78
+ return Object.fromEntries(CLOUDFLARE_WORKER_NODE_BUILTINS.flatMap((builtin)=>{
79
+ const nodeBuiltin = `node:${builtin}`;
80
+ return [
81
+ [
82
+ builtin,
83
+ `module-import ${nodeBuiltin}`
84
+ ],
85
+ [
86
+ nodeBuiltin,
87
+ `module-import ${nodeBuiltin}`
88
+ ]
89
+ ];
90
+ }));
91
+ }
63
92
  function getEffectBffEntry(normalizedConfig, appContext) {
64
93
  if (!normalizedConfig.bff || 'hono' === normalizedConfig.bff.runtimeFramework) return;
65
94
  const configuredEntry = normalizedConfig.bff.effect?.entry;
@@ -182,16 +211,12 @@ function getBuilderEnvironments(normalizedConfig, appContext, tempBuilderConfig)
182
211
  experiments: {
183
212
  outputModule: true
184
213
  },
185
- externals: {
186
- async_hooks: 'node:async_hooks',
187
- 'node:async_hooks': 'node:async_hooks'
188
- },
189
- externalsType: 'module'
214
+ externals: getCloudflareWorkerNodeExternals(),
215
+ externalsType: 'module-import'
190
216
  });
191
217
  chain.output.module(true).library({
192
218
  type: 'module'
193
219
  }).chunkFormat('module').chunkLoading('import').workerChunkLoading('import');
194
- chain.target('webworker');
195
220
  chain.plugins.delete('plugin-module-federation');
196
221
  if (tanstackRouterSsrServerFile) {
197
222
  chain.resolve.alias.set('@tanstack/router-core/ssr/server$', tanstackRouterSsrServerFile);
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.2.0-ultramodern.124",
20
+ "version": "3.2.0-ultramodern.126",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "main": "./dist/cjs/index.js",
23
23
  "exports": {
@@ -97,16 +97,16 @@
97
97
  "ndepe": "^0.1.13",
98
98
  "pkg-types": "^2.3.1",
99
99
  "std-env": "4.1.0",
100
- "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.2.0-ultramodern.124",
101
- "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.2.0-ultramodern.124",
102
- "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.2.0-ultramodern.124",
103
- "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.2.0-ultramodern.124",
104
- "@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.2.0-ultramodern.124",
105
- "@modern-js/server": "npm:@bleedingdev/modern-js-server@3.2.0-ultramodern.124",
106
- "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.2.0-ultramodern.124",
107
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.124",
108
- "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.2.0-ultramodern.124",
109
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.124"
100
+ "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.2.0-ultramodern.126",
101
+ "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.2.0-ultramodern.126",
102
+ "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.2.0-ultramodern.126",
103
+ "@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.2.0-ultramodern.126",
104
+ "@modern-js/server": "npm:@bleedingdev/modern-js-server@3.2.0-ultramodern.126",
105
+ "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.2.0-ultramodern.126",
106
+ "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.2.0-ultramodern.126",
107
+ "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.2.0-ultramodern.126",
108
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.126",
109
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.126"
110
110
  },
111
111
  "devDependencies": {
112
112
  "@rslib/core": "0.22.0",