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
@@ -1,4 +1,5 @@
|
|
1
1
|
import { getPathFromLoaderPath } from './cleanUrl'
|
2
|
+
import { LOADER_JS_POSTFIX, LOADER_JS_POSTFIX_UNCACHED } from './constants'
|
2
3
|
import type { RouteInfo } from './server/createRoutesManifest'
|
3
4
|
import { isResponse } from './utils/isResponse'
|
4
5
|
import { promiseWithResolvers } from './utils/promiseWithResolvers'
|
@@ -99,7 +100,7 @@ export function createHandleRequest(
|
|
99
100
|
}
|
100
101
|
|
101
102
|
if (handlers.handleLoader) {
|
102
|
-
const isClientRequestingNewRoute = pathname.endsWith(
|
103
|
+
const isClientRequestingNewRoute = pathname.endsWith(LOADER_JS_POSTFIX_UNCACHED)
|
103
104
|
|
104
105
|
if (isClientRequestingNewRoute) {
|
105
106
|
const originalUrl = getPathFromLoaderPath(pathname)
|
package/src/matchers.ts
CHANGED
@@ -22,7 +22,7 @@ export function matchGroupName(name: string): string | undefined {
|
|
22
22
|
|
23
23
|
/** Match the first array group name `(a,b,c)/(d,c)` -> `'a,b,c'` */
|
24
24
|
export function matchArrayGroupName(name: string) {
|
25
|
-
return name.match(/(?:[^\\(\\)])*?\(([
|
25
|
+
return name.match(/(?:[^\\(\\)])*?\(?([^\\/\(\)]+,[^\\/\(\)]+)\)?.*?$/)?.[1]
|
26
26
|
}
|
27
27
|
|
28
28
|
export function getNameFromFilePath(name: string): string {
|
package/src/serve.ts
CHANGED
@@ -2,25 +2,31 @@ import './polyfills-server'
|
|
2
2
|
|
3
3
|
import FSExtra from 'fs-extra'
|
4
4
|
import type { Hono } from 'hono'
|
5
|
-
import
|
5
|
+
import { join } from 'node:path'
|
6
6
|
import type { VXRNOptions } from 'vxrn'
|
7
|
-
import { getServerEntry, serve as vxrnServe } from 'vxrn'
|
8
|
-
import { createHandleRequest } from './createHandleRequest'
|
7
|
+
import { getServerEntry, loadEnv, serve as vxrnServe } from 'vxrn'
|
9
8
|
import type { RenderAppProps } from './types'
|
10
|
-
|
11
|
-
import { isStatusRedirect } from './utils/isStatus'
|
12
|
-
import { removeUndefined } from './utils/removeUndefined'
|
13
|
-
import { resolveAPIRequest } from './vite/resolveAPIRequest'
|
9
|
+
|
14
10
|
import type { One } from './vite/types'
|
15
|
-
import { loadUserOneOptions } from './vite/one'
|
16
|
-
import { labelProcess } from './cli/label-process'
|
17
11
|
|
18
12
|
process.on('uncaughtException', (err) => {
|
19
13
|
console.error(`[one] Uncaught exception`, err?.stack || err)
|
20
14
|
})
|
21
15
|
|
22
16
|
export async function serve(args: VXRNOptions['server'] = {}) {
|
17
|
+
const buildInfo = (await FSExtra.readJSON(`dist/buildInfo.json`)) as One.BuildInfo
|
18
|
+
|
19
|
+
// ensure cache key matches build
|
20
|
+
process.env.ONE_CACHE_KEY = buildInfo.constants.CACHE_KEY
|
21
|
+
|
22
|
+
// to avoid loading the CACHE_KEY before we set it use async imports:
|
23
|
+
const { labelProcess } = await import('./cli/label-process')
|
24
|
+
const { removeUndefined } = await import('./utils/removeUndefined')
|
25
|
+
const { loadUserOneOptions } = await import('./vite/one')
|
26
|
+
|
23
27
|
labelProcess('serve')
|
28
|
+
loadEnv('production')
|
29
|
+
|
24
30
|
const oneOptions = await loadUserOneOptions('serve')
|
25
31
|
|
26
32
|
// TODO make this better, this ensures we get react 19
|
@@ -41,16 +47,25 @@ export async function serve(args: VXRNOptions['server'] = {}) {
|
|
41
47
|
|
42
48
|
async beforeStart(options, app) {
|
43
49
|
await oneOptions.server?.beforeStart?.(options, app)
|
44
|
-
await oneServe(oneOptions, options, app)
|
50
|
+
await oneServe(oneOptions, options, buildInfo, app)
|
45
51
|
},
|
46
52
|
},
|
47
53
|
})
|
48
54
|
}
|
49
55
|
|
50
|
-
async function oneServe(
|
51
|
-
|
56
|
+
async function oneServe(
|
57
|
+
options: One.PluginOptions,
|
58
|
+
vxrnOptions: VXRNOptions,
|
59
|
+
buildInfo: One.BuildInfo,
|
60
|
+
app: Hono
|
61
|
+
) {
|
62
|
+
const { createHandleRequest } = await import('./createHandleRequest')
|
63
|
+
const { isResponse } = await import('./utils/isResponse')
|
64
|
+
const { isStatusRedirect } = await import('./utils/isStatus')
|
65
|
+
const { resolveAPIRequest } = await import('./vite/resolveAPIRequest')
|
66
|
+
|
52
67
|
const isAPIRequest = new WeakMap<any, boolean>()
|
53
|
-
const
|
68
|
+
const root = vxrnOptions.root || '.'
|
54
69
|
|
55
70
|
// add redirects
|
56
71
|
const redirects = options.web?.redirects
|
@@ -66,8 +81,6 @@ async function oneServe(options: One.Options, vxrnOptions: VXRNOptions, app: Hon
|
|
66
81
|
}
|
67
82
|
}
|
68
83
|
|
69
|
-
const buildInfo = await FSExtra.readJSON(toAbsolute(`dist/buildInfo.json`))
|
70
|
-
|
71
84
|
if (!buildInfo) {
|
72
85
|
throw new Error(`No build info found, have you run build?`)
|
73
86
|
}
|
@@ -130,7 +143,9 @@ async function oneServe(options: One.Options, vxrnOptions: VXRNOptions, app: Hon
|
|
130
143
|
if (route.type === 'ssr') {
|
131
144
|
const buildInfo = routeToBuildInfo[route.page]
|
132
145
|
if (!buildInfo) {
|
133
|
-
throw new Error(
|
146
|
+
throw new Error(
|
147
|
+
`No buildinfo found for ${url}, route: ${route.page}, in keys: ${Object.keys(routeToBuildInfo)}`
|
148
|
+
)
|
134
149
|
}
|
135
150
|
|
136
151
|
try {
|
package/src/useLoader.ts
CHANGED
@@ -91,7 +91,7 @@ export function useLoader<
|
|
91
91
|
try {
|
92
92
|
const response = await (async () => {
|
93
93
|
if (isNative) {
|
94
|
-
const nativeLoaderJSUrl = `${loaderJSUrl}
|
94
|
+
const nativeLoaderJSUrl = `${loaderJSUrl}?platform=ios` /* TODO: platform */
|
95
95
|
|
96
96
|
try {
|
97
97
|
// On native, we need to fetch the loader code and eval it
|
package/src/vite/build.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import * as constants from '../constants'
|
1
2
|
import FSExtra from 'fs-extra'
|
2
3
|
import MicroMatch from 'micromatch'
|
3
4
|
import { createRequire } from 'node:module'
|
@@ -13,13 +14,13 @@ import {
|
|
13
14
|
type ClientManifestEntry,
|
14
15
|
} from 'vxrn'
|
15
16
|
import { getLoaderPath, getPreloadPath } from '../cleanUrl'
|
17
|
+
import { labelProcess } from '../cli/label-process'
|
16
18
|
import type { RouteInfo } from '../server/createRoutesManifest'
|
17
19
|
import type { LoaderProps, RenderApp } from '../types'
|
18
20
|
import { getManifest } from './getManifest'
|
19
21
|
import { loadUserOneOptions } from './one'
|
20
22
|
import { replaceLoader } from './replaceLoader'
|
21
23
|
import type { One } from './types'
|
22
|
-
import { labelProcess } from '../cli/label-process'
|
23
24
|
|
24
25
|
const { ensureDir, readFile, outputFile } = FSExtra
|
25
26
|
|
@@ -32,6 +33,7 @@ export async function build(args: {
|
|
32
33
|
only?: string
|
33
34
|
}) {
|
34
35
|
labelProcess('build')
|
36
|
+
|
35
37
|
const userOptions = await loadUserOneOptions('build')
|
36
38
|
const serverOutputFormat = userOptions.build?.server?.outputFormat ?? 'esm'
|
37
39
|
|
@@ -508,6 +510,7 @@ ${JSON.stringify(params || null, null, 2)}`
|
|
508
510
|
const buildInfoForWriting = {
|
509
511
|
routeMap,
|
510
512
|
builtRoutes,
|
513
|
+
constants: JSON.parse(JSON.stringify({ ...constants })),
|
511
514
|
}
|
512
515
|
|
513
516
|
const buildInfo = {
|
package/src/vite/one.ts
CHANGED
@@ -1,17 +1,17 @@
|
|
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 { type Plugin, type PluginOption, type UserConfig, 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 type { One } from './types'
|
16
16
|
import { createVirtualEntry, virtualEntryId } from './virtualEntryPlugin'
|
17
17
|
import { vitePluginSsrCss } from './vitePluginSsrCss'
|
@@ -24,8 +24,6 @@ globalThis.__vxrnEnableNativeEnv = true
|
|
24
24
|
export function one(options: One.PluginOptions = {}): PluginOption {
|
25
25
|
oneOptions = options
|
26
26
|
|
27
|
-
void loadEnv(process.cwd())
|
28
|
-
|
29
27
|
// ensure tsconfig
|
30
28
|
if (options.config?.ensureTSConfig !== false) {
|
31
29
|
void ensureTSConfig()
|
@@ -46,7 +44,18 @@ export function one(options: One.PluginOptions = {}): PluginOption {
|
|
46
44
|
|
47
45
|
const vxrnOptions = getOptionsFilled()
|
48
46
|
|
47
|
+
const { clientEnvDefine } = loadEnv(vxrnOptions?.mode ?? 'development')
|
48
|
+
|
49
49
|
const devAndProdPlugins = [
|
50
|
+
{
|
51
|
+
name: 'one-define-env',
|
52
|
+
config() {
|
53
|
+
return {
|
54
|
+
define: clientEnvDefine,
|
55
|
+
}
|
56
|
+
},
|
57
|
+
},
|
58
|
+
|
50
59
|
// proxy because you cant add a plugin inside a plugin
|
51
60
|
new Proxy(
|
52
61
|
{
|
@@ -126,16 +135,20 @@ export function one(options: One.PluginOptions = {}): PluginOption {
|
|
126
135
|
return {
|
127
136
|
define: {
|
128
137
|
...(options.web?.defaultRenderMode && {
|
129
|
-
'process.env.
|
138
|
+
'process.env.ONE_DEFAULT_RENDER_MODE': JSON.stringify(options.web.defaultRenderMode),
|
139
|
+
'import.meta.env.ONE_DEFAULT_RENDER_MODE': JSON.stringify(
|
140
|
+
options.web.defaultRenderMode
|
141
|
+
),
|
130
142
|
}),
|
131
143
|
|
132
144
|
...(options.setupFile && {
|
133
|
-
'process.env.
|
145
|
+
'process.env.ONE_SETUP_FILE': JSON.stringify(options.setupFile),
|
134
146
|
}),
|
135
147
|
|
136
148
|
...(process.env.NODE_ENV !== 'production' &&
|
137
149
|
vxrnOptions && {
|
138
150
|
'process.env.ONE_SERVER_URL': JSON.stringify(vxrnOptions.server.url),
|
151
|
+
'import.meta.env.ONE_SERVER_URL': JSON.stringify(vxrnOptions.server.url),
|
139
152
|
}),
|
140
153
|
},
|
141
154
|
|
@@ -143,12 +156,28 @@ export function one(options: One.PluginOptions = {}): PluginOption {
|
|
143
156
|
client: {
|
144
157
|
define: {
|
145
158
|
'process.env.VITE_ENVIRONMENT': '"client"',
|
159
|
+
'import.meta.env.VITE_ENVIRONMENT': '"client"',
|
146
160
|
},
|
147
161
|
},
|
148
162
|
|
149
163
|
ssr: {
|
150
164
|
define: {
|
151
165
|
'process.env.VITE_ENVIRONMENT': '"ssr"',
|
166
|
+
'import.meta.env.VITE_ENVIRONMENT': '"ssr"',
|
167
|
+
},
|
168
|
+
},
|
169
|
+
|
170
|
+
ios: {
|
171
|
+
define: {
|
172
|
+
'process.env.VITE_ENVIRONMENT': '"ios"',
|
173
|
+
'import.meta.env.VITE_ENVIRONMENT': '"ios"',
|
174
|
+
},
|
175
|
+
},
|
176
|
+
|
177
|
+
android: {
|
178
|
+
define: {
|
179
|
+
'process.env.VITE_ENVIRONMENT': '"android"',
|
180
|
+
'import.meta.env.VITE_ENVIRONMENT': '"android"',
|
152
181
|
},
|
153
182
|
},
|
154
183
|
},
|
@@ -232,7 +261,7 @@ export function one(options: One.PluginOptions = {}): PluginOption {
|
|
232
261
|
}),
|
233
262
|
|
234
263
|
{
|
235
|
-
name: 'define-
|
264
|
+
name: 'one-define-environment',
|
236
265
|
config() {
|
237
266
|
if (!options.app?.key) {
|
238
267
|
return
|
@@ -240,14 +269,18 @@ export function one(options: One.PluginOptions = {}): PluginOption {
|
|
240
269
|
|
241
270
|
return {
|
242
271
|
define: {
|
243
|
-
'process.env.
|
272
|
+
'process.env.ONE_APP_NAME': JSON.stringify(options.app.key),
|
273
|
+
'import.meta.env.ONE_APP_NAME': JSON.stringify(options.app.key),
|
274
|
+
|
275
|
+
'process.env.ONE_CACHE_KEY': JSON.stringify(CACHE_KEY),
|
276
|
+
'import.meta.env.ONE_CACHE_KEY': JSON.stringify(CACHE_KEY),
|
244
277
|
},
|
245
278
|
}
|
246
279
|
},
|
247
280
|
} satisfies Plugin,
|
248
281
|
|
249
282
|
{
|
250
|
-
name: 'use-react-18-for-native',
|
283
|
+
name: 'one-use-react-18-for-native',
|
251
284
|
enforce: 'pre',
|
252
285
|
|
253
286
|
async config() {
|
@@ -275,7 +308,7 @@ export function one(options: One.PluginOptions = {}): PluginOption {
|
|
275
308
|
} satisfies Plugin,
|
276
309
|
|
277
310
|
{
|
278
|
-
name: 'optimize-deps-load-web-extensions',
|
311
|
+
name: 'one-optimize-deps-load-web-extensions',
|
279
312
|
enforce: 'pre',
|
280
313
|
|
281
314
|
applyToEnvironment(environment) {
|
package/src/vite/types.ts
CHANGED
@@ -139,7 +139,11 @@ export namespace One {
|
|
139
139
|
permanent: boolean
|
140
140
|
}
|
141
141
|
|
142
|
-
export type BuildInfo = Pick<AfterBuildProps, 'routeMap' | 'builtRoutes'>
|
142
|
+
export type BuildInfo = Pick<AfterBuildProps, 'routeMap' | 'builtRoutes'> & {
|
143
|
+
constants: {
|
144
|
+
CACHE_KEY: string
|
145
|
+
}
|
146
|
+
}
|
143
147
|
|
144
148
|
export type AfterBuildProps = VXRNAfterBuildProps & {
|
145
149
|
routeMap: Record<string, string>
|
@@ -10,9 +10,9 @@ const virtualEntryIdNativeName = `${virtualEntryIdName}-native`
|
|
10
10
|
export const virtualEntryIdNative = `virtual:${virtualEntryIdNativeName}`
|
11
11
|
const resolvedVirtualEntryIdNative = '\0' + virtualEntryIdNativeName
|
12
12
|
|
13
|
-
const
|
14
|
-
if (process.env.
|
15
|
-
import(/* @vite-ignore */ process.env.
|
13
|
+
const USE_ONE_SETUP_FILE = `
|
14
|
+
if (process.env.ONE_SETUP_FILE) {
|
15
|
+
import(/* @vite-ignore */ process.env.ONE_SETUP_FILE)
|
16
16
|
}
|
17
17
|
`
|
18
18
|
|
@@ -36,7 +36,7 @@ export function createVirtualEntry(options: { root: string }): Plugin {
|
|
36
36
|
if (id === resolvedVirtualEntryId) {
|
37
37
|
const prependCode = isNativeEnvironment(this.environment)
|
38
38
|
? '' /* `import()` will not work on native */
|
39
|
-
:
|
39
|
+
: USE_ONE_SETUP_FILE
|
40
40
|
return `
|
41
41
|
${prependCode}
|
42
42
|
|
@@ -52,7 +52,7 @@ export default createApp({
|
|
52
52
|
if (id === resolvedVirtualEntryIdNative) {
|
53
53
|
const prependCode = isNativeEnvironment(this.environment)
|
54
54
|
? '' /* `import()` will not work on native */
|
55
|
-
:
|
55
|
+
: USE_ONE_SETUP_FILE
|
56
56
|
return `
|
57
57
|
${prependCode}
|
58
58
|
|
@@ -12,7 +12,7 @@ export function vitePluginSsrCss(pluginOpts: { entries: string[] }): Plugin {
|
|
12
12
|
const virtualHref = '/@id/__x00__' + VIRTUAL_ENTRY
|
13
13
|
|
14
14
|
return {
|
15
|
-
name: `
|
15
|
+
name: `one-plugin-ssr-css`,
|
16
16
|
apply: 'serve',
|
17
17
|
configureServer(server_) {
|
18
18
|
server = server_
|
package/types/cleanUrl.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cleanUrl.d.ts","sourceRoot":"","sources":["../src/cleanUrl.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"cleanUrl.d.ts","sourceRoot":"","sources":["../src/cleanUrl.ts"],"names":[],"mappings":"AAqBA,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,UAEjD;AAED,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EAEnB,UAAU,UAAW,UAWtB;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,UAMvD"}
|
package/types/constants.d.ts
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
export declare const isWebClient: boolean;
|
2
2
|
export declare const isWebServer: boolean;
|
3
3
|
export declare const isNative: boolean;
|
4
|
+
export declare const CACHE_KEY: string;
|
5
|
+
export declare const LOADER_JS_POSTFIX_UNCACHED = "_vxrn_loader.js";
|
6
|
+
export declare const LOADER_JS_POSTFIX: string;
|
7
|
+
export declare const PRELOAD_JS_POSTFIX: string;
|
4
8
|
//# sourceMappingURL=constants.d.ts.map
|
package/types/constants.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,SAA2E,CAAA;AACnG,eAAO,MAAM,WAAW,SAA2E,CAAA;AACnG,eAAO,MAAM,QAAQ,SAA0C,CAAA"}
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,SAA2E,CAAA;AACnG,eAAO,MAAM,WAAW,SAA2E,CAAA;AACnG,eAAO,MAAM,QAAQ,SAA0C,CAAA;AAE/D,eAAO,MAAM,SAAS,QAA4E,CAAA;AAElG,eAAO,MAAM,0BAA0B,oBAAoB,CAAA;AAC3D,eAAO,MAAM,iBAAiB,QAA+C,CAAA;AAC7E,eAAO,MAAM,kBAAkB,QAA6B,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createHandleRequest.d.ts","sourceRoot":"","sources":["../src/createHandleRequest.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"createHandleRequest.d.ts","sourceRoot":"","sources":["../src/createHandleRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAI9D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAEvC,KAAK,mBAAmB,CAAC,eAAe,SAAS,MAAM,GAAG,EAAE,IAAI;IAC9D,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,eAAe,CAAA;IAC1C,GAAG,EAAE,GAAG,CAAA;IACR,WAAW,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,CAAA;CAC5D,CAAA;AAED,KAAK,sBAAsB,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEtD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,GAAG,CAAC,aAAa,EAC1B,QAAQ,EAAE;IACR,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACxD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IAC3D,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;CACzD;;uBA4BgD,OAAO,KAAG,OAAO,CAAC,sBAAsB,CAAC;EAsJ3F"}
|
package/types/serve.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAK3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAK3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAUvC,wBAAsB,KAAK,CAAC,IAAI,GAAE,WAAW,CAAC,QAAQ,CAAM;mDATE,YACvD;+CAIU,YAAY;gDAIX,YAAY;iDACoC,YAAY;+CAGxB,YAEjD;mDAC8B,YAAY;GA+B9C"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/vite/build.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/vite/build.ts"],"names":[],"mappings":"AA8BA,wBAAsB,KAAK,CAAC,IAAI,EAAE;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,iBAwgBA"}
|
package/types/vite/one.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"one.d.ts","sourceRoot":"","sources":["../../src/vite/one.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"one.d.ts","sourceRoot":"","sources":["../../src/vite/one.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,YAAY,EAAuC,MAAM,MAAM,CAAA;AAI1F,OAAO,qBAAqB,CAAA;AAO5B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AASlC,wBAAgB,GAAG,CAAC,OAAO,GAAE,GAAG,CAAC,aAAkB,GAAG,YAAY,CAgUjE;AAeD,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,8BAalE"}
|
package/types/vite/types.d.ts
CHANGED
@@ -112,7 +112,11 @@ export declare namespace One {
|
|
112
112
|
destination: string;
|
113
113
|
permanent: boolean;
|
114
114
|
};
|
115
|
-
type BuildInfo = Pick<AfterBuildProps, 'routeMap' | 'builtRoutes'
|
115
|
+
type BuildInfo = Pick<AfterBuildProps, 'routeMap' | 'builtRoutes'> & {
|
116
|
+
constants: {
|
117
|
+
CACHE_KEY: string;
|
118
|
+
};
|
119
|
+
};
|
116
120
|
type AfterBuildProps = VXRNAfterBuildProps & {
|
117
121
|
routeMap: Record<string, string>;
|
118
122
|
builtRoutes: RouteBuildInfo[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vite/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACjF,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,eAAe,IAAI,mBAAmB,EACtC,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EAClB,MAAM,MAAM,CAAA;AAEb,yBAAiB,GAAG,CAAC;IACnB,KAAY,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,aAAa,CAAC,GAAG,aAAa,CAAA;IAE5E,KAAY,eAAe,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAA;IAEnD,KAAY,SAAS,GAAG,eAAe,GAAG,KAAK,GAAG,QAAQ,CAAA;IAE1D,KAAY,YAAY,GAAG;QACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;KAC7C,CAAA;IAED,KAAY,eAAe,GAAG;QAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAA;KACpD,CAAA;IAED,KAAY,aAAa,GAAG;QAC1B;;;;;WAKG;QACH,IAAI,CAAC,EAAE,OAAO,CAAA;QAEd;;;;WAIG;QACH,SAAS,CAAC,EAAE,MAAM,CAAA;QAElB,MAAM,CAAC,EAAE;YACP,cAAc,CAAC,EAAE,KAAK,CAAA;YAEtB;;;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AAM,CAAA;QACpB,MAAM,EAAE,MAAM,CAAA;QACd,UAAU,EAAE,GAAG,CAAA;QACf,QAAQ,EAAE,MAAM,EAAE,CAAA;KACnB,CAAA;CACF"}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
-
var __export = (target, all) => {
|
6
|
-
for (var name in all) __defProp(target, name, {
|
7
|
-
get: all[name],
|
8
|
-
enumerable: !0
|
9
|
-
});
|
10
|
-
},
|
11
|
-
__copyProps = (to, from, except, desc) => {
|
12
|
-
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
13
|
-
get: () => from[key],
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
15
|
-
});
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
19
|
-
value: !0
|
20
|
-
}), mod);
|
21
|
-
var constants_exports = {};
|
22
|
-
__export(constants_exports, {
|
23
|
-
CACHE_KEY: () => CACHE_KEY
|
24
|
-
});
|
25
|
-
module.exports = __toCommonJS(constants_exports);
|
26
|
-
const CACHE_KEY = `${Math.random()}`.slice(3);
|
@@ -1,26 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
11
|
-
for (let key of __getOwnPropNames(from))
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
-
return to;
|
14
|
-
};
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
16
|
-
var constants_exports = {};
|
17
|
-
__export(constants_exports, {
|
18
|
-
CACHE_KEY: () => CACHE_KEY
|
19
|
-
});
|
20
|
-
module.exports = __toCommonJS(constants_exports);
|
21
|
-
var CACHE_KEY = `${Math.random()}`.slice(3);
|
22
|
-
// Annotate the CommonJS export names for ESM import in node:
|
23
|
-
0 && (module.exports = {
|
24
|
-
CACHE_KEY
|
25
|
-
});
|
26
|
-
//# sourceMappingURL=constants.js.map
|
@@ -1,47 +0,0 @@
|
|
1
|
-
var __create = Object.create;
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __getProtoOf = Object.getPrototypeOf,
|
6
|
-
__hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
-
var __export = (target, all) => {
|
8
|
-
for (var name in all) __defProp(target, name, {
|
9
|
-
get: all[name],
|
10
|
-
enumerable: !0
|
11
|
-
});
|
12
|
-
},
|
13
|
-
__copyProps = (to, from, except, desc) => {
|
14
|
-
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
15
|
-
get: () => from[key],
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
17
|
-
});
|
18
|
-
return to;
|
19
|
-
};
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
26
|
-
value: mod,
|
27
|
-
enumerable: !0
|
28
|
-
}) : target, mod)),
|
29
|
-
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
30
|
-
value: !0
|
31
|
-
}), mod);
|
32
|
-
var loadEnv_exports = {};
|
33
|
-
__export(loadEnv_exports, {
|
34
|
-
loadEnv: () => loadEnv
|
35
|
-
});
|
36
|
-
module.exports = __toCommonJS(loadEnv_exports);
|
37
|
-
var import_node_fs = __toESM(require("node:fs"), 1),
|
38
|
-
import_node_path = __toESM(require("node:path"), 1);
|
39
|
-
async function loadEnv(root) {
|
40
|
-
const envPath = import_node_path.default.join(root, ".env");
|
41
|
-
if (!import_node_fs.default.existsSync(envPath)) return;
|
42
|
-
const result = (await import("dotenv")).config({
|
43
|
-
path: envPath
|
44
|
-
});
|
45
|
-
if (result.error) throw result.error;
|
46
|
-
return !0;
|
47
|
-
}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"sources": ["../../../src/vite/loadEnv.ts"],
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAe,gCACf,mBAAiB;AAEjB,eAAsB,QAAQ,MAAc;AAC1C,QAAM,UAAU,iBAAAA,QAAK,KAAK,MAAM,MAAM;AACtC,MAAI,CAAC,eAAAC,QAAG,WAAW,OAAO,EAAG;AAE7B,QAAM,UADS,MAAM,OAAO,QAAQ,GACd,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC9C,MAAI,OAAO,MAAO,OAAM,OAAO;AAC/B,SAAO;AACT;",
|
5
|
-
"names": ["path", "fs"]
|
6
|
-
}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __create = Object.create;
|
3
|
-
var __defProp = Object.defineProperty;
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
-
var __export = (target, all) => {
|
8
|
-
for (var name in all)
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
10
|
-
}, __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from == "object" || typeof from == "function")
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
-
return to;
|
15
|
-
};
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
22
|
-
mod
|
23
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
24
|
-
var loadEnv_exports = {};
|
25
|
-
__export(loadEnv_exports, {
|
26
|
-
loadEnv: () => loadEnv
|
27
|
-
});
|
28
|
-
module.exports = __toCommonJS(loadEnv_exports);
|
29
|
-
var import_node_fs = __toESM(require("node:fs"), 1), import_node_path = __toESM(require("node:path"), 1);
|
30
|
-
async function loadEnv(root) {
|
31
|
-
var envPath = import_node_path.default.join(root, ".env");
|
32
|
-
if (import_node_fs.default.existsSync(envPath)) {
|
33
|
-
var dotenv = await import("dotenv"), result = dotenv.config({
|
34
|
-
path: envPath
|
35
|
-
});
|
36
|
-
if (result.error) throw result.error;
|
37
|
-
return !0;
|
38
|
-
}
|
39
|
-
}
|
40
|
-
// Annotate the CommonJS export names for ESM import in node:
|
41
|
-
0 && (module.exports = {
|
42
|
-
loadEnv
|
43
|
-
});
|
44
|
-
//# sourceMappingURL=loadEnv.js.map
|
@@ -1,6 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"sources": ["../../../src/vite/Users/n8/one/packages/one/src/vite/loadEnv.ts"],
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;qBAAe,gCACf,mBAAiB;AAEjB,eAAsBA,QAAQC,MAAY;AACxC,MAAMC,UAAUC,iBAAAA,QAAKC,KAAKH,MAAM,MAAA;AAChC,MAAKI,eAAAA,QAAGC,WAAWJ,OAAAA,GACnB;QAAMK,SAAS,MAAM,OAAO,QAAA,GACtBC,SAASD,OAAOE,OAAO;MAAEN,MAAMD;IAAQ,CAAA;AAC7C,QAAIM,OAAOE,MAAO,OAAMF,OAAOE;AAC/B,WAAO;;AACT;",
|
5
|
-
"names": ["loadEnv", "root", "envPath", "path", "join", "fs", "existsSync", "dotenv", "result", "config", "error"]
|
6
|
-
}
|