vxrn 1.1.164 → 1.1.166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugins/reactNativeCommonJsPlugin.js +34 -14
- package/dist/plugins/reactNativeCommonJsPlugin.js.map +1 -1
- package/dist/plugins/reactNativeCommonJsPlugin.mjs +34 -14
- package/dist/plugins/reactNativeCommonJsPlugin.mjs.map +1 -1
- package/dist/plugins/reactNativeCommonJsPlugin.native.js +59 -82
- package/dist/plugins/reactNativeCommonJsPlugin.native.js.map +2 -2
- package/dist/plugins/reactNativeHMRPlugin.js +8 -1
- package/dist/plugins/reactNativeHMRPlugin.js.map +1 -1
- package/dist/plugins/reactNativeHMRPlugin.mjs +8 -1
- package/dist/plugins/reactNativeHMRPlugin.mjs.map +1 -1
- package/dist/plugins/reactNativeHMRPlugin.native.js +14 -2
- package/dist/plugins/reactNativeHMRPlugin.native.js.map +2 -2
- package/dist/utils/getReactNativeBundle.js +4 -2
- package/dist/utils/getReactNativeBundle.js.map +1 -1
- package/dist/utils/getReactNativeBundle.mjs +4 -2
- package/dist/utils/getReactNativeBundle.mjs.map +1 -1
- package/dist/utils/getReactNativeBundle.native.js +4 -2
- package/dist/utils/getReactNativeBundle.native.js.map +2 -2
- package/dist/utils/getVitePath.js +5 -7
- package/dist/utils/getVitePath.js.map +1 -1
- package/dist/utils/getVitePath.mjs +5 -7
- package/dist/utils/getVitePath.mjs.map +1 -1
- package/dist/utils/getVitePath.native.js +30 -38
- package/dist/utils/getVitePath.native.js.map +2 -2
- package/package.json +7 -7
- package/react-native-template.js +18 -0
- package/src/plugins/reactNativeCommonJsPlugin.ts +41 -13
- package/src/plugins/reactNativeHMRPlugin.ts +10 -1
- package/src/utils/getReactNativeBundle.ts +4 -4
- package/src/utils/getVitePath.ts +12 -7
- package/types/plugins/reactNativeCommonJsPlugin.d.ts +1 -0
- package/types/plugins/reactNativeCommonJsPlugin.d.ts.map +1 -1
- package/types/plugins/reactNativeHMRPlugin.d.ts +45 -0
- package/types/plugins/reactNativeHMRPlugin.d.ts.map +1 -1
- package/types/utils/getVitePath.d.ts +1 -1
- package/types/utils/getVitePath.d.ts.map +1 -1
package/src/utils/getVitePath.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { join, relative
|
|
2
|
-
import { createRequire } from 'node:module'
|
|
1
|
+
import { dirname, join, relative } from 'node:path'
|
|
3
2
|
|
|
4
3
|
import FSExtra from 'fs-extra'
|
|
5
4
|
|
|
@@ -7,6 +6,7 @@ export async function getVitePath(
|
|
|
7
6
|
rootPath: string,
|
|
8
7
|
importer: string,
|
|
9
8
|
moduleName: string,
|
|
9
|
+
resolver: (moduleName: string, importer: string) => Promise<string>,
|
|
10
10
|
absolute = false
|
|
11
11
|
) {
|
|
12
12
|
// our virtual modules
|
|
@@ -34,21 +34,26 @@ export async function getVitePath(
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const sourceFile = join(process.cwd(), 'index.js')
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
const resolved = await resolver(moduleName, sourceFile)
|
|
38
|
+
|
|
39
39
|
// figure out symlinks
|
|
40
40
|
if (!resolved) {
|
|
41
41
|
throw new Error(
|
|
42
42
|
` ❌ Path not found ${sourceFile} (rootPath ${rootPath}, importer ${importer}, moduleName ${moduleName})`
|
|
43
43
|
)
|
|
44
44
|
}
|
|
45
|
+
|
|
45
46
|
const real = await FSExtra.realpath(resolved)
|
|
47
|
+
|
|
46
48
|
let id = real
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
// if (!absolute) {
|
|
51
|
+
// id = relative(importer, real)
|
|
52
|
+
// }
|
|
53
|
+
|
|
50
54
|
if (id.endsWith(`/react/jsx-dev-runtime.js`)) {
|
|
51
55
|
id = 'react/jsx-runtime'
|
|
52
56
|
}
|
|
57
|
+
|
|
53
58
|
return id
|
|
54
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactNativeCommonJsPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/reactNativeCommonJsPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,MAAM,EAAmB,MAAM,MAAM,CAAA;AAqBhE,wBAAgB,yBAAyB,CAAC,OAAO,EAAE;IACjD,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,GAAG,OAAO,CAAA;CACxB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"reactNativeCommonJsPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/reactNativeCommonJsPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,MAAM,EAAmB,MAAM,MAAM,CAAA;AAqBhE,eAAO,MAAM,UAAU,UAA0C,CAAA;AAEjE,wBAAgB,yBAAyB,CAAC,OAAO,EAAE;IACjD,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,GAAG,OAAO,CAAA;CACxB,GAAG,MAAM,CA0LT"}
|
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
import type { VXRNOptionsFilled } from '../utils/getOptionsFilled';
|
|
2
|
+
import type { Plugin } from 'vite';
|
|
2
3
|
export declare function reactNativeHMRPlugin({ root }: VXRNOptionsFilled): {
|
|
3
4
|
name: string;
|
|
5
|
+
configResolved(this: void, config: Readonly<Omit<import("vite").UserConfig, "dev" | "build" | "worker" | "plugins" | "css" | "assetsInclude" | "optimizeDeps" | "environments"> & {
|
|
6
|
+
configFile: string | undefined;
|
|
7
|
+
configFileDependencies: string[];
|
|
8
|
+
inlineConfig: import("vite").InlineConfig;
|
|
9
|
+
root: string;
|
|
10
|
+
base: string;
|
|
11
|
+
publicDir: string;
|
|
12
|
+
cacheDir: string;
|
|
13
|
+
command: "build" | "serve";
|
|
14
|
+
mode: string;
|
|
15
|
+
isWorker: boolean;
|
|
16
|
+
isProduction: boolean;
|
|
17
|
+
envDir: string;
|
|
18
|
+
env: Record<string, any>;
|
|
19
|
+
resolve: Required<import("vite").ResolveOptions> & {
|
|
20
|
+
alias: import("vite").Alias[];
|
|
21
|
+
};
|
|
22
|
+
plugins: readonly Plugin<any>[];
|
|
23
|
+
css: import("vite").ResolvedCSSOptions;
|
|
24
|
+
esbuild: false | import("vite").ESBuildOptions;
|
|
25
|
+
server: import("vite").ResolvedServerOptions;
|
|
26
|
+
dev: import("vite").ResolvedDevEnvironmentOptions;
|
|
27
|
+
builder: Required<import("vite").BuilderOptions>;
|
|
28
|
+
build: import("vite").ResolvedBuildOptions;
|
|
29
|
+
preview: import("vite").ResolvedPreviewOptions;
|
|
30
|
+
ssr: import("vite").ResolvedSSROptions;
|
|
31
|
+
assetsInclude: (file: string) => boolean;
|
|
32
|
+
logger: import("vite").Logger;
|
|
33
|
+
createResolver: (options?: Partial<import("vite").InternalResolveOptions> | undefined) => import("vite").ResolveFn;
|
|
34
|
+
optimizeDeps: import("vite").DepOptimizationOptions;
|
|
35
|
+
worker: import("vite").ResolvedWorkerOptions;
|
|
36
|
+
appType: import("vite").AppType;
|
|
37
|
+
experimental: import("vite").ExperimentalOptions;
|
|
38
|
+
environments: Record<string, {
|
|
39
|
+
resolve: Required<import("vite").ResolveOptions & {
|
|
40
|
+
alias?: import("vite").AliasOptions | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
nodeCompatible: boolean;
|
|
43
|
+
webCompatible: boolean;
|
|
44
|
+
injectInvalidationTimestamp: boolean;
|
|
45
|
+
dev: import("vite").ResolvedDevEnvironmentOptions;
|
|
46
|
+
build: import("vite").ResolvedBuildEnvironmentOptions;
|
|
47
|
+
}>;
|
|
48
|
+
} & import("vite").PluginHookUtils>): Promise<void>;
|
|
4
49
|
handleHotUpdate(this: void, { read, modules, file }: import("vite").HmrContext): Promise<void>;
|
|
5
50
|
};
|
|
6
51
|
//# sourceMappingURL=reactNativeHMRPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactNativeHMRPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/reactNativeHMRPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"reactNativeHMRPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/reactNativeHMRPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAKlE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAGlC,wBAAgB,oBAAoB,CAAC,EAAE,IAAI,EAAE,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuG/D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function getVitePath(rootPath: string, importer: string, moduleName: string, absolute?: boolean): Promise<string>;
|
|
1
|
+
export declare function getVitePath(rootPath: string, importer: string, moduleName: string, resolver: (moduleName: string, importer: string) => Promise<string>, absolute?: boolean): Promise<string>;
|
|
2
2
|
//# sourceMappingURL=getVitePath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVitePath.d.ts","sourceRoot":"","sources":["../../src/utils/getVitePath.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getVitePath.d.ts","sourceRoot":"","sources":["../../src/utils/getVitePath.ts"],"names":[],"mappings":"AAIA,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,EACnE,QAAQ,UAAQ,mBAiDjB"}
|