one 1.1.311 → 1.1.312
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/cleanUrl.cjs +3 -8
- package/dist/cjs/cleanUrl.cjs.map +2 -2
- package/dist/cjs/cleanUrl.native.js +5 -8
- package/dist/cjs/cleanUrl.native.js.map +2 -2
- package/dist/cjs/cli.cjs +0 -2
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/cli.native.js +1 -2
- package/dist/cjs/cli.native.js.map +2 -2
- package/dist/cjs/config.cjs +1 -1
- package/dist/cjs/config.native.js +1 -1
- package/dist/cjs/config.native.js.map +1 -1
- package/dist/cjs/constants.cjs +9 -1
- package/dist/cjs/constants.cjs.map +1 -1
- package/dist/cjs/constants.native.js +9 -1
- package/dist/cjs/constants.native.js.map +2 -2
- package/dist/cjs/createApp.native.cjs +1 -1
- package/dist/cjs/createApp.native.js +1 -1
- package/dist/cjs/createApp.native.js.map +1 -1
- package/dist/cjs/createHandleRequest.cjs +2 -1
- package/dist/cjs/createHandleRequest.cjs.map +1 -1
- package/dist/cjs/createHandleRequest.native.js +2 -2
- package/dist/cjs/createHandleRequest.native.js.map +2 -2
- package/dist/cjs/matchers.cjs +1 -1
- package/dist/cjs/matchers.cjs.map +1 -1
- package/dist/cjs/matchers.native.js +1 -1
- package/dist/cjs/matchers.native.js.map +1 -1
- package/dist/cjs/serve.cjs +3 -3
- package/dist/cjs/serve.cjs.map +1 -1
- package/dist/cjs/serve.native.js +2 -2
- package/dist/cjs/serve.native.js.map +2 -2
- package/dist/cjs/useLoader.cjs +1 -1
- package/dist/cjs/useLoader.native.js +1 -1
- package/dist/cjs/vite/build.cjs +2 -2
- package/dist/cjs/vite/build.cjs.map +1 -1
- package/dist/cjs/vite/build.native.js +1 -1
- package/dist/cjs/vite/build.native.js.map +1 -1
- package/dist/cjs/vite/clientTreeShakePlugin.cjs +1 -1
- package/dist/cjs/vite/clientTreeShakePlugin.native.js +1 -1
- package/dist/cjs/vite/createFileSystemRouter.cjs +1 -1
- package/dist/cjs/vite/createFileSystemRouter.native.js +1 -1
- package/dist/cjs/vite/one.cjs +43 -14
- package/dist/cjs/vite/one.cjs.map +1 -1
- package/dist/cjs/vite/one.native.js +39 -12
- package/dist/cjs/vite/one.native.js.map +2 -2
- package/dist/cjs/vite/virtualEntryPlugin.cjs +5 -5
- package/dist/cjs/vite/virtualEntryPlugin.native.js +5 -5
- package/dist/cjs/vite/virtualEntryPlugin.native.js.map +1 -1
- package/dist/cjs/vite/vitePluginSsrCss.cjs +1 -1
- package/dist/cjs/vite/vitePluginSsrCss.native.js +1 -1
- package/dist/esm/cleanUrl.js +10 -9
- package/dist/esm/cleanUrl.js.map +1 -1
- package/dist/esm/cleanUrl.mjs +4 -9
- package/dist/esm/cleanUrl.mjs.map +1 -1
- package/dist/esm/cleanUrl.native.js +5 -9
- package/dist/esm/cleanUrl.native.js.map +2 -2
- package/dist/esm/cli.js +0 -2
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/cli.mjs +0 -2
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/cli.native.js +0 -2
- package/dist/esm/cli.native.js.map +2 -2
- package/dist/esm/config.js +1 -1
- package/dist/esm/config.mjs +1 -1
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/config.native.js +1 -1
- package/dist/esm/config.native.js.map +1 -1
- package/dist/esm/constants.js +5 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/constants.mjs +6 -2
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/constants.native.js +5 -1
- package/dist/esm/constants.native.js.map +2 -2
- package/dist/esm/createApp.native.js +1 -1
- package/dist/esm/createApp.native.js.map +1 -1
- package/dist/esm/createHandleRequest.js +2 -1
- package/dist/esm/createHandleRequest.js.map +1 -1
- package/dist/esm/createHandleRequest.mjs +2 -1
- package/dist/esm/createHandleRequest.mjs.map +1 -1
- package/dist/esm/createHandleRequest.native.js +2 -1
- package/dist/esm/createHandleRequest.native.js.map +2 -2
- package/dist/esm/matchers.js +1 -1
- package/dist/esm/matchers.js.map +1 -1
- package/dist/esm/matchers.mjs +1 -1
- package/dist/esm/matchers.mjs.map +1 -1
- package/dist/esm/matchers.native.js +1 -1
- package/dist/esm/matchers.native.js.map +1 -1
- package/dist/esm/serve.js +4 -4
- package/dist/esm/serve.js.map +1 -1
- package/dist/esm/serve.mjs +4 -4
- package/dist/esm/serve.mjs.map +1 -1
- package/dist/esm/serve.native.js +4 -4
- package/dist/esm/serve.native.js.map +2 -2
- package/dist/esm/useLoader.js +1 -1
- package/dist/esm/useLoader.mjs +1 -1
- package/dist/esm/useLoader.native.js +1 -1
- package/dist/esm/vite/build.js +1 -1
- package/dist/esm/vite/build.js.map +1 -1
- package/dist/esm/vite/build.mjs +1 -1
- package/dist/esm/vite/build.mjs.map +1 -1
- package/dist/esm/vite/build.native.js +1 -1
- package/dist/esm/vite/build.native.js.map +2 -2
- package/dist/esm/vite/clientTreeShakePlugin.js +1 -1
- package/dist/esm/vite/clientTreeShakePlugin.mjs +1 -1
- package/dist/esm/vite/clientTreeShakePlugin.native.js +1 -1
- package/dist/esm/vite/createFileSystemRouter.js +1 -1
- package/dist/esm/vite/createFileSystemRouter.mjs +1 -1
- package/dist/esm/vite/createFileSystemRouter.native.js +1 -1
- package/dist/esm/vite/one.js +43 -14
- package/dist/esm/vite/one.js.map +1 -1
- package/dist/esm/vite/one.mjs +43 -14
- package/dist/esm/vite/one.mjs.map +1 -1
- package/dist/esm/vite/one.native.js +41 -14
- package/dist/esm/vite/one.native.js.map +2 -2
- package/dist/esm/vite/virtualEntryPlugin.js +5 -5
- package/dist/esm/vite/virtualEntryPlugin.mjs +5 -5
- package/dist/esm/vite/virtualEntryPlugin.mjs.map +1 -1
- package/dist/esm/vite/virtualEntryPlugin.native.js +5 -5
- package/dist/esm/vite/virtualEntryPlugin.native.js.map +1 -1
- package/dist/esm/vite/vitePluginSsrCss.js +1 -1
- package/dist/esm/vite/vitePluginSsrCss.mjs +1 -1
- package/dist/esm/vite/vitePluginSsrCss.native.js +1 -1
- package/package.json +8 -8
- package/src/cleanUrl.ts +10 -14
- package/src/cli.ts +0 -3
- package/src/config.ts +1 -1
- package/src/constants.ts +6 -0
- package/src/createApp.native.tsx +2 -2
- package/src/createHandleRequest.ts +2 -1
- package/src/matchers.ts +1 -1
- package/src/serve.ts +5 -3
- package/src/useLoader.ts +1 -1
- package/src/vite/build.ts +2 -1
- package/src/vite/clientTreeShakePlugin.ts +1 -1
- package/src/vite/createFileSystemRouter.tsx +1 -1
- package/src/vite/one.ts +44 -11
- package/src/vite/virtualEntryPlugin.ts +5 -5
- package/src/vite/vitePluginSsrCss.ts +1 -1
- package/types/cleanUrl.d.ts.map +1 -1
- package/types/constants.d.ts +4 -0
- package/types/constants.d.ts.map +1 -1
- package/types/createHandleRequest.d.ts.map +1 -1
- package/types/serve.d.ts.map +1 -1
- package/types/vite/build.d.ts.map +1 -1
- package/types/vite/one.d.ts.map +1 -1
- package/dist/cjs/router/constants.cjs +0 -26
- package/dist/cjs/router/constants.cjs.map +0 -6
- package/dist/cjs/router/constants.native.js +0 -26
- package/dist/cjs/router/constants.native.js.map +0 -6
- package/dist/cjs/vite/loadEnv.cjs +0 -47
- package/dist/cjs/vite/loadEnv.cjs.map +0 -6
- package/dist/cjs/vite/loadEnv.native.js +0 -44
- package/dist/cjs/vite/loadEnv.native.js.map +0 -6
- package/dist/esm/router/constants.js +0 -5
- package/dist/esm/router/constants.js.map +0 -6
- package/dist/esm/router/constants.mjs +0 -3
- package/dist/esm/router/constants.mjs.map +0 -1
- package/dist/esm/router/constants.native.js +0 -5
- package/dist/esm/router/constants.native.js.map +0 -6
- package/dist/esm/vite/loadEnv.js +0 -13
- package/dist/esm/vite/loadEnv.js.map +0 -6
- package/dist/esm/vite/loadEnv.mjs +0 -13
- package/dist/esm/vite/loadEnv.mjs.map +0 -1
- package/dist/esm/vite/loadEnv.native.js +0 -16
- package/dist/esm/vite/loadEnv.native.js.map +0 -6
- package/src/router/constants.ts +0 -4
- package/src/vite/loadEnv.ts +0 -11
- package/types/router/constants.d.ts +0 -2
- package/types/router/constants.d.ts.map +0 -1
- package/types/vite/loadEnv.d.ts +0 -2
- package/types/vite/loadEnv.d.ts.map +0 -1
package/dist/esm/vite/one.js
CHANGED
@@ -1,30 +1,38 @@
|
|
1
|
+
import { resolvePath } from "@vxrn/resolve";
|
1
2
|
import events from "node:events";
|
2
3
|
import path, { dirname, resolve } from "node:path";
|
3
4
|
import { loadConfigFromFile } from "vite";
|
4
5
|
import tsconfigPaths from "vite-tsconfig-paths";
|
5
|
-
import { getOptimizeDeps, getOptionsFilled, isWebEnvironment } from "vxrn";
|
6
|
+
import { getOptimizeDeps, getOptionsFilled, isWebEnvironment, loadEnv } from "vxrn";
|
7
|
+
import { CACHE_KEY } from "../constants";
|
6
8
|
import "../polyfills-server";
|
7
9
|
import { existsAsync } from "../utils/existsAsync";
|
8
|
-
import { resolvePath } from "@vxrn/resolve";
|
9
10
|
import { clientTreeShakePlugin } from "./clientTreeShakePlugin";
|
10
11
|
import { createFileSystemRouter } from "./createFileSystemRouter";
|
11
12
|
import { ensureTSConfig } from "./ensureTsConfig";
|
12
13
|
import { fixDependenciesPlugin } from "./fixDependenciesPlugin";
|
13
14
|
import { generateTypesForRoutes } from "./generateTypesForRoutes";
|
14
|
-
import { loadEnv } from "./loadEnv";
|
15
15
|
import { createVirtualEntry, virtualEntryId } from "./virtualEntryPlugin";
|
16
16
|
import { vitePluginSsrCss } from "./vitePluginSsrCss";
|
17
17
|
events.setMaxListeners(1e3);
|
18
18
|
globalThis.__vxrnEnableNativeEnv = !0;
|
19
19
|
function one(options = {}) {
|
20
|
-
oneOptions = options,
|
20
|
+
oneOptions = options, options.config?.ensureTSConfig !== !1 && ensureTSConfig(), globalThis.__vxrnPluginConfig__ = options;
|
21
21
|
const { optimizeDeps } = getOptimizeDeps("build"), optimizeIds = optimizeDeps.include, optimizeIdRegex = new RegExp(
|
22
22
|
// santize ids for regex
|
23
23
|
// https://stackoverflow.com/questions/6300183/sanitize-string-of-regex-characters-before-regexp-build
|
24
24
|
`${optimizeIds.map((id) => id.replace(/[#-.]|[[-^]|[?|{}]/g, "\\$&")).join("|")}`
|
25
25
|
);
|
26
26
|
let tsConfigPathsPlugin = null;
|
27
|
-
const vxrnOptions = getOptionsFilled(), devAndProdPlugins = [
|
27
|
+
const vxrnOptions = getOptionsFilled(), { clientEnvDefine } = loadEnv(vxrnOptions?.mode ?? "development"), devAndProdPlugins = [
|
28
|
+
{
|
29
|
+
name: "one-define-env",
|
30
|
+
config() {
|
31
|
+
return {
|
32
|
+
define: clientEnvDefine
|
33
|
+
};
|
34
|
+
}
|
35
|
+
},
|
28
36
|
// proxy because you cant add a plugin inside a plugin
|
29
37
|
new Proxy(
|
30
38
|
{
|
@@ -83,24 +91,42 @@ function one(options = {}) {
|
|
83
91
|
return {
|
84
92
|
define: {
|
85
93
|
...options.web?.defaultRenderMode && {
|
86
|
-
"process.env.
|
94
|
+
"process.env.ONE_DEFAULT_RENDER_MODE": JSON.stringify(options.web.defaultRenderMode),
|
95
|
+
"import.meta.env.ONE_DEFAULT_RENDER_MODE": JSON.stringify(
|
96
|
+
options.web.defaultRenderMode
|
97
|
+
)
|
87
98
|
},
|
88
99
|
...options.setupFile && {
|
89
|
-
"process.env.
|
100
|
+
"process.env.ONE_SETUP_FILE": JSON.stringify(options.setupFile)
|
90
101
|
},
|
91
102
|
...process.env.NODE_ENV !== "production" && vxrnOptions && {
|
92
|
-
"process.env.ONE_SERVER_URL": JSON.stringify(vxrnOptions.server.url)
|
103
|
+
"process.env.ONE_SERVER_URL": JSON.stringify(vxrnOptions.server.url),
|
104
|
+
"import.meta.env.ONE_SERVER_URL": JSON.stringify(vxrnOptions.server.url)
|
93
105
|
}
|
94
106
|
},
|
95
107
|
environments: {
|
96
108
|
client: {
|
97
109
|
define: {
|
98
|
-
"process.env.VITE_ENVIRONMENT": '"client"'
|
110
|
+
"process.env.VITE_ENVIRONMENT": '"client"',
|
111
|
+
"import.meta.env.VITE_ENVIRONMENT": '"client"'
|
99
112
|
}
|
100
113
|
},
|
101
114
|
ssr: {
|
102
115
|
define: {
|
103
|
-
"process.env.VITE_ENVIRONMENT": '"ssr"'
|
116
|
+
"process.env.VITE_ENVIRONMENT": '"ssr"',
|
117
|
+
"import.meta.env.VITE_ENVIRONMENT": '"ssr"'
|
118
|
+
}
|
119
|
+
},
|
120
|
+
ios: {
|
121
|
+
define: {
|
122
|
+
"process.env.VITE_ENVIRONMENT": '"ios"',
|
123
|
+
"import.meta.env.VITE_ENVIRONMENT": '"ios"'
|
124
|
+
}
|
125
|
+
},
|
126
|
+
android: {
|
127
|
+
define: {
|
128
|
+
"process.env.VITE_ENVIRONMENT": '"android"',
|
129
|
+
"import.meta.env.VITE_ENVIRONMENT": '"android"'
|
104
130
|
}
|
105
131
|
}
|
106
132
|
}
|
@@ -156,18 +182,21 @@ function one(options = {}) {
|
|
156
182
|
root: "app"
|
157
183
|
}),
|
158
184
|
{
|
159
|
-
name: "define-
|
185
|
+
name: "one-define-environment",
|
160
186
|
config() {
|
161
187
|
if (options.app?.key)
|
162
188
|
return {
|
163
189
|
define: {
|
164
|
-
"process.env.
|
190
|
+
"process.env.ONE_APP_NAME": JSON.stringify(options.app.key),
|
191
|
+
"import.meta.env.ONE_APP_NAME": JSON.stringify(options.app.key),
|
192
|
+
"process.env.ONE_CACHE_KEY": JSON.stringify(CACHE_KEY),
|
193
|
+
"import.meta.env.ONE_CACHE_KEY": JSON.stringify(CACHE_KEY)
|
165
194
|
}
|
166
195
|
};
|
167
196
|
}
|
168
197
|
},
|
169
198
|
{
|
170
|
-
name: "use-react-18-for-native",
|
199
|
+
name: "one-use-react-18-for-native",
|
171
200
|
enforce: "pre",
|
172
201
|
async config() {
|
173
202
|
const sharedNativeConfig = {
|
@@ -192,7 +221,7 @@ function one(options = {}) {
|
|
192
221
|
}
|
193
222
|
},
|
194
223
|
{
|
195
|
-
name: "optimize-deps-load-web-extensions",
|
224
|
+
name: "one-optimize-deps-load-web-extensions",
|
196
225
|
enforce: "pre",
|
197
226
|
applyToEnvironment(environment) {
|
198
227
|
return isWebEnvironment(environment);
|
package/dist/esm/vite/one.js.map
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/vite/one.ts"],
|
4
|
-
"mappings": "AAAA,OAAO,YAAY;AACnB,OAAO,QAAQ,SAAS,eAAe;AACvC,SAA0D,0BAA0B;AACpF,OAAO,mBAAmB;AAC1B,SAAS,iBAAiB,kBAAkB,
|
4
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,OAAO,YAAY;AACnB,OAAO,QAAQ,SAAS,eAAe;AACvC,SAA0D,0BAA0B;AACpF,OAAO,mBAAmB;AAC1B,SAAS,iBAAiB,kBAAkB,kBAAkB,eAAe;AAC7E,SAAS,iBAAiB;AAC1B,OAAO;AACP,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AACvC,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AAEvC,SAAS,oBAAoB,sBAAsB;AACnD,SAAS,wBAAwB;AAEjC,OAAO,gBAAgB,GAAK;AAG5B,WAAW,wBAAwB;AAE5B,SAAS,IAAI,UAA6B,CAAC,GAAiB;AACjE,eAAa,SAGT,QAAQ,QAAQ,mBAAmB,MAChC,eAAe,GAGtB,WAAW,uBAA0B;AAGrC,QAAM,EAAE,aAAa,IAAI,gBAAgB,OAAO,GAC1C,cAAc,aAAa,SAC3B,kBAAkB,IAAI;AAAA;AAAA;AAAA,IAG1B,GAAG,YAAY,IAAI,CAAC,OAAO,GAAG,QAAQ,uBAAuB,MAAM,CAAC,EAAE,KAAK,GAAG,CAAC;AAAA,EACjF;AAEA,MAAI,sBAAqC;AAEzC,QAAM,cAAc,iBAAiB,GAE/B,EAAE,gBAAgB,IAAI,QAAQ,aAAa,QAAQ,aAAa,GAEhE,oBAAoB;AAAA,IACxB;AAAA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BAAmB,aAAa;AAC9B,eAAO,iBAAiB,WAAW;AAAA,MACrC;AAAA,MAEA,MAAM,UAAU,IAAI,WAAW,IAAI;AAGjC,YAFuB,gBAAgB,KAAK,QAAQ,GAEhC;AAClB,gBAAM,eAAe,QAAQ,QAAQ,QAAQ,GAAG,EAAE,GAC5C,UAAU,aAAa,QAAQ,WAAW,EAAE,IAAI;AACtD,cAAI,YAAY,GAAI;AACpB,cAAI;AACF,kBAAM,gBAAgB,eAAe;AACrC,gBAAI,MAAM,YAAY,aAAa;AACjC,qBAAO;AAET,gBAAI,MAAM,YAAY,OAAO;AAC3B,qBAAO;AAAA,UAEX,SAAS,KAAK;AACZ,oBAAQ,KAAK,uBAAuB,GAAG;AAAA,UACzC;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IAEA,iBAAiB;AAAA,MACf,SAAS,CAAC,cAAc;AAAA,IAC1B,CAAC;AAAA,EACH;AACF;AAEA,IAAI,aAAuC;AAE3C,eAAe,kBAAkB,SAA6B;AAC5D,MAAI,CAAC,YAAY;AACf,QAAI,CAAC,QAAS,OAAM,IAAI,MAAM,yCAAyC;AACvE,UAAM,mBAAmB,OAAO;AAAA,EAClC;AACA,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,4BAA4B;AAE9C,SAAO;AACT;AAEA,eAAsB,mBAAmB,SAA4B;AAKnE,MAAI,CAJU,MAAM,mBAAmB;AAAA,IACrC,MAAM;AAAA,IACN;AAAA,EACF,CAAC;AAEC,UAAM,IAAI,MAAM,sBAAsB,QAAQ,IAAI,CAAC,kCAAkC;AAEvF,QAAM,eAAe,kBAAkB;AACvC,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,yCAAyC;AAE3D,SAAO;AACT;",
|
5
5
|
"names": []
|
6
6
|
}
|
package/dist/esm/vite/one.mjs
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
+
import { resolvePath } from "@vxrn/resolve";
|
1
2
|
import events from "node:events";
|
2
3
|
import path, { dirname, resolve } from "node:path";
|
3
4
|
import { loadConfigFromFile } from "vite";
|
4
5
|
import tsconfigPaths from "vite-tsconfig-paths";
|
5
|
-
import { getOptimizeDeps, getOptionsFilled, isWebEnvironment } from "vxrn";
|
6
|
+
import { getOptimizeDeps, getOptionsFilled, isWebEnvironment, loadEnv } from "vxrn";
|
7
|
+
import { CACHE_KEY } from "../constants.mjs";
|
6
8
|
import "../polyfills-server.mjs";
|
7
9
|
import { existsAsync } from "../utils/existsAsync.mjs";
|
8
|
-
import { resolvePath } from "@vxrn/resolve";
|
9
10
|
import { clientTreeShakePlugin } from "./clientTreeShakePlugin.mjs";
|
10
11
|
import { createFileSystemRouter } from "./createFileSystemRouter.mjs";
|
11
12
|
import { ensureTSConfig } from "./ensureTsConfig.mjs";
|
12
13
|
import { fixDependenciesPlugin } from "./fixDependenciesPlugin.mjs";
|
13
14
|
import { generateTypesForRoutes } from "./generateTypesForRoutes.mjs";
|
14
|
-
import { loadEnv } from "./loadEnv.mjs";
|
15
15
|
import { createVirtualEntry, virtualEntryId } from "./virtualEntryPlugin.mjs";
|
16
16
|
import { vitePluginSsrCss } from "./vitePluginSsrCss.mjs";
|
17
17
|
events.setMaxListeners(1e3);
|
18
18
|
globalThis.__vxrnEnableNativeEnv = !0;
|
19
19
|
function one(options = {}) {
|
20
|
-
oneOptions = options,
|
20
|
+
oneOptions = options, options.config?.ensureTSConfig !== !1 && ensureTSConfig(), globalThis.__vxrnPluginConfig__ = options;
|
21
21
|
const {
|
22
22
|
optimizeDeps
|
23
23
|
} = getOptimizeDeps("build"),
|
@@ -28,7 +28,17 @@ function one(options = {}) {
|
|
28
28
|
`${optimizeIds.map(id => id.replace(/[#-.]|[[-^]|[?|{}]/g, "\\$&")).join("|")}`);
|
29
29
|
let tsConfigPathsPlugin = null;
|
30
30
|
const vxrnOptions = getOptionsFilled(),
|
31
|
-
|
31
|
+
{
|
32
|
+
clientEnvDefine
|
33
|
+
} = loadEnv(vxrnOptions?.mode ?? "development"),
|
34
|
+
devAndProdPlugins = [{
|
35
|
+
name: "one-define-env",
|
36
|
+
config() {
|
37
|
+
return {
|
38
|
+
define: clientEnvDefine
|
39
|
+
};
|
40
|
+
}
|
41
|
+
},
|
32
42
|
// proxy because you cant add a plugin inside a plugin
|
33
43
|
new Proxy({
|
34
44
|
name: "one:tsconfig-paths",
|
@@ -76,24 +86,40 @@ function one(options = {}) {
|
|
76
86
|
return {
|
77
87
|
define: {
|
78
88
|
...(options.web?.defaultRenderMode && {
|
79
|
-
"process.env.
|
89
|
+
"process.env.ONE_DEFAULT_RENDER_MODE": JSON.stringify(options.web.defaultRenderMode),
|
90
|
+
"import.meta.env.ONE_DEFAULT_RENDER_MODE": JSON.stringify(options.web.defaultRenderMode)
|
80
91
|
}),
|
81
92
|
...(options.setupFile && {
|
82
|
-
"process.env.
|
93
|
+
"process.env.ONE_SETUP_FILE": JSON.stringify(options.setupFile)
|
83
94
|
}),
|
84
95
|
...(process.env.NODE_ENV !== "production" && vxrnOptions && {
|
85
|
-
"process.env.ONE_SERVER_URL": JSON.stringify(vxrnOptions.server.url)
|
96
|
+
"process.env.ONE_SERVER_URL": JSON.stringify(vxrnOptions.server.url),
|
97
|
+
"import.meta.env.ONE_SERVER_URL": JSON.stringify(vxrnOptions.server.url)
|
86
98
|
})
|
87
99
|
},
|
88
100
|
environments: {
|
89
101
|
client: {
|
90
102
|
define: {
|
91
|
-
"process.env.VITE_ENVIRONMENT": '"client"'
|
103
|
+
"process.env.VITE_ENVIRONMENT": '"client"',
|
104
|
+
"import.meta.env.VITE_ENVIRONMENT": '"client"'
|
92
105
|
}
|
93
106
|
},
|
94
107
|
ssr: {
|
95
108
|
define: {
|
96
|
-
"process.env.VITE_ENVIRONMENT": '"ssr"'
|
109
|
+
"process.env.VITE_ENVIRONMENT": '"ssr"',
|
110
|
+
"import.meta.env.VITE_ENVIRONMENT": '"ssr"'
|
111
|
+
}
|
112
|
+
},
|
113
|
+
ios: {
|
114
|
+
define: {
|
115
|
+
"process.env.VITE_ENVIRONMENT": '"ios"',
|
116
|
+
"import.meta.env.VITE_ENVIRONMENT": '"ios"'
|
117
|
+
}
|
118
|
+
},
|
119
|
+
android: {
|
120
|
+
define: {
|
121
|
+
"process.env.VITE_ENVIRONMENT": '"android"',
|
122
|
+
"import.meta.env.VITE_ENVIRONMENT": '"android"'
|
97
123
|
}
|
98
124
|
}
|
99
125
|
}
|
@@ -143,16 +169,19 @@ function one(options = {}) {
|
|
143
169
|
...options,
|
144
170
|
root: "app"
|
145
171
|
}), {
|
146
|
-
name: "define-
|
172
|
+
name: "one-define-environment",
|
147
173
|
config() {
|
148
174
|
if (options.app?.key) return {
|
149
175
|
define: {
|
150
|
-
"process.env.
|
176
|
+
"process.env.ONE_APP_NAME": JSON.stringify(options.app.key),
|
177
|
+
"import.meta.env.ONE_APP_NAME": JSON.stringify(options.app.key),
|
178
|
+
"process.env.ONE_CACHE_KEY": JSON.stringify(CACHE_KEY),
|
179
|
+
"import.meta.env.ONE_CACHE_KEY": JSON.stringify(CACHE_KEY)
|
151
180
|
}
|
152
181
|
};
|
153
182
|
}
|
154
183
|
}, {
|
155
|
-
name: "use-react-18-for-native",
|
184
|
+
name: "one-use-react-18-for-native",
|
156
185
|
enforce: "pre",
|
157
186
|
async config() {
|
158
187
|
const sharedNativeConfig = {
|
@@ -176,7 +205,7 @@ function one(options = {}) {
|
|
176
205
|
};
|
177
206
|
}
|
178
207
|
}, {
|
179
|
-
name: "optimize-deps-load-web-extensions",
|
208
|
+
name: "one-optimize-deps-load-web-extensions",
|
180
209
|
enforce: "pre",
|
181
210
|
applyToEnvironment(environment) {
|
182
211
|
return isWebEnvironment(environment);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["events","path","dirname","resolve","loadConfigFromFile","tsconfigPaths","getOptimizeDeps","getOptionsFilled","isWebEnvironment","
|
1
|
+
{"version":3,"names":["resolvePath","events","path","dirname","resolve","loadConfigFromFile","tsconfigPaths","getOptimizeDeps","getOptionsFilled","isWebEnvironment","loadEnv","CACHE_KEY","existsAsync","clientTreeShakePlugin","createFileSystemRouter","ensureTSConfig","fixDependenciesPlugin","generateTypesForRoutes","createVirtualEntry","virtualEntryId","vitePluginSsrCss","setMaxListeners","globalThis","__vxrnEnableNativeEnv","one","options","oneOptions","config","__vxrnPluginConfig__","optimizeDeps","optimizeIds","include","optimizeIdRegex","RegExp","map","id","replace","join","tsConfigPathsPlugin","vxrnOptions","clientEnvDefine","mode","devAndProdPlugins","name","define","Proxy","configIncoming","pathsConfig","tsConfigPaths","plugins","flat","some","p","configResolved","resolveId","get","target","key","thisArg","Reflect","enforce","alias","tslib","web","defaultRenderMode","JSON","stringify","setupFile","process","env","NODE_ENV","server","url","environments","client","ssr","ios","android","zero","TESTING","REPLICACHE_VERSION","ZERO_VERSION","hotUpdate","modules","m","relative","root","split","sep","acceptedHmrExports","Set","__vxrnAddNativePlugins","__vxrnAddWebPluginsProd","deps","app","sharedNativeConfig","react","applyToEnvironment","environment","importer","test","absolutePath","webPath","directoryPath","err","console","warn","entries","getUserOneOptions","command","Error","loadUserOneOptions","cwd","foundOptions"],"sources":["../../../src/vite/one.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,WAAA,QAAmB;AAC5B,OAAOC,MAAA,MAAY;AACnB,OAAOC,IAAA,IAAQC,OAAA,EAASC,OAAA,QAAe;AACvC,SAA0DC,kBAAA,QAA0B;AACpF,OAAOC,aAAA,MAAmB;AAC1B,SAASC,eAAA,EAAiBC,gBAAA,EAAkBC,gBAAA,EAAkBC,OAAA,QAAe;AAC7E,SAASC,SAAA,QAAiB;AAC1B,OAAO;AACP,SAASC,WAAA,QAAmB;AAC5B,SAASC,qBAAA,QAA6B;AACtC,SAASC,sBAAA,QAA8B;AACvC,SAASC,cAAA,QAAsB;AAC/B,SAASC,qBAAA,QAA6B;AACtC,SAASC,sBAAA,QAA8B;AAEvC,SAASC,kBAAA,EAAoBC,cAAA,QAAsB;AACnD,SAASC,gBAAA,QAAwB;AAEjCnB,MAAA,CAAO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
2
3
|
import path, { dirname, resolve } from "node:path";
|
3
4
|
import { loadConfigFromFile } from "vite";
|
4
5
|
import tsconfigPaths from "vite-tsconfig-paths";
|
5
|
-
import { getOptimizeDeps, getOptionsFilled, isWebEnvironment } from "vxrn";
|
6
|
+
import { getOptimizeDeps, getOptionsFilled, isWebEnvironment, loadEnv } from "vxrn";
|
7
|
+
import { CACHE_KEY } from "../constants";
|
6
8
|
import "../polyfills-server";
|
7
9
|
import { existsAsync } from "../utils/existsAsync";
|
8
|
-
import { resolvePath } from "@vxrn/resolve";
|
9
10
|
import { clientTreeShakePlugin } from "./clientTreeShakePlugin";
|
10
11
|
import { createFileSystemRouter } from "./createFileSystemRouter";
|
11
12
|
import { ensureTSConfig } from "./ensureTsConfig";
|
12
13
|
import { fixDependenciesPlugin } from "./fixDependenciesPlugin";
|
13
14
|
import { generateTypesForRoutes } from "./generateTypesForRoutes";
|
14
|
-
import { loadEnv } from "./loadEnv";
|
15
15
|
import { createVirtualEntry, virtualEntryId } from "./virtualEntryPlugin";
|
16
16
|
import { vitePluginSsrCss } from "./vitePluginSsrCss";
|
17
17
|
events.setMaxListeners(1e3);
|
18
18
|
globalThis.__vxrnEnableNativeEnv = !0;
|
19
19
|
function one() {
|
20
20
|
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _options_config;
|
21
|
-
oneOptions = options,
|
21
|
+
oneOptions = options, ((_options_config = options.config) === null || _options_config === void 0 ? void 0 : _options_config.ensureTSConfig) !== !1 && ensureTSConfig(), globalThis.__vxrnPluginConfig__ = options;
|
22
22
|
var { optimizeDeps } = getOptimizeDeps("build"), optimizeIds = optimizeDeps.include, optimizeIdRegex = new RegExp(
|
23
23
|
// santize ids for regex
|
24
24
|
// https://stackoverflow.com/questions/6300183/sanitize-string-of-regex-characters-before-regexp-build
|
25
25
|
`${optimizeIds.map(function(id) {
|
26
26
|
return id.replace(/[#-.]|[[-^]|[?|{}]/g, "\\$&");
|
27
27
|
}).join("|")}`
|
28
|
-
), tsConfigPathsPlugin = null, vxrnOptions = getOptionsFilled(), devAndProdPlugins = [
|
28
|
+
), tsConfigPathsPlugin = null, vxrnOptions = getOptionsFilled(), _vxrnOptions_mode, { clientEnvDefine } = loadEnv((_vxrnOptions_mode = vxrnOptions?.mode) !== null && _vxrnOptions_mode !== void 0 ? _vxrnOptions_mode : "development"), devAndProdPlugins = [
|
29
|
+
{
|
30
|
+
name: "one-define-env",
|
31
|
+
config() {
|
32
|
+
return {
|
33
|
+
define: clientEnvDefine
|
34
|
+
};
|
35
|
+
}
|
36
|
+
},
|
29
37
|
// proxy because you cant add a plugin inside a plugin
|
30
38
|
new Proxy({
|
31
39
|
name: "one:tsconfig-paths",
|
@@ -82,24 +90,40 @@ function one() {
|
|
82
90
|
return {
|
83
91
|
define: {
|
84
92
|
...((_options_web = options.web) === null || _options_web === void 0 ? void 0 : _options_web.defaultRenderMode) && {
|
85
|
-
"process.env.
|
93
|
+
"process.env.ONE_DEFAULT_RENDER_MODE": JSON.stringify(options.web.defaultRenderMode),
|
94
|
+
"import.meta.env.ONE_DEFAULT_RENDER_MODE": JSON.stringify(options.web.defaultRenderMode)
|
86
95
|
},
|
87
96
|
...options.setupFile && {
|
88
|
-
"process.env.
|
97
|
+
"process.env.ONE_SETUP_FILE": JSON.stringify(options.setupFile)
|
89
98
|
},
|
90
99
|
...process.env.NODE_ENV !== "production" && vxrnOptions && {
|
91
|
-
"process.env.ONE_SERVER_URL": JSON.stringify(vxrnOptions.server.url)
|
100
|
+
"process.env.ONE_SERVER_URL": JSON.stringify(vxrnOptions.server.url),
|
101
|
+
"import.meta.env.ONE_SERVER_URL": JSON.stringify(vxrnOptions.server.url)
|
92
102
|
}
|
93
103
|
},
|
94
104
|
environments: {
|
95
105
|
client: {
|
96
106
|
define: {
|
97
|
-
"process.env.VITE_ENVIRONMENT": '"client"'
|
107
|
+
"process.env.VITE_ENVIRONMENT": '"client"',
|
108
|
+
"import.meta.env.VITE_ENVIRONMENT": '"client"'
|
98
109
|
}
|
99
110
|
},
|
100
111
|
ssr: {
|
101
112
|
define: {
|
102
|
-
"process.env.VITE_ENVIRONMENT": '"ssr"'
|
113
|
+
"process.env.VITE_ENVIRONMENT": '"ssr"',
|
114
|
+
"import.meta.env.VITE_ENVIRONMENT": '"ssr"'
|
115
|
+
}
|
116
|
+
},
|
117
|
+
ios: {
|
118
|
+
define: {
|
119
|
+
"process.env.VITE_ENVIRONMENT": '"ios"',
|
120
|
+
"import.meta.env.VITE_ENVIRONMENT": '"ios"'
|
121
|
+
}
|
122
|
+
},
|
123
|
+
android: {
|
124
|
+
define: {
|
125
|
+
"process.env.VITE_ENVIRONMENT": '"android"',
|
126
|
+
"import.meta.env.VITE_ENVIRONMENT": '"android"'
|
103
127
|
}
|
104
128
|
}
|
105
129
|
}
|
@@ -160,19 +184,22 @@ function one() {
|
|
160
184
|
root: "app"
|
161
185
|
}),
|
162
186
|
{
|
163
|
-
name: "define-
|
187
|
+
name: "one-define-environment",
|
164
188
|
config() {
|
165
189
|
var _options_app;
|
166
190
|
if (!((_options_app = options.app) === null || _options_app === void 0) && _options_app.key)
|
167
191
|
return {
|
168
192
|
define: {
|
169
|
-
"process.env.
|
193
|
+
"process.env.ONE_APP_NAME": JSON.stringify(options.app.key),
|
194
|
+
"import.meta.env.ONE_APP_NAME": JSON.stringify(options.app.key),
|
195
|
+
"process.env.ONE_CACHE_KEY": JSON.stringify(CACHE_KEY),
|
196
|
+
"import.meta.env.ONE_CACHE_KEY": JSON.stringify(CACHE_KEY)
|
170
197
|
}
|
171
198
|
};
|
172
199
|
}
|
173
200
|
},
|
174
201
|
{
|
175
|
-
name: "use-react-18-for-native",
|
202
|
+
name: "one-use-react-18-for-native",
|
176
203
|
enforce: "pre",
|
177
204
|
async config() {
|
178
205
|
var sharedNativeConfig = {
|
@@ -197,7 +224,7 @@ function one() {
|
|
197
224
|
},
|
198
225
|
// this started erroring for no reason..
|
199
226
|
{
|
200
|
-
name: "optimize-deps-load-web-extensions",
|
227
|
+
name: "one-optimize-deps-load-web-extensions",
|
201
228
|
enforce: "pre",
|
202
229
|
applyToEnvironment(environment) {
|
203
230
|
return isWebEnvironment(environment);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/vite/Users/n8/one/packages/one/src/vite/one.ts"],
|
4
|
-
"mappings": "AAAA,
|
5
|
-
"names": ["events", "path", "dirname", "resolve", "loadConfigFromFile", "tsconfigPaths", "getOptimizeDeps", "getOptionsFilled", "isWebEnvironment", "
|
4
|
+
"mappings": "AAAA,SAASA,mBAAmB;AAC5B,OAAOC,YAAY;AACnB,OAAOC,QAAQC,SAASC,eAAe;AACvC,SAA0DC,0BAA0B;AACpF,OAAOC,mBAAmB;AAC1B,SAASC,iBAAiBC,kBAAkBC,kBAAkBC,eAAe;AAC7E,SAASC,iBAAiB;AAC1B,OAAO;AACP,SAASC,mBAAmB;AAC5B,SAASC,6BAA6B;AACtC,SAASC,8BAA8B;AACvC,SAASC,sBAAsB;AAC/B,SAASC,6BAA6B;AACtC,SAASC,8BAA8B;AAEvC,SAASC,oBAAoBC,sBAAsB;AACnD,SAASC,wBAAwB;AAEjCnB,OAAOoB,gBAAgB,GAAA;AAGvBC,WAAWC,wBAAwB;AAE5B,SAASC,MAAAA;MAAIC,UAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAA6B,CAAC,GAI5CA;AAHJC,eAAaD,WAGTA,kBAAAA,QAAQE,YAAM,QAAdF,oBAAAA,SAAAA,SAAAA,gBAAgBV,oBAAmB,MAChCA,eAAAA,GAGPO,WAAW,uBAA0BG;AAGrC,MAAM,EAAEG,aAAY,IAAKrB,gBAAgB,OAAA,GACnCsB,cAAcD,aAAaE,SAC3BC,kBAAkB,IAAIC;;;IAG1B,GAAGH,YAAYI,IAAI,SAACC,IAAAA;aAAOA,GAAGC,QAAQ,uBAAuB,MAAA;OAASC,KAAK,GAAA,C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AAQiG,QAAAA,GAAWlE,EAAAA,GAC1CsE,UAAUD,aAAapE,QAAQ,WAAW,EAAA,IAAM;AACtD,cAAIqE,YAAYtE,GAAI;AACpB,cAAI;AACF,gBAAMuE,gBAAgBF,eAAe;AACrC,gBAAI,MAAM3F,YAAY6F,aAAAA;AACpB,qBAAOA;AAET,gBAAI,MAAM7F,YAAY4F,OAAAA;AACpB,qBAAOA;UAEX,SAASE,KAAK;AACZC,oBAAQC,KAAK,uBAAuBF,GAAAA;UACtC;QACF;MACF;IACF;IAEAtF,iBAAiB;MACfyF,SAAS;QAAC1F;;IACZ,CAAA;;AAEJ;AAEA,IAAIO,aAAuC;AAE3C,eAAeoF,kBAAkBC,SAA2B;AAC1D,MAAI,CAACrF,YAAY;AACf,QAAI,CAACqF,QAAS,OAAM,IAAIC,MAAM,yCAAyC;AACvE,UAAMC,mBAAmBF,OAAAA;EAC3B;AACA,MAAI,CAACrF;AACH,UAAM,IAAIsF,MAAM,4BAA4B;AAE9C,SAAOtF;AACT;AAEA,eAAsBuF,mBAAmBF,SAA0B;AACjE,MAAMG,QAAQ,MAAM7G,mBAAmB;IACrCmC,MAAM;IACNuE;EACF,CAAA;AACA,MAAI,CAACG;AACH,UAAM,IAAIF,MAAM,sBAAsB7C,QAAQgD,IAAG,CAAA,kCAAoC;AAEvF,MAAMC,eAAeN,kBAAAA;AACrB,MAAI,CAACM;AACH,UAAM,IAAIJ,MAAM,yCAAyC;AAE3D,SAAOI;AACT;",
|
5
|
+
"names": ["resolvePath", "events", "path", "dirname", "resolve", "loadConfigFromFile", "tsconfigPaths", "getOptimizeDeps", "getOptionsFilled", "isWebEnvironment", "loadEnv", "CACHE_KEY", "existsAsync", "clientTreeShakePlugin", "createFileSystemRouter", "ensureTSConfig", "fixDependenciesPlugin", "generateTypesForRoutes", "createVirtualEntry", "virtualEntryId", "vitePluginSsrCss", "setMaxListeners", "globalThis", "__vxrnEnableNativeEnv", "one", "options", "oneOptions", "config", "optimizeDeps", "optimizeIds", "include", "optimizeIdRegex", "RegExp", "map", "id", "replace", "join", "tsConfigPathsPlugin", "vxrnOptions", "clientEnvDefine", "mode", "devAndProdPlugins", "name", "define", "Proxy", "configIncoming", "pathsConfig", "tsConfigPaths", "plugins", "flat", "some", "p", "configResolved", "resolveId", "get", "target", "key", "thisArg", "Reflect", "enforce", "alias", "tslib", "web", "defaultRenderMode", "JSON", "stringify", "setupFile", "process", "env", "NODE_ENV", "server", "url", "environments", "client", "ssr", "ios", "android", "zero", "TESTING", "REPLICACHE_VERSION", "ZERO_VERSION", "hotUpdate", "modules", "m", "relativePath", "relative", "root", "rootDir", "split", "sep", "acceptedHmrExports", "Set", "__vxrnAddNativePlugins", "__vxrnAddWebPluginsProd", "deps", "app", "sharedNativeConfig", "react", "applyToEnvironment", "environment", "importer", "shouldOptimize", "test", "absolutePath", "webPath", "directoryPath", "err", "console", "warn", "entries", "getUserOneOptions", "command", "Error", "loadUserOneOptions", "found", "cwd", "foundOptions"]
|
6
6
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { isNativeEnvironment } from "vxrn";
|
2
|
-
const virtualEntryIdName = "one-entry", virtualEntryId = `virtual:${virtualEntryIdName}`, virtalEntryIdClient = `/@id/__x00__virtual:${virtualEntryIdName}`, resolvedVirtualEntryId = "\0" + virtualEntryId, virtualEntryIdNativeName = `${virtualEntryIdName}-native`, virtualEntryIdNative = `virtual:${virtualEntryIdNativeName}`, resolvedVirtualEntryIdNative = "\0" + virtualEntryIdNativeName,
|
3
|
-
if (process.env.
|
4
|
-
import(/* @vite-ignore */ process.env.
|
2
|
+
const virtualEntryIdName = "one-entry", virtualEntryId = `virtual:${virtualEntryIdName}`, virtalEntryIdClient = `/@id/__x00__virtual:${virtualEntryIdName}`, resolvedVirtualEntryId = "\0" + virtualEntryId, virtualEntryIdNativeName = `${virtualEntryIdName}-native`, virtualEntryIdNative = `virtual:${virtualEntryIdNativeName}`, resolvedVirtualEntryIdNative = "\0" + virtualEntryIdNativeName, USE_ONE_SETUP_FILE = `
|
3
|
+
if (process.env.ONE_SETUP_FILE) {
|
4
|
+
import(/* @vite-ignore */ process.env.ONE_SETUP_FILE)
|
5
5
|
}
|
6
6
|
`;
|
7
7
|
function createVirtualEntry(options) {
|
@@ -18,7 +18,7 @@ function createVirtualEntry(options) {
|
|
18
18
|
load(id) {
|
19
19
|
if (id === resolvedVirtualEntryId)
|
20
20
|
return `
|
21
|
-
${isNativeEnvironment(this.environment) ? "" :
|
21
|
+
${isNativeEnvironment(this.environment) ? "" : USE_ONE_SETUP_FILE}
|
22
22
|
|
23
23
|
import { createApp } from 'one'
|
24
24
|
|
@@ -29,7 +29,7 @@ export default createApp({
|
|
29
29
|
`;
|
30
30
|
if (id === resolvedVirtualEntryIdNative)
|
31
31
|
return `
|
32
|
-
${isNativeEnvironment(this.environment) ? "" :
|
32
|
+
${isNativeEnvironment(this.environment) ? "" : USE_ONE_SETUP_FILE}
|
33
33
|
|
34
34
|
import { createApp } from 'one'
|
35
35
|
|
@@ -6,9 +6,9 @@ const virtualEntryIdName = "one-entry",
|
|
6
6
|
virtualEntryIdNativeName = `${virtualEntryIdName}-native`,
|
7
7
|
virtualEntryIdNative = `virtual:${virtualEntryIdNativeName}`,
|
8
8
|
resolvedVirtualEntryIdNative = "\0" + virtualEntryIdNativeName,
|
9
|
-
|
10
|
-
if (process.env.
|
11
|
-
import(/* @vite-ignore */ process.env.
|
9
|
+
USE_ONE_SETUP_FILE = `
|
10
|
+
if (process.env.ONE_SETUP_FILE) {
|
11
|
+
import(/* @vite-ignore */ process.env.ONE_SETUP_FILE)
|
12
12
|
}
|
13
13
|
`;
|
14
14
|
function createVirtualEntry(options) {
|
@@ -22,7 +22,7 @@ function createVirtualEntry(options) {
|
|
22
22
|
},
|
23
23
|
load(id) {
|
24
24
|
if (id === resolvedVirtualEntryId) return `
|
25
|
-
${isNativeEnvironment(this.environment) ? "" :
|
25
|
+
${isNativeEnvironment(this.environment) ? "" : USE_ONE_SETUP_FILE}
|
26
26
|
|
27
27
|
import { createApp } from 'one'
|
28
28
|
|
@@ -32,7 +32,7 @@ export default createApp({
|
|
32
32
|
})
|
33
33
|
`;
|
34
34
|
if (id === resolvedVirtualEntryIdNative) return `
|
35
|
-
${isNativeEnvironment(this.environment) ? "" :
|
35
|
+
${isNativeEnvironment(this.environment) ? "" : USE_ONE_SETUP_FILE}
|
36
36
|
|
37
37
|
import { createApp } from 'one'
|
38
38
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isNativeEnvironment","virtualEntryIdName","virtualEntryId","virtalEntryIdClient","resolvedVirtualEntryId","virtualEntryIdNativeName","virtualEntryIdNative","resolvedVirtualEntryIdNative","
|
1
|
+
{"version":3,"names":["isNativeEnvironment","virtualEntryIdName","virtualEntryId","virtalEntryIdClient","resolvedVirtualEntryId","virtualEntryIdNativeName","virtualEntryIdNative","resolvedVirtualEntryIdNative","USE_ONE_SETUP_FILE","createVirtualEntry","options","appDirGlob","root","name","enforce","resolveId","id","load","environment"],"sources":["../../../src/vite/virtualEntryPlugin.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,mBAAA,QAA2B;AAE7B,MAAMC,kBAAA,GAAqB;EACrBC,cAAA,GAAiB,WAAWD,kBAAkB;EAC9CE,mBAAA,GAAsB,uBAAuBF,kBAAkB;EACtEG,sBAAA,GAAyB,OAAOF,cAAA;EAEhCG,wBAAA,GAA2B,GAAGJ,kBAAkB;EACzCK,oBAAA,GAAuB,WAAWD,wBAAwB;EACjEE,4BAAA,GAA+B,OAAOF,wBAAA;EAEtCG,kBAAA,GAAqB;AAAA;AAAA;AAAA;AAAA;AAMpB,SAASC,mBAAmBC,OAAA,EAAmC;EACpE,MAAMC,UAAA,GAAa,IAAID,OAAA,CAAQE,IAAI;EAEnC,OAAO;IACLC,IAAA,EAAM;IACNC,OAAA,EAAS;IAETC,UAAUC,EAAA,EAAI;MACZ,IAAIA,EAAA,KAAOd,cAAA,EACT,OAAOE,sBAAA;MAET,IAAIY,EAAA,KAAOV,oBAAA,EACT,OAAOC,4BAAA;IAEX;IAEAU,KAAKD,EAAA,EAAI;MACP,IAAIA,EAAA,KAAOZ,sBAAA,EAIT,OAAO;AAAA,EAHaJ,mBAAA,CAAoB,KAAKkB,WAAW,IACpD,KACAV,kBAEC;AAAA;AAAA;AAAA;AAAA,cAICG,UAAU;AAAA;AAAA,8BAEMA,UAAU;AAAA;AAAA;MAKlC,IAAIK,EAAA,KAAOT,4BAAA,EAIT,OAAO;AAAA,EAHaP,mBAAA,CAAoB,KAAKkB,WAAW,IACpD,KACAV,kBAEC;AAAA;AAAA;AAAA;AAAA,cAICG,UAAU;AAAA;AAAA,8BAEMA,UAAU;AAAA;AAAA;IAIpC;EACF;AACF","ignoreList":[]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { isNativeEnvironment } from "vxrn";
|
2
|
-
var virtualEntryIdName = "one-entry", virtualEntryId = `virtual:${virtualEntryIdName}`, virtalEntryIdClient = `/@id/__x00__virtual:${virtualEntryIdName}`, resolvedVirtualEntryId = "\0" + virtualEntryId, virtualEntryIdNativeName = `${virtualEntryIdName}-native`, virtualEntryIdNative = `virtual:${virtualEntryIdNativeName}`, resolvedVirtualEntryIdNative = "\0" + virtualEntryIdNativeName,
|
3
|
-
if (process.env.
|
4
|
-
import(/* @vite-ignore */ process.env.
|
2
|
+
var virtualEntryIdName = "one-entry", virtualEntryId = `virtual:${virtualEntryIdName}`, virtalEntryIdClient = `/@id/__x00__virtual:${virtualEntryIdName}`, resolvedVirtualEntryId = "\0" + virtualEntryId, virtualEntryIdNativeName = `${virtualEntryIdName}-native`, virtualEntryIdNative = `virtual:${virtualEntryIdNativeName}`, resolvedVirtualEntryIdNative = "\0" + virtualEntryIdNativeName, USE_ONE_SETUP_FILE = `
|
3
|
+
if (process.env.ONE_SETUP_FILE) {
|
4
|
+
import(/* @vite-ignore */ process.env.ONE_SETUP_FILE)
|
5
5
|
}
|
6
6
|
`;
|
7
7
|
function createVirtualEntry(options) {
|
@@ -19,7 +19,7 @@ function createVirtualEntry(options) {
|
|
19
19
|
if (id === resolvedVirtualEntryId) {
|
20
20
|
var prependCode = isNativeEnvironment(this.environment) ? "" : (
|
21
21
|
/* `import()` will not work on native */
|
22
|
-
|
22
|
+
USE_ONE_SETUP_FILE
|
23
23
|
);
|
24
24
|
return `
|
25
25
|
${prependCode}
|
@@ -35,7 +35,7 @@ export default createApp({
|
|
35
35
|
if (id === resolvedVirtualEntryIdNative) {
|
36
36
|
var prependCode1 = isNativeEnvironment(this.environment) ? "" : (
|
37
37
|
/* `import()` will not work on native */
|
38
|
-
|
38
|
+
USE_ONE_SETUP_FILE
|
39
39
|
);
|
40
40
|
return `
|
41
41
|
${prependCode1}
|
@@ -2,5 +2,5 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/vite/Users/n8/one/packages/one/src/vite/virtualEntryPlugin.ts"],
|
4
4
|
"mappings": "AACA,SAASA,2BAA2B;AAE7B,IAAMC,qBAAqB,aACrBC,iBAAiB,WAAWD,kBAAAA,IAC5BE,sBAAsB,uBAAuBF,kBAAAA,IACpDG,yBAAyB,OAAOF,gBAEhCG,2BAA2B,GAAGJ,kBAAAA,WACvBK,uBAAuB,WAAWD,wBAAAA,IACzCE,+BAA+B,OAAOF,0BAEtCG,qBAAqB;;;;;AAMpB,SAASC,mBAAmBC,SAAyB;AAC1D,MAAMC,aAAa,IAAID,QAAQE,IAAI;AAEnC,SAAO;IACLC,MAAM;IACNC,SAAS;IAETC,UAAUC,IAAE;AACV,UAAIA,OAAOd;AACT,eAAOE;AAET,UAAIY,OAAOV;AACT,eAAOC;IAEX;IAEAU,KAAKD,IAAE;AACL,UAAIA,OAAOZ,wBAAwB;AACjC,YAAMc,cAAclB,oBAAoB,KAAKmB,WAAW,IACpD;;UACAX;;AACJ,eAAO;EACbU,WAAAA;;;;cAIYP,UAAAA;;8BAEgBA,UAAAA;;;MAGxB;AAEA,UAAIK,OAAOT,8BAA8B;AACvC,YAAMW,eAAclB,oBAAoB,KAAKmB,WAAW,IACpD;;UACAX;;AACJ,eAAO;EACbU,YAAAA;;;;cAIYP,UAAAA;;8BAEgBA,UAAAA;;;MAGxB;IACF;EACF;AACF;",
|
5
|
-
"names": ["isNativeEnvironment", "virtualEntryIdName", "virtualEntryId", "virtalEntryIdClient", "resolvedVirtualEntryId", "virtualEntryIdNativeName", "virtualEntryIdNative", "resolvedVirtualEntryIdNative", "
|
5
|
+
"names": ["isNativeEnvironment", "virtualEntryIdName", "virtualEntryId", "virtalEntryIdClient", "resolvedVirtualEntryId", "virtualEntryIdNativeName", "virtualEntryIdNative", "resolvedVirtualEntryIdNative", "USE_ONE_SETUP_FILE", "createVirtualEntry", "options", "appDirGlob", "root", "name", "enforce", "resolveId", "id", "load", "prependCode", "environment"]
|
6
6
|
}
|
@@ -3,7 +3,7 @@ function vitePluginSsrCss(pluginOpts) {
|
|
3
3
|
let server;
|
4
4
|
const virtualHref = "/@id/__x00__" + VIRTUAL_ENTRY;
|
5
5
|
return {
|
6
|
-
name: "
|
6
|
+
name: "one-plugin-ssr-css",
|
7
7
|
apply: "serve",
|
8
8
|
configureServer(server_) {
|
9
9
|
server = server_, server.middlewares.use(async (req, res, next) => {
|
@@ -3,7 +3,7 @@ function vitePluginSsrCss(pluginOpts) {
|
|
3
3
|
let server;
|
4
4
|
const virtualHref = "/@id/__x00__" + VIRTUAL_ENTRY;
|
5
5
|
return {
|
6
|
-
name: "
|
6
|
+
name: "one-plugin-ssr-css",
|
7
7
|
apply: "serve",
|
8
8
|
configureServer(server_) {
|
9
9
|
server = server_, server.middlewares.use(async (req, res, next) => {
|