seedcord 0.21.4 → 0.21.5

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/README.md CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
  <div align="center">
19
19
 
20
- [![npm](https://img.shields.io/npm/v/seedcord?style=flat-square&logo=npm&logoColor=c8341f&label=&labelColor=1f1f1f&color=c8341f)](https://www.npmjs.com/package/seedcord) [![node](https://img.shields.io/node/v/seedcord?style=flat-square&label=node&labelColor=1f1f1f&color=4d7d33)](https://nodejs.org) [![license](https://img.shields.io/npm/l/seedcord?style=flat-square&label=license&labelColor=1f1f1f&color=f8f6e8)](LICENSE)
20
+ [![npm](https://img.shields.io/npm/v/seedcord?style=flat-square&label=npm&labelColor=1f1f1f&color=c8341f)](https://www.npmjs.com/package/seedcord) [![node](https://img.shields.io/node/v/seedcord?style=flat-square&label=node&labelColor=1f1f1f&color=4d7d33)](https://nodejs.org) [![bun](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fseedcord%2Fseedcord%2Fnext%2Fcli%2Fseedcord%2Fpackage.json&query=%24.engines.bun&style=flat-square&label=bun&labelColor=1f1f1f&color=fbf0df)](https://bun.com) [![license](https://img.shields.io/npm/l/seedcord?style=flat-square&label=license&labelColor=1f1f1f&color=f8f6e8)](LICENSE)
21
21
 
22
22
  </div>
23
23
 
package/bin/seedcord.mjs CHANGED
@@ -5,28 +5,49 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
5
5
 
6
6
  const here = dirname(fileURLToPath(import.meta.url));
7
7
 
8
- function declaredNodeRange() {
8
+ function declaredEngines() {
9
9
  try {
10
10
  const pkg = JSON.parse(readFileSync(resolve(here, '../package.json'), 'utf8'));
11
- return pkg.engines?.node ?? '';
11
+ return pkg.engines ?? {};
12
12
  } catch {
13
- return '';
13
+ return {};
14
14
  }
15
15
  }
16
16
 
17
- // importing core's own check here would load the code this guards
18
- function unsupportedNodeRange() {
19
- const range = declaredNodeRange();
17
+ function parseVersion(text) {
18
+ const [withoutBuild = ''] = text.replace(/^v/, '').split('+');
19
+ const [release = '', ...prerelease] = withoutBuild.split('-');
20
+ const parts = release.split('.').map(Number);
21
+ return parts.every(Number.isInteger) ? { parts, prerelease: prerelease.length > 0 } : undefined;
22
+ }
23
+
24
+ // semver ranks 1.4.2-canary.1 below 1.4.2
25
+ function meetsMinimum(required, running) {
26
+ const length = Math.max(required.parts.length, running.parts.length);
27
+ for (let index = 0; index < length; index++) {
28
+ const wanted = required.parts[index] ?? 0;
29
+ const got = running.parts[index] ?? 0;
30
+ if (got !== wanted) return got > wanted;
31
+ }
32
+ return !running.prerelease;
33
+ }
34
+
35
+ // importing core's assertDeclaredRuntime here would load the code this guards
36
+ function unsupportedRuntime() {
37
+ const engines = declaredEngines();
38
+ const { bun, node } = process.versions;
39
+ const runtime =
40
+ bun === undefined
41
+ ? { name: 'Node', range: engines.node ?? '', running: node }
42
+ : { name: 'Bun', range: engines.bun ?? '', running: bun };
20
43
 
21
- const required = new RegExp(String.raw`^>=(\d+)(?:\.(\d+))?`).exec(range.replaceAll(/\s/g, ''));
22
- const current = /^v?(\d+)\.(\d+)/.exec(process.version);
23
- if (!required || !current) return null;
44
+ const range = runtime.range.replaceAll(/\s/g, '');
45
+ if (!range.startsWith('>=')) return undefined;
24
46
 
25
- const requiredMinor = required[2] ?? '0';
26
- const meets =
27
- Number(current[1]) > Number(required[1]) ||
28
- (Number(current[1]) === Number(required[1]) && Number(current[2]) >= Number(requiredMinor));
29
- return meets ? null : range;
47
+ const required = parseVersion(range.slice('>='.length));
48
+ const running = parseVersion(runtime.running);
49
+ if (!required || !running || meetsMinimum(required, running)) return undefined;
50
+ return runtime;
30
51
  }
31
52
 
32
53
  async function run() {
@@ -41,10 +62,12 @@ async function run() {
41
62
  await import(pathToFileURL(srcEntry).href);
42
63
  }
43
64
 
44
- const unsupported = unsupportedNodeRange();
65
+ const unsupported = unsupportedRuntime();
45
66
  if (unsupported) {
46
67
  // eslint-disable-next-line no-console -- the bin has no logger
47
- console.error(`seedcord requires Node ${unsupported} and this process runs ${process.version}.`);
68
+ console.error(
69
+ `seedcord requires ${unsupported.name} ${unsupported.range} but this process runs ${unsupported.running}.`
70
+ );
48
71
  process.exit(1);
49
72
  }
50
73
 
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as SEEDCORD_CONFIG_FILENAMES, t as version } from "./src-BfciUrzr.mjs";
1
+ import { n as SEEDCORD_CONFIG_FILENAMES, t as version } from "./src-B41FGgG4.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { Command } from "@commander-js/extra-typings";
4
4
  import { LEVEL_COLOR, Logger, LoggerChannelRegistry } from "@seedcord/logger";
@@ -31,7 +31,6 @@ import process$1 from "node:process";
31
31
  import { assertNever } from "@seedcord/utils";
32
32
  import { settleWithin } from "@seedcord/core/node/internal";
33
33
  import { createServer, createServerModuleRunner, defineConfig, mergeConfig } from "vite";
34
- import tsconfigPaths from "vite-tsconfig-paths";
35
34
  import { minimatch } from "minimatch";
36
35
  import { createServer as createServer$1 } from "node:net";
37
36
 
@@ -3278,6 +3277,7 @@ function logsIgnore(root) {
3278
3277
  return (path) => path === logs || path.startsWith(logs + sep);
3279
3278
  }
3280
3279
  var vite_config_default = defineConfig({
3280
+ resolve: { tsconfigPaths: true },
3281
3281
  server: {
3282
3282
  middlewareMode: true,
3283
3283
  hmr: true,
@@ -3354,7 +3354,7 @@ var ViteDevRuntime = class {
3354
3354
  configFile: false,
3355
3355
  server: { watch: { ignored: [logsIgnore(projectRoot)] } },
3356
3356
  ssr: { noExternal: seedcordDependents(projectDir) },
3357
- plugins: [tsconfigPaths({ root: projectDir }), hmrPlugin.plugin]
3357
+ plugins: [hmrPlugin.plugin]
3358
3358
  });
3359
3359
  this.viteServer = await createServer(config);
3360
3360
  this.moduleRunner = createServerModuleRunner(this.viteServer.environments.ssr);