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 +1 -1
- package/bin/seedcord.mjs +39 -16
- package/dist/cli.mjs +3 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-BfciUrzr.mjs → src-B41FGgG4.mjs} +2 -2
- package/dist/{src-BfciUrzr.mjs.map → src-B41FGgG4.mjs.map} +1 -1
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
<div align="center">
|
|
19
19
|
|
|
20
|
-
[](https://www.npmjs.com/package/seedcord) [](https://nodejs.org) [](https://bun.com) [](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
|
|
8
|
+
function declaredEngines() {
|
|
9
9
|
try {
|
|
10
10
|
const pkg = JSON.parse(readFileSync(resolve(here, '../package.json'), 'utf8'));
|
|
11
|
-
return pkg.engines
|
|
11
|
+
return pkg.engines ?? {};
|
|
12
12
|
} catch {
|
|
13
|
-
return
|
|
13
|
+
return {};
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
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
|
|
22
|
-
|
|
23
|
-
if (!required || !current) return null;
|
|
44
|
+
const range = runtime.range.replaceAll(/\s/g, '');
|
|
45
|
+
if (!range.startsWith('>=')) return undefined;
|
|
24
46
|
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
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 =
|
|
65
|
+
const unsupported = unsupportedRuntime();
|
|
45
66
|
if (unsupported) {
|
|
46
67
|
// eslint-disable-next-line no-console -- the bin has no logger
|
|
47
|
-
console.error(
|
|
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-
|
|
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: [
|
|
3357
|
+
plugins: [hmrPlugin.plugin]
|
|
3358
3358
|
});
|
|
3359
3359
|
this.viteServer = await createServer(config);
|
|
3360
3360
|
this.moduleRunner = createServerModuleRunner(this.viteServer.environments.ssr);
|