runcloud 0.2.172 → 0.2.174

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.
@@ -303,12 +303,10 @@ function evaluateDuplicateRoutes(root, item) {
303
303
  return makeItem(item, 'pass', 'No Expo Router app directory found.', 'scan: app/ directory absent');
304
304
  const routes = new Map();
305
305
  for (const file of walkFiles(appDir)) {
306
- if (!/\.(tsx|ts|jsx|js)$/.test(file) || /(^|\/)_layout\.(tsx|ts|jsx|js)$/.test(toRel(root, file)))
306
+ if (!/\.(tsx|ts|jsx|js)$/.test(file))
307
307
  continue;
308
- const route = routePath(appDir, file);
309
- const current = routes.get(route) ?? [];
310
- current.push(toRel(root, file));
311
- routes.set(route, current);
308
+ for (const route of routeKeys(appDir, file))
309
+ routes.set(route, [...(routes.get(route) ?? []), toRel(root, file)]);
312
310
  }
313
311
  const duplicates = [...routes.entries()].filter(([, files]) => files.length > 1);
314
312
  if (!duplicates.length)
@@ -571,12 +569,15 @@ function routerDir(root) {
571
569
  const src = path.join(root, 'src', 'app');
572
570
  return safeStat(src)?.isDirectory() ? src : path.join(root, 'app');
573
571
  }
574
- function routePath(appDir, file) {
575
- const rel = toRel(appDir, file).replace(/\.(tsx|ts|jsx|js)$/, '');
576
- const parts = rel.split('/').filter((part) => part && !/^\(.+\)$/.test(part));
577
- if (parts[parts.length - 1] === 'index')
578
- parts.pop();
579
- return `/${parts.join('/')}`;
572
+ function routeKeys(appDir, file) {
573
+ let keys = [''];
574
+ for (const part of toRel(appDir, file).replace(/\.(tsx|ts|jsx|js)$/, '').split('/')) {
575
+ let options = /^\(.+,.+\)$/.test(part) ? part.slice(1, -1).split(',').map((group) => `(${group})`) : [part];
576
+ if (keys.length * options.length > 64)
577
+ options = [part];
578
+ keys = keys.flatMap((key) => options.map((option) => `${key}/${option}`));
579
+ }
580
+ return keys;
580
581
  }
581
582
  function evidence(matches) {
582
583
  return matches.slice(0, 5).map((match) => `${match.file}:${match.line}: ${match.text}`).join('\n');
@@ -6,6 +6,7 @@ import { join } from 'node:path';
6
6
  import { Buffer } from 'node:buffer';
7
7
  import { create as tarCreate } from 'tar';
8
8
  import { readProjectLink } from './config.js';
9
+ import { wranglerConfigProblem } from './wrangler-config-check.js';
9
10
  export const NEWLY_BACKEND_DEPLOY_BUNDLE_CONTENT_TYPE = 'application/vnd.newly.deploy-bundle+gzip';
10
11
  export const NEWLY_BACKEND_DEPLOY_MODE_BUNDLE = 'bundle';
11
12
  const MANIFEST_PATH = 'newly-deploy.json';
@@ -20,6 +21,13 @@ export class DeployBuildError extends Error {
20
21
  }
21
22
  export async function buildDeployBundle(options) {
22
23
  const { projectId, projectDir, services, run, log } = options;
24
+ for (const service of services) {
25
+ const configPath = join(projectDir, 'backend', service.path, 'wrangler.toml');
26
+ const problem = existsSync(configPath) ? wranglerConfigProblem(readFileSync(configPath, 'utf8')) : null;
27
+ if (problem) {
28
+ throw new DeployBuildError(`${service.name}/wrangler.toml: ${problem}. Newly Backend would reject this deploy; fix the file and deploy again.`);
29
+ }
30
+ }
23
31
  const bunVersion = await run('bun', ['--version'], projectDir);
24
32
  if (bunVersion.code !== 0) {
25
33
  throw new DeployBuildError('newly deploy needs bun on your PATH (https://bun.sh)');
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '0.2.172';
1
+ export const CLI_VERSION = '0.2.174';
@@ -0,0 +1,46 @@
1
+ import { parse } from 'smol-toml';
2
+ export const UNSUPPORTED_WRANGLER_KEYS = [
3
+ 'kv_namespaces',
4
+ 'd1_databases',
5
+ 'durable_objects',
6
+ 'services',
7
+ 'hyperdrive',
8
+ 'ai',
9
+ 'vectorize',
10
+ 'browser',
11
+ 'analytics_engine_datasets',
12
+ 'assets',
13
+ 'workflows',
14
+ 'send_email',
15
+ 'mtls_certificates',
16
+ 'dispatch_namespaces',
17
+ 'tail_consumers',
18
+ ];
19
+ function isNonEmpty(value) {
20
+ if (value === undefined || value === null)
21
+ return false;
22
+ if (Array.isArray(value))
23
+ return value.length > 0;
24
+ if (typeof value === 'object')
25
+ return Object.keys(value).length > 0;
26
+ return true;
27
+ }
28
+ export function wranglerConfigProblem(configToml) {
29
+ let config;
30
+ try {
31
+ config = parse(configToml);
32
+ }
33
+ catch (error) {
34
+ return `wrangler.toml does not parse: ${error instanceof Error ? error.message : String(error)}`;
35
+ }
36
+ if (typeof config['compatibility_date'] !== 'string')
37
+ return 'compatibility_date must be a quoted string';
38
+ for (const key of UNSUPPORTED_WRANGLER_KEYS) {
39
+ if (isNonEmpty(config[key]))
40
+ return `${key} bindings are not supported for Newly Backend services`;
41
+ }
42
+ const triggers = (config['triggers'] ?? {});
43
+ if (isNonEmpty(triggers['crons']))
44
+ return 'cron triggers are not supported';
45
+ return null;
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.2.172",
3
+ "version": "0.2.174",
4
4
  "description": "Create and control run.cloud remote mobile simulators and cloud sandboxes",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
Binary file
Binary file