@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.0 → 3.5.0-ultramodern.10
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/dist/cjs/plugins/deploy/platforms/cloudflare.js +47 -1
- package/dist/esm/plugins/deploy/platforms/cloudflare.mjs +47 -1
- package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +2 -2
- package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.mjs +2 -2
- package/dist/esm-node/plugins/deploy/platforms/cloudflare.mjs +47 -1
- package/dist/esm-node/plugins/deploy/utils/index.mjs +5 -5
- package/dist/types/types/config/cloudflareDeploy.d.ts +27 -0
- package/dist/types/types/config/deploy.d.ts +8 -2
- package/package.json +14 -14
|
@@ -292,8 +292,41 @@ const createWranglerAssetsConfig = (configuredAssets)=>{
|
|
|
292
292
|
run_worker_first: true
|
|
293
293
|
};
|
|
294
294
|
};
|
|
295
|
+
const assertNonEmptyString = (value, label)=>{
|
|
296
|
+
if ('string' != typeof value || 0 === value.trim().length) throw new Error(`${label} must be a non-empty string.`);
|
|
297
|
+
return value.trim();
|
|
298
|
+
};
|
|
299
|
+
const normalizeD1Database = (database, index)=>{
|
|
300
|
+
const binding = assertNonEmptyString(database.binding, `deploy.worker.d1Databases[${index}].binding`);
|
|
301
|
+
const databaseName = assertNonEmptyString(database.databaseName, `deploy.worker.d1Databases[${index}].databaseName`);
|
|
302
|
+
const databaseId = assertNonEmptyString(database.databaseId, `deploy.worker.d1Databases[${index}].databaseId`);
|
|
303
|
+
const migrationsDir = void 0 === database.migrationsDir ? void 0 : normalizeRelativePath(database.migrationsDir, `deploy.worker.d1Databases[${index}].migrationsDir`, 'app root');
|
|
304
|
+
const previewDatabaseId = void 0 === database.previewDatabaseId ? void 0 : assertNonEmptyString(database.previewDatabaseId, `deploy.worker.d1Databases[${index}].previewDatabaseId`);
|
|
305
|
+
return {
|
|
306
|
+
binding,
|
|
307
|
+
database_name: databaseName,
|
|
308
|
+
database_id: databaseId,
|
|
309
|
+
...void 0 === migrationsDir ? {} : {
|
|
310
|
+
migrations_dir: migrationsDir
|
|
311
|
+
},
|
|
312
|
+
...void 0 === previewDatabaseId ? {} : {
|
|
313
|
+
preview_database_id: previewDatabaseId
|
|
314
|
+
},
|
|
315
|
+
...void 0 === database.remote ? {} : {
|
|
316
|
+
remote: database.remote
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
const createWranglerD1Databases = (modernConfig, configuredWranglerD1)=>{
|
|
321
|
+
const d1Databases = modernConfig.deploy?.worker?.d1Databases;
|
|
322
|
+
if (void 0 === d1Databases) return configuredWranglerD1;
|
|
323
|
+
if (void 0 !== configuredWranglerD1) throw new Error('Use deploy.worker.d1Databases or deploy.worker.wrangler.d1_databases, not both.');
|
|
324
|
+
if (!Array.isArray(d1Databases)) throw new Error('deploy.worker.d1Databases must be an array.');
|
|
325
|
+
return d1Databases.map(normalizeD1Database);
|
|
326
|
+
};
|
|
295
327
|
const createWranglerConfig = (appDirectory, modernConfig)=>{
|
|
296
328
|
const wrangler = getConfiguredWrangler(modernConfig);
|
|
329
|
+
const d1Databases = createWranglerD1Databases(modernConfig, wrangler.d1_databases);
|
|
297
330
|
return {
|
|
298
331
|
$schema: 'node_modules/wrangler/config-schema.json',
|
|
299
332
|
name: getConfiguredWorkerName(appDirectory, modernConfig),
|
|
@@ -301,7 +334,10 @@ const createWranglerConfig = (appDirectory, modernConfig)=>{
|
|
|
301
334
|
...wrangler,
|
|
302
335
|
main: WORKER_ENTRY,
|
|
303
336
|
compatibility_flags: createWranglerCompatibilityFlags(wrangler.compatibility_flags),
|
|
304
|
-
assets: createWranglerAssetsConfig(wrangler.assets)
|
|
337
|
+
assets: createWranglerAssetsConfig(wrangler.assets),
|
|
338
|
+
...void 0 === d1Databases ? {} : {
|
|
339
|
+
d1_databases: d1Databases
|
|
340
|
+
}
|
|
305
341
|
};
|
|
306
342
|
};
|
|
307
343
|
const normalizeCloudflareArtifact = (artifact, index)=>{
|
|
@@ -324,6 +360,15 @@ const copyCloudflareArtifacts = async (appDirectory, outputDirectory, artifacts)
|
|
|
324
360
|
await utils_namespaceObject.fs.copy(sourcePath, external_node_path_default().join(outputDirectory, artifact.to));
|
|
325
361
|
}
|
|
326
362
|
};
|
|
363
|
+
const copyCloudflareD1Migrations = async (appDirectory, outputDirectory, modernConfig)=>{
|
|
364
|
+
for (const [index, database] of (modernConfig.deploy?.worker?.d1Databases ?? []).entries()){
|
|
365
|
+
if (!database.migrationsDir) continue;
|
|
366
|
+
const migrationsDir = normalizeRelativePath(database.migrationsDir, `deploy.worker.d1Databases[${index}].migrationsDir`, 'app root');
|
|
367
|
+
const sourcePath = external_node_path_default().join(appDirectory, migrationsDir);
|
|
368
|
+
if (!await utils_namespaceObject.fs.pathExists(sourcePath)) throw new Error(`deploy.worker.d1Databases[${index}].migrationsDir does not exist: ${migrationsDir}`);
|
|
369
|
+
await utils_namespaceObject.fs.copy(sourcePath, external_node_path_default().join(outputDirectory, migrationsDir));
|
|
370
|
+
}
|
|
371
|
+
};
|
|
327
372
|
const readRouteSpec = async (outputDirectory)=>{
|
|
328
373
|
const routeSpecPath = external_node_path_default().join(outputDirectory, ROUTE_SPEC_OUTPUT);
|
|
329
374
|
if (!await utils_namespaceObject.fs.pathExists(routeSpecPath)) return {
|
|
@@ -468,6 +513,7 @@ const createCloudflarePreset = ({ appContext, modernConfig })=>{
|
|
|
468
513
|
});
|
|
469
514
|
}
|
|
470
515
|
await copyCloudflareArtifacts(appDirectory, outputDirectory, cloudflareArtifacts);
|
|
516
|
+
await copyCloudflareD1Migrations(appDirectory, outputDirectory, modernConfig);
|
|
471
517
|
await utils_namespaceObject.fs.writeJSON(wranglerConfigPath, createWranglerConfig(appDirectory, modernConfig), {
|
|
472
518
|
spaces: 2
|
|
473
519
|
});
|
|
@@ -250,8 +250,41 @@ const createWranglerAssetsConfig = (configuredAssets)=>{
|
|
|
250
250
|
run_worker_first: true
|
|
251
251
|
};
|
|
252
252
|
};
|
|
253
|
+
const assertNonEmptyString = (value, label)=>{
|
|
254
|
+
if ('string' != typeof value || 0 === value.trim().length) throw new Error(`${label} must be a non-empty string.`);
|
|
255
|
+
return value.trim();
|
|
256
|
+
};
|
|
257
|
+
const normalizeD1Database = (database, index)=>{
|
|
258
|
+
const binding = assertNonEmptyString(database.binding, `deploy.worker.d1Databases[${index}].binding`);
|
|
259
|
+
const databaseName = assertNonEmptyString(database.databaseName, `deploy.worker.d1Databases[${index}].databaseName`);
|
|
260
|
+
const databaseId = assertNonEmptyString(database.databaseId, `deploy.worker.d1Databases[${index}].databaseId`);
|
|
261
|
+
const migrationsDir = void 0 === database.migrationsDir ? void 0 : normalizeRelativePath(database.migrationsDir, `deploy.worker.d1Databases[${index}].migrationsDir`, 'app root');
|
|
262
|
+
const previewDatabaseId = void 0 === database.previewDatabaseId ? void 0 : assertNonEmptyString(database.previewDatabaseId, `deploy.worker.d1Databases[${index}].previewDatabaseId`);
|
|
263
|
+
return {
|
|
264
|
+
binding,
|
|
265
|
+
database_name: databaseName,
|
|
266
|
+
database_id: databaseId,
|
|
267
|
+
...void 0 === migrationsDir ? {} : {
|
|
268
|
+
migrations_dir: migrationsDir
|
|
269
|
+
},
|
|
270
|
+
...void 0 === previewDatabaseId ? {} : {
|
|
271
|
+
preview_database_id: previewDatabaseId
|
|
272
|
+
},
|
|
273
|
+
...void 0 === database.remote ? {} : {
|
|
274
|
+
remote: database.remote
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
const createWranglerD1Databases = (modernConfig, configuredWranglerD1)=>{
|
|
279
|
+
const d1Databases = modernConfig.deploy?.worker?.d1Databases;
|
|
280
|
+
if (void 0 === d1Databases) return configuredWranglerD1;
|
|
281
|
+
if (void 0 !== configuredWranglerD1) throw new Error('Use deploy.worker.d1Databases or deploy.worker.wrangler.d1_databases, not both.');
|
|
282
|
+
if (!Array.isArray(d1Databases)) throw new Error('deploy.worker.d1Databases must be an array.');
|
|
283
|
+
return d1Databases.map(normalizeD1Database);
|
|
284
|
+
};
|
|
253
285
|
const createWranglerConfig = (appDirectory, modernConfig)=>{
|
|
254
286
|
const wrangler = getConfiguredWrangler(modernConfig);
|
|
287
|
+
const d1Databases = createWranglerD1Databases(modernConfig, wrangler.d1_databases);
|
|
255
288
|
return {
|
|
256
289
|
$schema: 'node_modules/wrangler/config-schema.json',
|
|
257
290
|
name: getConfiguredWorkerName(appDirectory, modernConfig),
|
|
@@ -259,7 +292,10 @@ const createWranglerConfig = (appDirectory, modernConfig)=>{
|
|
|
259
292
|
...wrangler,
|
|
260
293
|
main: WORKER_ENTRY,
|
|
261
294
|
compatibility_flags: createWranglerCompatibilityFlags(wrangler.compatibility_flags),
|
|
262
|
-
assets: createWranglerAssetsConfig(wrangler.assets)
|
|
295
|
+
assets: createWranglerAssetsConfig(wrangler.assets),
|
|
296
|
+
...void 0 === d1Databases ? {} : {
|
|
297
|
+
d1_databases: d1Databases
|
|
298
|
+
}
|
|
263
299
|
};
|
|
264
300
|
};
|
|
265
301
|
const normalizeCloudflareArtifact = (artifact, index)=>{
|
|
@@ -282,6 +318,15 @@ const copyCloudflareArtifacts = async (appDirectory, outputDirectory, artifacts)
|
|
|
282
318
|
await fs.copy(sourcePath, node_path.join(outputDirectory, artifact.to));
|
|
283
319
|
}
|
|
284
320
|
};
|
|
321
|
+
const copyCloudflareD1Migrations = async (appDirectory, outputDirectory, modernConfig)=>{
|
|
322
|
+
for (const [index, database] of (modernConfig.deploy?.worker?.d1Databases ?? []).entries()){
|
|
323
|
+
if (!database.migrationsDir) continue;
|
|
324
|
+
const migrationsDir = normalizeRelativePath(database.migrationsDir, `deploy.worker.d1Databases[${index}].migrationsDir`, 'app root');
|
|
325
|
+
const sourcePath = node_path.join(appDirectory, migrationsDir);
|
|
326
|
+
if (!await fs.pathExists(sourcePath)) throw new Error(`deploy.worker.d1Databases[${index}].migrationsDir does not exist: ${migrationsDir}`);
|
|
327
|
+
await fs.copy(sourcePath, node_path.join(outputDirectory, migrationsDir));
|
|
328
|
+
}
|
|
329
|
+
};
|
|
285
330
|
const readRouteSpec = async (outputDirectory)=>{
|
|
286
331
|
const routeSpecPath = node_path.join(outputDirectory, ROUTE_SPEC_OUTPUT);
|
|
287
332
|
if (!await fs.pathExists(routeSpecPath)) return {
|
|
@@ -426,6 +471,7 @@ const createCloudflarePreset = ({ appContext, modernConfig })=>{
|
|
|
426
471
|
});
|
|
427
472
|
}
|
|
428
473
|
await copyCloudflareArtifacts(appDirectory, outputDirectory, cloudflareArtifacts);
|
|
474
|
+
await copyCloudflareD1Migrations(appDirectory, outputDirectory, modernConfig);
|
|
429
475
|
await fs.writeJSON(wranglerConfigPath, createWranglerConfig(appDirectory, modernConfig), {
|
|
430
476
|
spaces: 2
|
|
431
477
|
});
|
|
@@ -6,7 +6,7 @@ import { SERVICE_WORKER_ENVIRONMENT_NAME } from "@modern-js/builder";
|
|
|
6
6
|
import { isProd, isSSR, isServiceWorker, isUseRsc, isUseSSRBundle } from "@modern-js/utils";
|
|
7
7
|
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
8
8
|
import { dirname as __rspack_dirname } from "node:path";
|
|
9
|
-
var
|
|
9
|
+
var __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
10
10
|
const BFF_EFFECT_WORKER_ENTRY_NAME = '__modern_bff_effect';
|
|
11
11
|
const BFF_EFFECT_WORKER_RUNTIME_QUERY = 'modern-bff-runtime';
|
|
12
12
|
const JS_OR_TS_EXTS = [
|
|
@@ -33,7 +33,7 @@ const CLOUDFLARE_WORKER_NODE_BUILTINS = [
|
|
|
33
33
|
'url',
|
|
34
34
|
'util'
|
|
35
35
|
];
|
|
36
|
-
const CLOUDFLARE_WORKER_COMPAT_TEMPLATE_DIR = node_path.resolve(
|
|
36
|
+
const CLOUDFLARE_WORKER_COMPAT_TEMPLATE_DIR = node_path.resolve(__rspack_import_meta_dirname__, '../../plugins/deploy/platforms/templates');
|
|
37
37
|
function findExistingFile(candidates) {
|
|
38
38
|
return candidates.find((candidate)=>node_fs.existsSync(candidate));
|
|
39
39
|
}
|
|
@@ -3,7 +3,7 @@ import node_path from "node:path";
|
|
|
3
3
|
import { SERVICE_WORKER_ENVIRONMENT_NAME } from "@modern-js/builder";
|
|
4
4
|
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
5
5
|
import { dirname as __rspack_dirname } from "node:path";
|
|
6
|
-
var
|
|
6
|
+
var __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
7
7
|
const builderPluginAdapterBasic = (options)=>({
|
|
8
8
|
name: 'builder-plugin-adapter-modern-basic',
|
|
9
9
|
setup (api) {
|
|
@@ -17,7 +17,7 @@ const builderPluginAdapterBasic = (options)=>({
|
|
|
17
17
|
const bareServerModuleReg = /\.(server|node)\.[tj]sx?$/;
|
|
18
18
|
const depExt = 'mjs';
|
|
19
19
|
chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(bareServerModuleReg);
|
|
20
|
-
chain.module.rule('bare-server-module').test(bareServerModuleReg).use('server-module-loader').loader(node_path.join(
|
|
20
|
+
chain.module.rule('bare-server-module').test(bareServerModuleReg).use('server-module-loader').loader(node_path.join(__rspack_import_meta_dirname__, `../loaders/serverModuleLoader.${depExt}`));
|
|
21
21
|
}
|
|
22
22
|
const { appContext } = options;
|
|
23
23
|
const { metaName } = appContext;
|
|
@@ -251,8 +251,41 @@ const createWranglerAssetsConfig = (configuredAssets)=>{
|
|
|
251
251
|
run_worker_first: true
|
|
252
252
|
};
|
|
253
253
|
};
|
|
254
|
+
const assertNonEmptyString = (value, label)=>{
|
|
255
|
+
if ('string' != typeof value || 0 === value.trim().length) throw new Error(`${label} must be a non-empty string.`);
|
|
256
|
+
return value.trim();
|
|
257
|
+
};
|
|
258
|
+
const normalizeD1Database = (database, index)=>{
|
|
259
|
+
const binding = assertNonEmptyString(database.binding, `deploy.worker.d1Databases[${index}].binding`);
|
|
260
|
+
const databaseName = assertNonEmptyString(database.databaseName, `deploy.worker.d1Databases[${index}].databaseName`);
|
|
261
|
+
const databaseId = assertNonEmptyString(database.databaseId, `deploy.worker.d1Databases[${index}].databaseId`);
|
|
262
|
+
const migrationsDir = void 0 === database.migrationsDir ? void 0 : normalizeRelativePath(database.migrationsDir, `deploy.worker.d1Databases[${index}].migrationsDir`, 'app root');
|
|
263
|
+
const previewDatabaseId = void 0 === database.previewDatabaseId ? void 0 : assertNonEmptyString(database.previewDatabaseId, `deploy.worker.d1Databases[${index}].previewDatabaseId`);
|
|
264
|
+
return {
|
|
265
|
+
binding,
|
|
266
|
+
database_name: databaseName,
|
|
267
|
+
database_id: databaseId,
|
|
268
|
+
...void 0 === migrationsDir ? {} : {
|
|
269
|
+
migrations_dir: migrationsDir
|
|
270
|
+
},
|
|
271
|
+
...void 0 === previewDatabaseId ? {} : {
|
|
272
|
+
preview_database_id: previewDatabaseId
|
|
273
|
+
},
|
|
274
|
+
...void 0 === database.remote ? {} : {
|
|
275
|
+
remote: database.remote
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
const createWranglerD1Databases = (modernConfig, configuredWranglerD1)=>{
|
|
280
|
+
const d1Databases = modernConfig.deploy?.worker?.d1Databases;
|
|
281
|
+
if (void 0 === d1Databases) return configuredWranglerD1;
|
|
282
|
+
if (void 0 !== configuredWranglerD1) throw new Error('Use deploy.worker.d1Databases or deploy.worker.wrangler.d1_databases, not both.');
|
|
283
|
+
if (!Array.isArray(d1Databases)) throw new Error('deploy.worker.d1Databases must be an array.');
|
|
284
|
+
return d1Databases.map(normalizeD1Database);
|
|
285
|
+
};
|
|
254
286
|
const createWranglerConfig = (appDirectory, modernConfig)=>{
|
|
255
287
|
const wrangler = getConfiguredWrangler(modernConfig);
|
|
288
|
+
const d1Databases = createWranglerD1Databases(modernConfig, wrangler.d1_databases);
|
|
256
289
|
return {
|
|
257
290
|
$schema: 'node_modules/wrangler/config-schema.json',
|
|
258
291
|
name: getConfiguredWorkerName(appDirectory, modernConfig),
|
|
@@ -260,7 +293,10 @@ const createWranglerConfig = (appDirectory, modernConfig)=>{
|
|
|
260
293
|
...wrangler,
|
|
261
294
|
main: WORKER_ENTRY,
|
|
262
295
|
compatibility_flags: createWranglerCompatibilityFlags(wrangler.compatibility_flags),
|
|
263
|
-
assets: createWranglerAssetsConfig(wrangler.assets)
|
|
296
|
+
assets: createWranglerAssetsConfig(wrangler.assets),
|
|
297
|
+
...void 0 === d1Databases ? {} : {
|
|
298
|
+
d1_databases: d1Databases
|
|
299
|
+
}
|
|
264
300
|
};
|
|
265
301
|
};
|
|
266
302
|
const normalizeCloudflareArtifact = (artifact, index)=>{
|
|
@@ -283,6 +319,15 @@ const copyCloudflareArtifacts = async (appDirectory, outputDirectory, artifacts)
|
|
|
283
319
|
await fs.copy(sourcePath, node_path.join(outputDirectory, artifact.to));
|
|
284
320
|
}
|
|
285
321
|
};
|
|
322
|
+
const copyCloudflareD1Migrations = async (appDirectory, outputDirectory, modernConfig)=>{
|
|
323
|
+
for (const [index, database] of (modernConfig.deploy?.worker?.d1Databases ?? []).entries()){
|
|
324
|
+
if (!database.migrationsDir) continue;
|
|
325
|
+
const migrationsDir = normalizeRelativePath(database.migrationsDir, `deploy.worker.d1Databases[${index}].migrationsDir`, 'app root');
|
|
326
|
+
const sourcePath = node_path.join(appDirectory, migrationsDir);
|
|
327
|
+
if (!await fs.pathExists(sourcePath)) throw new Error(`deploy.worker.d1Databases[${index}].migrationsDir does not exist: ${migrationsDir}`);
|
|
328
|
+
await fs.copy(sourcePath, node_path.join(outputDirectory, migrationsDir));
|
|
329
|
+
}
|
|
330
|
+
};
|
|
286
331
|
const readRouteSpec = async (outputDirectory)=>{
|
|
287
332
|
const routeSpecPath = node_path.join(outputDirectory, ROUTE_SPEC_OUTPUT);
|
|
288
333
|
if (!await fs.pathExists(routeSpecPath)) return {
|
|
@@ -427,6 +472,7 @@ const createCloudflarePreset = ({ appContext, modernConfig })=>{
|
|
|
427
472
|
});
|
|
428
473
|
}
|
|
429
474
|
await copyCloudflareArtifacts(appDirectory, outputDirectory, cloudflareArtifacts);
|
|
475
|
+
await copyCloudflareD1Migrations(appDirectory, outputDirectory, modernConfig);
|
|
430
476
|
await fs.writeJSON(wranglerConfigPath, createWranglerConfig(appDirectory, modernConfig), {
|
|
431
477
|
spaces: 2
|
|
432
478
|
});
|
|
@@ -5,8 +5,8 @@ import { ROUTE_SPEC_FILE, SERVER_DIR, dynamicImport, fs, getMeta } from "@modern
|
|
|
5
5
|
import path from "path";
|
|
6
6
|
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
7
7
|
import { dirname as __rspack_dirname } from "node:path";
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
9
|
+
var __rspack_import_meta_filename__ = __rspack_fileURLToPath(import.meta.url);
|
|
10
10
|
const normalizePath = (filePath)=>filePath.replace(/\\/g, '/');
|
|
11
11
|
const getProjectUsage = (appDirectory, distDirectory, metaName)=>{
|
|
12
12
|
const routeJSON = path.join(distDirectory, ROUTE_SPEC_FILE);
|
|
@@ -29,7 +29,7 @@ const getProjectUsage = (appDirectory, distDirectory, metaName)=>{
|
|
|
29
29
|
useWebServer: isServerConfigExists
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
const getTemplatePath = (file)=>path.join(
|
|
32
|
+
const getTemplatePath = (file)=>path.join(__rspack_import_meta_dirname__, '../platforms/templates', file);
|
|
33
33
|
const readTemplate = async (file)=>(await fs.readFile(getTemplatePath(file))).toString();
|
|
34
34
|
const resolveESMDependency = async (entry)=>{
|
|
35
35
|
const conditions = new Set([
|
|
@@ -39,9 +39,9 @@ const resolveESMDependency = async (entry)=>{
|
|
|
39
39
|
'default'
|
|
40
40
|
]);
|
|
41
41
|
try {
|
|
42
|
-
const resolverPath = pathToFileURL(createRequire(
|
|
42
|
+
const resolverPath = pathToFileURL(createRequire(__rspack_import_meta_filename__).resolve('import-meta-resolve')).href;
|
|
43
43
|
const { moduleResolve } = await dynamicImport(resolverPath);
|
|
44
|
-
return normalizePath(moduleResolve(entry, pathToFileURL(`${
|
|
44
|
+
return normalizePath(moduleResolve(entry, pathToFileURL(`${__rspack_import_meta_dirname__}/`), conditions, false).pathname.replace(/^\/(\w):/, '$1:'));
|
|
45
45
|
} catch (err) {}
|
|
46
46
|
};
|
|
47
47
|
export { getProjectUsage, getTemplatePath, normalizePath, readTemplate, resolveESMDependency };
|
|
@@ -14,6 +14,33 @@ export interface CloudflareWorkerArtifactConfig {
|
|
|
14
14
|
*/
|
|
15
15
|
to: string;
|
|
16
16
|
}
|
|
17
|
+
export interface CloudflareWorkerD1DatabaseConfig {
|
|
18
|
+
/**
|
|
19
|
+
* Worker binding name, for example `DB`.
|
|
20
|
+
*/
|
|
21
|
+
binding: string;
|
|
22
|
+
/**
|
|
23
|
+
* Cloudflare D1 database name.
|
|
24
|
+
*/
|
|
25
|
+
databaseName: string;
|
|
26
|
+
/**
|
|
27
|
+
* Cloudflare D1 database id.
|
|
28
|
+
*/
|
|
29
|
+
databaseId: string;
|
|
30
|
+
/**
|
|
31
|
+
* Optional local migrations directory, relative to the app root. When set,
|
|
32
|
+
* Modern.js stages it into `.output` and points Wrangler at the staged copy.
|
|
33
|
+
*/
|
|
34
|
+
migrationsDir?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Optional preview database id used by Wrangler preview/local flows.
|
|
37
|
+
*/
|
|
38
|
+
previewDatabaseId?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Wrangler remote flag for D1 commands.
|
|
41
|
+
*/
|
|
42
|
+
remote?: boolean;
|
|
43
|
+
}
|
|
17
44
|
export interface CloudflareWorkerSecurityCspConfig {
|
|
18
45
|
mode?: CloudflareWorkerSecurityCspMode;
|
|
19
46
|
directives?: Record<string, string[] | string | false>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CloudflareWorkerArtifactConfig, CloudflareWorkerSecurityConfig, DeployTarget, JsonValue } from './cloudflareDeploy';
|
|
2
|
-
export type { CloudflareWorkerArtifactConfig, CloudflareWorkerSecurityConfig, CloudflareWorkerSecurityCorsConfig, CloudflareWorkerSecurityCspConfig, CloudflareWorkerSecurityCspMode, CloudflareWorkerSecurityNoindexConfig, DeployTarget, JsonValue, } from './cloudflareDeploy';
|
|
1
|
+
import type { CloudflareWorkerArtifactConfig, CloudflareWorkerD1DatabaseConfig, CloudflareWorkerSecurityConfig, DeployTarget, JsonValue } from './cloudflareDeploy';
|
|
2
|
+
export type { CloudflareWorkerArtifactConfig, CloudflareWorkerD1DatabaseConfig, CloudflareWorkerSecurityConfig, CloudflareWorkerSecurityCorsConfig, CloudflareWorkerSecurityCspConfig, CloudflareWorkerSecurityCspMode, CloudflareWorkerSecurityNoindexConfig, DeployTarget, JsonValue, } from './cloudflareDeploy';
|
|
3
3
|
export interface MicroFrontend {
|
|
4
4
|
/**
|
|
5
5
|
* Specifies whether to enable the HTML entry.
|
|
@@ -47,6 +47,12 @@ export interface DeployUserConfig {
|
|
|
47
47
|
* Use this for provider resources such as migrations or generated config.
|
|
48
48
|
*/
|
|
49
49
|
artifacts?: CloudflareWorkerArtifactConfig[];
|
|
50
|
+
/**
|
|
51
|
+
* First-class Cloudflare D1 bindings. Modern.js writes these to
|
|
52
|
+
* `wrangler.json` as `d1_databases` and stages configured migration
|
|
53
|
+
* directories into `.output`.
|
|
54
|
+
*/
|
|
55
|
+
d1Databases?: CloudflareWorkerD1DatabaseConfig[];
|
|
50
56
|
/**
|
|
51
57
|
* Dist output paths that must not be copied into Cloudflare public assets.
|
|
52
58
|
* Entries are slash-normalized path prefixes relative to the app dist root.
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"modern",
|
|
18
18
|
"modern.js"
|
|
19
19
|
],
|
|
20
|
-
"version": "3.5.0-ultramodern.
|
|
20
|
+
"version": "3.5.0-ultramodern.10",
|
|
21
21
|
"types": "./dist/types/index.d.ts",
|
|
22
22
|
"main": "./dist/cjs/index.js",
|
|
23
23
|
"exports": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@babel/traverse": "^8.0.0",
|
|
79
79
|
"@babel/types": "^8.0.0",
|
|
80
80
|
"@loadable/component": "5.16.7",
|
|
81
|
-
"@rsbuild/core": "2.1.
|
|
81
|
+
"@rsbuild/core": "2.1.1",
|
|
82
82
|
"@swc/core": "1.15.43",
|
|
83
83
|
"@swc/helpers": "^0.5.23",
|
|
84
84
|
"compression-webpack-plugin": "^12.0.0",
|
|
@@ -90,22 +90,22 @@
|
|
|
90
90
|
"ndepe": "^0.1.13",
|
|
91
91
|
"pkg-types": "^2.3.1",
|
|
92
92
|
"std-env": "4.1.0",
|
|
93
|
-
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.5.0-ultramodern.
|
|
94
|
-
"@modern-js/
|
|
95
|
-
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.5.0-ultramodern.
|
|
96
|
-
"@modern-js/
|
|
97
|
-
"@modern-js/server
|
|
98
|
-
"@modern-js/
|
|
99
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.5.0-ultramodern.
|
|
100
|
-
"@modern-js/
|
|
101
|
-
"@modern-js/
|
|
102
|
-
"@modern-js/
|
|
93
|
+
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.5.0-ultramodern.10",
|
|
94
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.5.0-ultramodern.10",
|
|
95
|
+
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.5.0-ultramodern.10",
|
|
96
|
+
"@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.5.0-ultramodern.10",
|
|
97
|
+
"@modern-js/server": "npm:@bleedingdev/modern-js-server@3.5.0-ultramodern.10",
|
|
98
|
+
"@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.5.0-ultramodern.10",
|
|
99
|
+
"@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.5.0-ultramodern.10",
|
|
100
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.5.0-ultramodern.10",
|
|
101
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.5.0-ultramodern.10",
|
|
102
|
+
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.5.0-ultramodern.10"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@rslib/core": "0.23.
|
|
105
|
+
"@rslib/core": "0.23.1",
|
|
106
106
|
"@types/babel__traverse": "7.28.0",
|
|
107
107
|
"@types/node": "^26.0.1",
|
|
108
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
108
|
+
"@typescript/native-preview": "7.0.0-dev.20260628.1",
|
|
109
109
|
"ts-node": "^10.9.2",
|
|
110
110
|
"tsconfig-paths": "^4.2.0",
|
|
111
111
|
"typescript": "^6.0.3",
|