one 1.1.311 → 1.1.313
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 +36 -22
- package/dist/cjs/serve.cjs.map +2 -2
- package/dist/cjs/serve.native.js +18 -19
- 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 +8 -4
- package/dist/cjs/vite/build.cjs.map +1 -1
- package/dist/cjs/vite/build.native.js +5 -2
- package/dist/cjs/vite/build.native.js.map +2 -2
- 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 +12 -15
- package/dist/esm/serve.js.map +1 -1
- package/dist/esm/serve.mjs +30 -16
- package/dist/esm/serve.mjs.map +1 -1
- package/dist/esm/serve.native.js +13 -21
- 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 +4 -2
- package/dist/esm/vite/build.js.map +1 -1
- package/dist/esm/vite/build.mjs +6 -2
- package/dist/esm/vite/build.mjs.map +1 -1
- package/dist/esm/vite/build.native.js +6 -2
- 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 +31 -16
- package/src/useLoader.ts +1 -1
- package/src/vite/build.ts +4 -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/types.ts +5 -1
- 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/types/vite/types.d.ts +5 -1
- package/types/vite/types.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.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,EAAi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A,EAAM;IACNoE;EACF,CAAC,IAEC,MAAM,IAAIC,KAAA,CAAM,sBAAsB1C,OAAA,CAAQ4C,GAAA,CAAI,CAAC,kCAAkC;EAEvF,MAAMC,YAAA,GAAeL,iBAAA,CAAkB;EACvC,IAAI,CAACK,YAAA,EACH,MAAM,IAAIH,KAAA,CAAM,yCAAyC;EAE3D,OAAOG,YAAA;AACT","ignoreList":[]}
|
@@ -1,31 +1,39 @@
|
|
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() {
|
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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D,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) => {
|
@@ -2,7 +2,7 @@ var VIRTUAL_ENTRY = "virtual:ssr-css.css";
|
|
2
2
|
function vitePluginSsrCss(pluginOpts) {
|
3
3
|
var server, virtualHref = "/@id/__x00__" + VIRTUAL_ENTRY;
|
4
4
|
return {
|
5
|
-
name: "
|
5
|
+
name: "one-plugin-ssr-css",
|
6
6
|
apply: "serve",
|
7
7
|
configureServer(server_) {
|
8
8
|
server = server_, server.middlewares.use(async function(req, res, next) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "one",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.313",
|
4
4
|
"source": "src/index.ts",
|
5
5
|
"types": "./types/index.d.ts",
|
6
6
|
"sideEffects": false,
|
@@ -82,6 +82,7 @@
|
|
82
82
|
"@babel/parser": "^7.25.4",
|
83
83
|
"@babel/traverse": "^7.25.4",
|
84
84
|
"@radix-ui/react-slot": "^1.0.2",
|
85
|
+
"@react-native-masked-view/masked-view": "^0.3.1",
|
85
86
|
"@react-navigation/bottom-tabs": "~6.5.8",
|
86
87
|
"@react-navigation/core": "6.4.17",
|
87
88
|
"@react-navigation/drawer": "~6.6.3",
|
@@ -90,15 +91,14 @@
|
|
90
91
|
"@react-navigation/native-stack": "~6.9.13",
|
91
92
|
"@react-navigation/routers": "~6.1.9",
|
92
93
|
"@ungap/structured-clone": "^1.2.0",
|
93
|
-
"@vxrn/resolve": "1.1.
|
94
|
-
"@vxrn/tslib-lite": "1.1.
|
95
|
-
"@vxrn/universal-color-scheme": "1.1.
|
96
|
-
"@vxrn/use-isomorphic-layout-effect": "1.1.
|
94
|
+
"@vxrn/resolve": "1.1.313",
|
95
|
+
"@vxrn/tslib-lite": "1.1.313",
|
96
|
+
"@vxrn/universal-color-scheme": "1.1.313",
|
97
|
+
"@vxrn/use-isomorphic-layout-effect": "1.1.313",
|
97
98
|
"babel-dead-code-elimination": "^1.0.6",
|
98
99
|
"citty": "^0.1.6",
|
99
100
|
"core-js": "^3.38.1",
|
100
|
-
"create-vxrn": "1.1.
|
101
|
-
"dotenv": "^16.4.5",
|
101
|
+
"create-vxrn": "1.1.313",
|
102
102
|
"escape-string-regexp": "^5.0.0",
|
103
103
|
"expo-linking": "~6.3.1",
|
104
104
|
"expo-modules-core": "^1.12.24",
|
@@ -120,7 +120,7 @@
|
|
120
120
|
"url-parse": "^1.5.10",
|
121
121
|
"vite": "6.0.0-beta.1",
|
122
122
|
"vite-tsconfig-paths": "^5.0.1",
|
123
|
-
"vxrn": "1.1.
|
123
|
+
"vxrn": "1.1.313",
|
124
124
|
"ws": "^8.18.0",
|
125
125
|
"xxhashjs": "^0.2.2"
|
126
126
|
},
|
package/src/cleanUrl.ts
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
isNative,
|
3
|
+
LOADER_JS_POSTFIX,
|
4
|
+
LOADER_JS_POSTFIX_UNCACHED,
|
5
|
+
PRELOAD_JS_POSTFIX,
|
6
|
+
} from './constants'
|
2
7
|
import { getURL } from './getURL'
|
3
|
-
import { CACHE_KEY } from './router/constants'
|
4
8
|
import { removeSearch } from './utils/removeSearch'
|
5
9
|
|
6
10
|
function cleanUrl(path: string) {
|
@@ -13,11 +17,10 @@ function cleanUrl(path: string) {
|
|
13
17
|
}
|
14
18
|
|
15
19
|
const isClient = typeof window !== 'undefined'
|
16
|
-
const clientSideSearch = isClient ? `?cache=${CACHE_KEY}` : ''
|
17
20
|
const clientSideURL = isClient ? getURL() : ''
|
18
21
|
|
19
22
|
export function getPreloadPath(currentPath: string) {
|
20
|
-
return `${clientSideURL}/assets/${cleanUrl(currentPath.slice(1))}
|
23
|
+
return `${clientSideURL}/assets/${cleanUrl(currentPath.slice(1))}${PRELOAD_JS_POSTFIX}`
|
21
24
|
}
|
22
25
|
|
23
26
|
export function getLoaderPath(
|
@@ -33,20 +36,13 @@ export function getLoaderPath(
|
|
33
36
|
'http://example.com' /* not important, just for `new URL()` to work */
|
34
37
|
)
|
35
38
|
|
36
|
-
return `${baseURL}${devPath}/assets/${cleanUrl(currentPathUrl.pathname.slice(1))}
|
39
|
+
return `${baseURL}${devPath}/assets/${cleanUrl(currentPathUrl.pathname.slice(1))}${LOADER_JS_POSTFIX}`
|
37
40
|
}
|
38
41
|
|
39
42
|
export function getPathFromLoaderPath(loaderPath: string) {
|
40
43
|
return loaderPath
|
41
|
-
.replace(
|
44
|
+
.replace(LOADER_JS_POSTFIX_UNCACHED, '')
|
45
|
+
.replace(/_\d+/, '')
|
42
46
|
.replace(/^(\/_one)?\/assets/, '')
|
43
47
|
.replaceAll(/_/g, '/')
|
44
48
|
}
|
45
|
-
|
46
|
-
function getSearchParams(searchParams) {
|
47
|
-
if (!searchParams) {
|
48
|
-
return clientSideSearch
|
49
|
-
}
|
50
|
-
|
51
|
-
return `${searchParams}&${clientSideSearch.slice(1) /* remove the leading "?" */}`
|
52
|
-
}
|
package/src/cli.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { defineCommand, runMain } from 'citty'
|
2
2
|
import colors from 'picocolors'
|
3
|
-
import { loadEnv } from './vite/loadEnv'
|
4
3
|
import { readFileSync } from 'node:fs'
|
5
4
|
import path from 'node:path'
|
6
5
|
import { fileURLToPath } from 'node:url'
|
@@ -21,8 +20,6 @@ function getPackageVersion() {
|
|
21
20
|
|
22
21
|
const version = getPackageVersion()
|
23
22
|
|
24
|
-
void loadEnv(process.cwd())
|
25
|
-
|
26
23
|
if (path.sep !== '/') {
|
27
24
|
console.warn(
|
28
25
|
colors.bgYellow('WARNING: UNSUPPORTED OS') +
|
package/src/config.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { isWebServer } from './constants'
|
2
2
|
import type { One } from './vite/types'
|
3
3
|
|
4
|
-
const CLIENT_RENDER_MODE = process.env.
|
4
|
+
const CLIENT_RENDER_MODE = process.env.ONE_DEFAULT_RENDER_MODE as One.RouteRenderMode | undefined
|
5
5
|
|
6
6
|
// works client or server
|
7
7
|
export const getDefaultRenderMode = () => {
|
package/src/constants.ts
CHANGED
@@ -1,3 +1,9 @@
|
|
1
1
|
export const isWebClient = process.env.TAMAGUI_TARGET !== 'native' && typeof window !== 'undefined'
|
2
2
|
export const isWebServer = process.env.TAMAGUI_TARGET !== 'native' && typeof window === 'undefined'
|
3
3
|
export const isNative = process.env.TAMAGUI_TARGET === 'native'
|
4
|
+
|
5
|
+
export const CACHE_KEY = `${process.env.ONE_CACHE_KEY ?? Math.round(Math.random() * 100_000_000)}`
|
6
|
+
|
7
|
+
export const LOADER_JS_POSTFIX_UNCACHED = `_vxrn_loader.js`
|
8
|
+
export const LOADER_JS_POSTFIX = `_${CACHE_KEY}${LOADER_JS_POSTFIX_UNCACHED}`
|
9
|
+
export const PRELOAD_JS_POSTFIX = `_${CACHE_KEY}_preload.js`
|
package/src/createApp.native.tsx
CHANGED
@@ -15,7 +15,7 @@ export function createApp(options: CreateAppProps): void {
|
|
15
15
|
// TODO remove once we get a nice setup in tamagui repo for building native app and loading it
|
16
16
|
AppRegistry.registerComponent('tamaguikitchensink', () => App)
|
17
17
|
|
18
|
-
if (process.env.
|
19
|
-
AppRegistry.registerComponent(process.env.
|
18
|
+
if (process.env.ONE_APP_NAME) {
|
19
|
+
AppRegistry.registerComponent(process.env.ONE_APP_NAME, () => App)
|
20
20
|
}
|
21
21
|
}
|