@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.27 → 3.5.0-ultramodern.28

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.
@@ -261,11 +261,12 @@ const getConfiguredWorkerName = (appDirectory, modernConfig)=>{
261
261
  const configuredName = modernConfig.deploy?.worker?.name?.trim();
262
262
  return configuredName || getWorkerName(appDirectory);
263
263
  };
264
- const normalizeRelativePath = (value, label, scope = 'app output')=>{
264
+ const normalizeRelativePath = (value, label, scope = 'app output', options = {})=>{
265
265
  if ('string' != typeof value) throw new Error(`${label} must be a relative path inside the ${scope}.`);
266
266
  const normalized = value.trim().replace(/\\/g, '/').replace(/^\.\/+/u, '').replace(/\/+$/u, '');
267
267
  const segments = normalized.split('/');
268
- if (!normalized || external_node_path_default().isAbsolute(normalized) || '.' === normalized || segments.includes('..')) throw new Error(`${label} must be a relative path inside the ${scope}.`);
268
+ const isRootDestination = '.' === normalized;
269
+ if (!normalized || external_node_path_default().isAbsolute(normalized) || !options.allowRoot && isRootDestination || segments.includes('..')) throw new Error(`${label} must be a relative path inside the ${scope}.`);
269
270
  return normalized;
270
271
  };
271
272
  const normalizeDirectiveValues = (value)=>{
@@ -451,7 +452,9 @@ const normalizeCloudflareArtifact = (artifact, index)=>{
451
452
  const getCloudflareArtifacts = (modernConfig)=>(modernConfig.deploy?.worker?.artifacts ?? []).map(normalizeCloudflareArtifact);
452
453
  const normalizeCloudflarePublicAsset = (asset, index)=>{
453
454
  const from = normalizeRelativePath(asset.from, `deploy.worker.publicAssets[${index}].from`, 'app root');
454
- const to = normalizeRelativePath(asset.to, `deploy.worker.publicAssets[${index}].to`, 'Cloudflare public output');
455
+ const to = normalizeRelativePath(asset.to, `deploy.worker.publicAssets[${index}].to`, 'Cloudflare public output', {
456
+ allowRoot: true
457
+ });
455
458
  return {
456
459
  from,
457
460
  to,
@@ -219,11 +219,12 @@ const getConfiguredWorkerName = (appDirectory, modernConfig)=>{
219
219
  const configuredName = modernConfig.deploy?.worker?.name?.trim();
220
220
  return configuredName || getWorkerName(appDirectory);
221
221
  };
222
- const normalizeRelativePath = (value, label, scope = 'app output')=>{
222
+ const normalizeRelativePath = (value, label, scope = 'app output', options = {})=>{
223
223
  if ('string' != typeof value) throw new Error(`${label} must be a relative path inside the ${scope}.`);
224
224
  const normalized = value.trim().replace(/\\/g, '/').replace(/^\.\/+/u, '').replace(/\/+$/u, '');
225
225
  const segments = normalized.split('/');
226
- if (!normalized || node_path.isAbsolute(normalized) || '.' === normalized || segments.includes('..')) throw new Error(`${label} must be a relative path inside the ${scope}.`);
226
+ const isRootDestination = '.' === normalized;
227
+ if (!normalized || node_path.isAbsolute(normalized) || !options.allowRoot && isRootDestination || segments.includes('..')) throw new Error(`${label} must be a relative path inside the ${scope}.`);
227
228
  return normalized;
228
229
  };
229
230
  const normalizeDirectiveValues = (value)=>{
@@ -409,7 +410,9 @@ const normalizeCloudflareArtifact = (artifact, index)=>{
409
410
  const getCloudflareArtifacts = (modernConfig)=>(modernConfig.deploy?.worker?.artifacts ?? []).map(normalizeCloudflareArtifact);
410
411
  const normalizeCloudflarePublicAsset = (asset, index)=>{
411
412
  const from = normalizeRelativePath(asset.from, `deploy.worker.publicAssets[${index}].from`, 'app root');
412
- const to = normalizeRelativePath(asset.to, `deploy.worker.publicAssets[${index}].to`, 'Cloudflare public output');
413
+ const to = normalizeRelativePath(asset.to, `deploy.worker.publicAssets[${index}].to`, 'Cloudflare public output', {
414
+ allowRoot: true
415
+ });
413
416
  return {
414
417
  from,
415
418
  to,
@@ -220,11 +220,12 @@ const getConfiguredWorkerName = (appDirectory, modernConfig)=>{
220
220
  const configuredName = modernConfig.deploy?.worker?.name?.trim();
221
221
  return configuredName || getWorkerName(appDirectory);
222
222
  };
223
- const normalizeRelativePath = (value, label, scope = 'app output')=>{
223
+ const normalizeRelativePath = (value, label, scope = 'app output', options = {})=>{
224
224
  if ('string' != typeof value) throw new Error(`${label} must be a relative path inside the ${scope}.`);
225
225
  const normalized = value.trim().replace(/\\/g, '/').replace(/^\.\/+/u, '').replace(/\/+$/u, '');
226
226
  const segments = normalized.split('/');
227
- if (!normalized || node_path.isAbsolute(normalized) || '.' === normalized || segments.includes('..')) throw new Error(`${label} must be a relative path inside the ${scope}.`);
227
+ const isRootDestination = '.' === normalized;
228
+ if (!normalized || node_path.isAbsolute(normalized) || !options.allowRoot && isRootDestination || segments.includes('..')) throw new Error(`${label} must be a relative path inside the ${scope}.`);
228
229
  return normalized;
229
230
  };
230
231
  const normalizeDirectiveValues = (value)=>{
@@ -410,7 +411,9 @@ const normalizeCloudflareArtifact = (artifact, index)=>{
410
411
  const getCloudflareArtifacts = (modernConfig)=>(modernConfig.deploy?.worker?.artifacts ?? []).map(normalizeCloudflareArtifact);
411
412
  const normalizeCloudflarePublicAsset = (asset, index)=>{
412
413
  const from = normalizeRelativePath(asset.from, `deploy.worker.publicAssets[${index}].from`, 'app root');
413
- const to = normalizeRelativePath(asset.to, `deploy.worker.publicAssets[${index}].to`, 'Cloudflare public output');
414
+ const to = normalizeRelativePath(asset.to, `deploy.worker.publicAssets[${index}].to`, 'Cloudflare public output', {
415
+ allowRoot: true
416
+ });
414
417
  return {
415
418
  from,
416
419
  to,
@@ -49,7 +49,8 @@ export interface DeployUserConfig {
49
49
  artifacts?: CloudflareWorkerArtifactConfig[];
50
50
  /**
51
51
  * Additional app-root files or directories to serve as Cloudflare Worker
52
- * Static Assets under `.output/public`.
52
+ * Static Assets under `.output/public`. Use `to: '.'` to copy a
53
+ * source directory's contents into the public asset root.
53
54
  */
54
55
  publicAssets?: CloudflareWorkerPublicAssetConfig[];
55
56
  /**
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.5.0-ultramodern.27",
20
+ "version": "3.5.0-ultramodern.28",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "main": "./dist/cjs/index.js",
23
23
  "exports": {
@@ -90,16 +90,16 @@
90
90
  "ndepe": "^0.1.13",
91
91
  "pkg-types": "^2.3.1",
92
92
  "std-env": "4.1.0",
93
- "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.5.0-ultramodern.27",
94
- "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.5.0-ultramodern.27",
95
- "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.5.0-ultramodern.27",
96
- "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.5.0-ultramodern.27",
97
- "@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.5.0-ultramodern.27",
98
- "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.5.0-ultramodern.27",
99
- "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.5.0-ultramodern.27",
100
- "@modern-js/server": "npm:@bleedingdev/modern-js-server@3.5.0-ultramodern.27",
101
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.5.0-ultramodern.27",
102
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.5.0-ultramodern.27"
93
+ "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.5.0-ultramodern.28",
94
+ "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.5.0-ultramodern.28",
95
+ "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.5.0-ultramodern.28",
96
+ "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.5.0-ultramodern.28",
97
+ "@modern-js/server": "npm:@bleedingdev/modern-js-server@3.5.0-ultramodern.28",
98
+ "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.5.0-ultramodern.28",
99
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.5.0-ultramodern.28",
100
+ "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.5.0-ultramodern.28",
101
+ "@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.5.0-ultramodern.28",
102
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.5.0-ultramodern.28"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@rslib/core": "0.23.1",