@universal-deploy/node 0.0.3 → 0.1.0
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/vite.d.ts +1 -1
- package/dist/vite.js +11 -18
- package/package.json +4 -4
package/dist/vite.d.ts
CHANGED
package/dist/vite.js
CHANGED
|
@@ -4,14 +4,17 @@ import { defaultClientConditions, defaultExternalConditions, defaultServerCondit
|
|
|
4
4
|
//#region src/vite.ts
|
|
5
5
|
const isBun = typeof Bun !== "undefined";
|
|
6
6
|
const isDeno = typeof Deno !== "undefined";
|
|
7
|
-
const
|
|
7
|
+
const re_udNode = /^virtual:ud:node-entry$/;
|
|
8
|
+
function findClientOutDir(env) {
|
|
9
|
+
return Object.values(env.getTopLevelConfig().environments).find((e) => e.consumer === "client")?.build.outDir;
|
|
10
|
+
}
|
|
8
11
|
function node(options) {
|
|
9
12
|
return [
|
|
10
13
|
{
|
|
11
|
-
name: "
|
|
14
|
+
name: "ud:node:entry",
|
|
12
15
|
apply: "build",
|
|
13
16
|
resolveId: {
|
|
14
|
-
filter: { id:
|
|
17
|
+
filter: { id: re_udNode },
|
|
15
18
|
async handler(id, importer) {
|
|
16
19
|
const resolved = await this.resolve("@universal-deploy/node/serve", importer);
|
|
17
20
|
if (!resolved) throw new Error(`Cannot find server entry ${JSON.stringify(id)}`);
|
|
@@ -21,23 +24,13 @@ function node(options) {
|
|
|
21
24
|
transform: {
|
|
22
25
|
filter: { code: /__UD_STATIC__/ },
|
|
23
26
|
handler(code) {
|
|
24
|
-
|
|
27
|
+
const outDir = findClientOutDir(this.environment);
|
|
28
|
+
return code.replace(/__UD_STATIC__/g, JSON.stringify(typeof options?.static === "string" || typeof options?.static === "boolean" ? options.static : typeof outDir === "string" ? outDir : true));
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
31
|
},
|
|
28
32
|
{
|
|
29
|
-
name: "
|
|
30
|
-
configEnvironment(_name, config) {
|
|
31
|
-
const defaultCondition = config.consumer === "client" ? defaultClientConditions : defaultServerConditions;
|
|
32
|
-
const additionalCondition = isBun ? ["bun"] : isDeno ? ["deno"] : [];
|
|
33
|
-
return { resolve: {
|
|
34
|
-
conditions: [...additionalCondition, ...defaultCondition],
|
|
35
|
-
externalConditions: [...additionalCondition, ...defaultExternalConditions]
|
|
36
|
-
} };
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "photon:node:node-like",
|
|
33
|
+
name: "ud:node:node-like",
|
|
41
34
|
configEnvironment(_name, config) {
|
|
42
35
|
const defaultCondition = config.consumer === "client" ? defaultClientConditions : defaultServerConditions;
|
|
43
36
|
const additionalCondition = isBun ? ["bun"] : isDeno ? ["deno"] : [];
|
|
@@ -48,14 +41,14 @@ function node(options) {
|
|
|
48
41
|
}
|
|
49
42
|
},
|
|
50
43
|
{
|
|
51
|
-
name: "
|
|
44
|
+
name: "ud:node:emit",
|
|
52
45
|
apply: "build",
|
|
53
46
|
config: {
|
|
54
47
|
order: "post",
|
|
55
48
|
handler() {
|
|
56
49
|
return {
|
|
57
50
|
environments: { ssr: {
|
|
58
|
-
build: { rollupOptions: { input: { index: "virtual:
|
|
51
|
+
build: { [this.meta.rolldownVersion ? "rolldownOptions" : "rollupOptions"]: { input: { index: "virtual:ud:node-entry" } } },
|
|
59
52
|
resolve: { noExternal: ["@universal-deploy/node"] }
|
|
60
53
|
} },
|
|
61
54
|
resolve: { alias: Object.fromEntries(builtinModules.filter((m) => !m.startsWith("node:")).map((m) => [m, `node:${m}`])) }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@universal-deploy/node",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"srvx": "^0.10.1",
|
|
14
|
-
"@universal-deploy/store": "^0.0
|
|
14
|
+
"@universal-deploy/store": "^0.1.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"vite": ">=7.1"
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^22.19.3",
|
|
26
|
-
"tsdown": "^0.20.
|
|
26
|
+
"tsdown": "^0.20.3",
|
|
27
27
|
"typescript": "^5.9.3",
|
|
28
|
-
"vite": "^
|
|
28
|
+
"vite": "^8.0.0-beta.13"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"dist/"
|