vxrn 2.0.0-beta.99.1 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backgroundComputation.mjs +145 -0
- package/dist/backgroundComputation.mjs.map +1 -0
- package/dist/backgroundComputation.native.js +163 -0
- package/dist/backgroundComputation.native.js.map +1 -0
- package/dist/backgroundComputationNative.mjs +16 -0
- package/dist/backgroundComputationNative.mjs.map +1 -0
- package/dist/backgroundComputationNative.native.js +18 -0
- package/dist/backgroundComputationNative.native.js.map +1 -0
- package/dist/config/getBaseViteConfigOnly.mjs +6 -10
- package/dist/config/getBaseViteConfigOnly.mjs.map +1 -1
- package/dist/config/getBaseViteConfigOnly.native.js +6 -10
- package/dist/config/getBaseViteConfigOnly.native.js.map +1 -1
- package/dist/config/getOptimizeDeps.mjs +2 -1
- package/dist/config/getOptimizeDeps.mjs.map +1 -1
- package/dist/config/getOptimizeDeps.native.js +2 -1
- package/dist/config/getOptimizeDeps.native.js.map +1 -1
- package/dist/config/getViteServerConfig.mjs +13 -0
- package/dist/config/getViteServerConfig.mjs.map +1 -1
- package/dist/config/getViteServerConfig.native.js +15 -1
- package/dist/config/getViteServerConfig.native.js.map +1 -1
- package/dist/constants/defaults.mjs +4 -0
- package/dist/constants/defaults.mjs.map +1 -1
- package/dist/constants/defaults.native.js +4 -0
- package/dist/constants/defaults.native.js.map +1 -1
- package/dist/exports/build.native.js +1 -1
- package/dist/exports/build.native.js.map +1 -1
- package/dist/exports/clean.native.js +1 -1
- package/dist/exports/clean.native.js.map +1 -1
- package/dist/exports/createServer.native.js +2 -2
- package/dist/exports/createServer.native.js.map +1 -1
- package/dist/exports/dev.mjs +3 -0
- package/dist/exports/dev.mjs.map +1 -1
- package/dist/exports/dev.native.js +6 -3
- package/dist/exports/dev.native.js.map +1 -1
- package/dist/exports/loadEnv.native.js +1 -1
- package/dist/exports/loadEnv.native.js.map +1 -1
- package/dist/exports/patch.native.js +1 -1
- package/dist/exports/patch.native.js.map +1 -1
- package/dist/exports/prebuild.mjs +0 -22
- package/dist/exports/prebuild.mjs.map +1 -1
- package/dist/exports/prebuild.native.js +1 -23
- package/dist/exports/prebuild.native.js.map +1 -1
- package/dist/exports/prebuildWithoutExpo.mjs +1116 -178
- package/dist/exports/prebuildWithoutExpo.mjs.map +1 -1
- package/dist/exports/prebuildWithoutExpo.native.js +1592 -243
- package/dist/exports/prebuildWithoutExpo.native.js.map +1 -1
- package/dist/exports/runAndroid.native.js +1 -1
- package/dist/exports/runAndroid.native.js.map +1 -1
- package/dist/exports/runIos.native.js +1 -1
- package/dist/exports/runIos.native.js.map +1 -1
- package/dist/exports/serve.native.js +1 -1
- package/dist/exports/serve.native.js.map +1 -1
- package/dist/exports/serveStaticAssets.native.js +1 -1
- package/dist/exports/serveStaticAssets.native.js.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.mjs +4 -1
- package/dist/index.native.js +4 -1
- package/dist/native-source-contract.mjs +3 -0
- package/dist/native-source-contract.native.js +3 -0
- package/dist/patches/builtInDepPatches.mjs +0 -13
- package/dist/patches/builtInDepPatches.mjs.map +1 -1
- package/dist/patches/builtInDepPatches.native.js +0 -13
- package/dist/patches/builtInDepPatches.native.js.map +1 -1
- package/dist/plugins/autoDepOptimizePlugin.mjs +3 -2
- package/dist/plugins/autoDepOptimizePlugin.mjs.map +1 -1
- package/dist/plugins/autoDepOptimizePlugin.native.js +6 -3
- package/dist/plugins/autoDepOptimizePlugin.native.js.map +1 -1
- package/dist/plugins/backgroundComputationPlugin.mjs +27 -0
- package/dist/plugins/backgroundComputationPlugin.mjs.map +1 -0
- package/dist/plugins/backgroundComputationPlugin.native.js +32 -0
- package/dist/plugins/backgroundComputationPlugin.native.js.map +1 -0
- package/dist/plugins/reactNativeCommonJsPlugin.native.js +3 -3
- package/dist/plugins/reactNativeCommonJsPlugin.native.js.map +1 -1
- package/dist/plugins/reactNativeDevAssetPlugin.mjs +2 -1
- package/dist/plugins/reactNativeDevAssetPlugin.mjs.map +1 -1
- package/dist/plugins/reactNativeDevAssetPlugin.native.js +3 -2
- package/dist/plugins/reactNativeDevAssetPlugin.native.js.map +1 -1
- package/dist/plugins/reactNativeDevServer.mjs +87 -24
- package/dist/plugins/reactNativeDevServer.mjs.map +1 -1
- package/dist/plugins/reactNativeDevServer.native.js +162 -45
- package/dist/plugins/reactNativeDevServer.native.js.map +1 -1
- package/dist/plugins/workletImportsPlugin.mjs +9 -30
- package/dist/plugins/workletImportsPlugin.mjs.map +1 -1
- package/dist/plugins/workletImportsPlugin.native.js +10 -35
- package/dist/plugins/workletImportsPlugin.native.js.map +1 -1
- package/dist/rn-commands/bundle/buildBundle.mjs +3 -3
- package/dist/rn-commands/bundle/buildBundle.mjs.map +1 -1
- package/dist/rn-commands/bundle/buildBundle.native.js +3 -3
- package/dist/rn-commands/bundle/buildBundle.native.js.map +1 -1
- package/dist/runtime/hmr-client.native.js +3 -7
- package/dist/runtime/hmr-client.native.js.map +1 -1
- package/dist/runtime/hmr-runtime.native.js +32 -40
- package/dist/runtime/hmr-runtime.native.js.map +1 -1
- package/dist/serve/node.native.js +2 -2
- package/dist/serve/node.native.js.map +1 -1
- package/dist/swift-package-id.mjs +3 -0
- package/dist/swift-package-id.native.js +3 -0
- package/dist/user-interface/index.native.js +6 -6
- package/dist/user-interface/index.native.js.map +1 -1
- package/dist/utils/compileNativeDevBytecode.mjs +93 -0
- package/dist/utils/compileNativeDevBytecode.mjs.map +1 -0
- package/dist/utils/compileNativeDevBytecode.native.js +98 -0
- package/dist/utils/compileNativeDevBytecode.native.js.map +1 -0
- package/dist/utils/createNativeDevEngine.mjs +227 -20
- package/dist/utils/createNativeDevEngine.mjs.map +1 -1
- package/dist/utils/createNativeDevEngine.native.js +249 -37
- package/dist/utils/createNativeDevEngine.native.js.map +1 -1
- package/dist/utils/execSync.native.js +1 -1
- package/dist/utils/execSync.native.js.map +1 -1
- package/dist/utils/getServerEntry.native.js +2 -2
- package/dist/utils/getServerEntry.native.js.map +1 -1
- package/dist/utils/nativeRun.mjs +32 -16
- package/dist/utils/nativeRun.mjs.map +1 -1
- package/dist/utils/nativeRun.native.js +43 -18
- package/dist/utils/nativeRun.native.js.map +1 -1
- package/dist/utils/nativeSourceContract.mjs +1823 -0
- package/dist/utils/nativeSourceContract.mjs.map +1 -0
- package/dist/utils/nativeSourceContract.native.js +2425 -0
- package/dist/utils/nativeSourceContract.native.js.map +1 -0
- package/dist/utils/patches.native.js +15 -24
- package/dist/utils/patches.native.js.map +1 -1
- package/dist/utils/printServerUrls.native.js +1 -1
- package/dist/utils/printServerUrls.native.js.map +1 -1
- package/dist/utils/scanDepsToOptimize.mjs +7 -1
- package/dist/utils/scanDepsToOptimize.mjs.map +1 -1
- package/dist/utils/scanDepsToOptimize.native.js +27 -2
- package/dist/utils/scanDepsToOptimize.native.js.map +1 -1
- package/dist/utils/swiftPackageId.mjs +31 -2
- package/dist/utils/swiftPackageId.mjs.map +1 -1
- package/dist/utils/swiftPackageId.native.js +50 -2
- package/dist/utils/swiftPackageId.native.js.map +1 -1
- package/dist/vxrn-vite-plugin.native.js +1 -1
- package/dist/vxrn-vite-plugin.native.js.map +1 -1
- package/expo-plugin.cjs +792 -2
- package/native-project-patches.cjs +201 -10
- package/package.json +34 -15
- package/src/backgroundComputation.ts +220 -0
- package/src/backgroundComputationNative.ts +23 -0
- package/src/config/getBaseViteConfigOnly.ts +8 -9
- package/src/config/getOptimizeDeps.ts +3 -1
- package/src/config/getViteServerConfig.ts +16 -0
- package/src/config/glbAssets.test.ts +228 -0
- package/src/constants/defaults.ts +6 -0
- package/src/exports/dev.ts +5 -1
- package/src/exports/expoPlugin.test.mjs +337 -15
- package/src/exports/prebuild.ts +0 -31
- package/src/exports/prebuildWithoutExpo.test.ts +1588 -48
- package/src/exports/prebuildWithoutExpo.ts +1573 -213
- package/src/index.ts +8 -0
- package/src/native-source-contract.ts +16 -0
- package/src/patches/builtInDepPatches.ts +0 -21
- package/src/plugins/autoDepOptimizePlugin.ts +7 -2
- package/src/plugins/backgroundComputationPlugin.test.ts +77 -0
- package/src/plugins/backgroundComputationPlugin.ts +29 -0
- package/src/plugins/reactNativeDevAssetPlugin.ts +5 -1
- package/src/plugins/reactNativeDevServer.test.ts +74 -0
- package/src/plugins/reactNativeDevServer.ts +145 -28
- package/src/plugins/rnCodegenPlugin.test.ts +30 -0
- package/src/plugins/workletImportsPlugin.ts +19 -37
- package/src/rn-commands/bundle/buildBundle.ts +5 -3
- package/src/swift-package-id.ts +1 -0
- package/src/utils/compileNativeDevBytecode.test.ts +168 -0
- package/src/utils/compileNativeDevBytecode.ts +117 -0
- package/src/utils/createNativeDevEngine.test.ts +643 -18
- package/src/utils/createNativeDevEngine.ts +278 -48
- package/src/utils/nativeRun.test.ts +125 -23
- package/src/utils/nativeRun.ts +51 -23
- package/src/utils/nativeSourceArtifacts.test.ts +39 -0
- package/src/utils/nativeSourceContract.test.ts +600 -0
- package/src/utils/nativeSourceContract.ts +1897 -0
- package/src/utils/scanDepsToOptimize.test.ts +80 -0
- package/src/utils/scanDepsToOptimize.ts +18 -7
- package/src/utils/swiftPackageId.ts +25 -1
- package/types/backgroundComputation.d.ts +28 -0
- package/types/backgroundComputation.d.ts.map +1 -0
- package/types/backgroundComputationNative.d.ts +2 -0
- package/types/backgroundComputationNative.d.ts.map +1 -0
- package/types/config/getBaseViteConfigOnly.d.ts.map +1 -1
- package/types/config/getOptimizeDeps.d.ts.map +1 -1
- package/types/config/getViteServerConfig.d.ts.map +1 -1
- package/types/constants/defaults.d.ts.map +1 -1
- package/types/exports/dev.d.ts.map +1 -1
- package/types/exports/prebuild.d.ts.map +1 -1
- package/types/exports/prebuildWithoutExpo.d.ts +6 -0
- package/types/exports/prebuildWithoutExpo.d.ts.map +1 -1
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -1
- package/types/native-source-contract.d.ts +2 -0
- package/types/native-source-contract.d.ts.map +1 -0
- package/types/patches/builtInDepPatches.d.ts.map +1 -1
- package/types/plugins/autoDepOptimizePlugin.d.ts.map +1 -1
- package/types/plugins/backgroundComputationPlugin.d.ts +3 -0
- package/types/plugins/backgroundComputationPlugin.d.ts.map +1 -0
- package/types/plugins/reactNativeDevAssetPlugin.d.ts.map +1 -1
- package/types/plugins/reactNativeDevServer.d.ts.map +1 -1
- package/types/plugins/workletImportsPlugin.d.ts.map +1 -1
- package/types/rn-commands/bundle/buildBundle.d.ts.map +1 -1
- package/types/swift-package-id.d.ts +2 -0
- package/types/swift-package-id.d.ts.map +1 -0
- package/types/utils/compileNativeDevBytecode.d.ts +3 -0
- package/types/utils/compileNativeDevBytecode.d.ts.map +1 -0
- package/types/utils/createNativeDevEngine.d.ts +7 -22
- package/types/utils/createNativeDevEngine.d.ts.map +1 -1
- package/types/utils/nativeRun.d.ts.map +1 -1
- package/types/utils/nativeSourceContract.d.ts +121 -0
- package/types/utils/nativeSourceContract.d.ts.map +1 -0
- package/types/utils/scanDepsToOptimize.d.ts +1 -0
- package/types/utils/scanDepsToOptimize.d.ts.map +1 -1
- package/types/utils/swiftPackageId.d.ts +1 -0
- package/types/utils/swiftPackageId.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runAndroid.native.js","names":[],"sources":["exports/runAndroid.native.js"],"sourcesContent":["import { nativeRun } from \"../utils/nativeRun\";\nvar runAndroid = async function(param) {\n var { root, port } = param;\n console.info(\"\\u203A one run:android\");\n return await nativeRun({\n root,\n platform: \"android\",\n port\n });\n};\nexport {\n runAndroid\n};\n//# sourceMappingURL=runAndroid.js.map\n"],"mappings":";;;AACA,IAAI,aAAa,eAAe,OAAO;
|
|
1
|
+
{"version":3,"file":"runAndroid.native.js","names":[],"sources":["exports/runAndroid.native.js"],"sourcesContent":["import { nativeRun } from \"../utils/nativeRun\";\nvar runAndroid = async function runAndroid2(param) {\n var { root, port } = param;\n console.info(\"\\u203A one run:android\");\n return await nativeRun({\n root,\n platform: \"android\",\n port\n });\n};\nexport {\n runAndroid\n};\n//# sourceMappingURL=runAndroid.js.map\n"],"mappings":";;;AACA,IAAI,aAAa,eAAe,YAAY,OAAO;CACjD,IAAI,EAAE,MAAM,SAAS;CACrB,QAAQ,KAAK,mBAAwB;CACrC,OAAO,MAAM,UAAU;EACrB;EACA,UAAU;EACV;CACF,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runIos.native.js","names":[],"sources":["exports/runIos.native.js"],"sourcesContent":["import { nativeRun } from \"../utils/nativeRun\";\nvar runIos = async function(param) {\n var { root, port, simulator, udid } = param;\n console.info(\"\\u203A one run:ios\");\n return await nativeRun({\n root,\n platform: \"ios\",\n port,\n simulator,\n udid\n });\n};\nexport {\n runIos\n};\n//# sourceMappingURL=runIos.js.map\n"],"mappings":";;;AACA,IAAI,SAAS,eAAe,OAAO;
|
|
1
|
+
{"version":3,"file":"runIos.native.js","names":[],"sources":["exports/runIos.native.js"],"sourcesContent":["import { nativeRun } from \"../utils/nativeRun\";\nvar runIos = async function runIos2(param) {\n var { root, port, simulator, udid } = param;\n console.info(\"\\u203A one run:ios\");\n return await nativeRun({\n root,\n platform: \"ios\",\n port,\n simulator,\n udid\n });\n};\nexport {\n runIos\n};\n//# sourceMappingURL=runIos.js.map\n"],"mappings":";;;AACA,IAAI,SAAS,eAAe,QAAQ,OAAO;CACzC,IAAI,EAAE,MAAM,MAAM,WAAW,SAAS;CACtC,QAAQ,KAAK,eAAoB;CACjC,OAAO,MAAM,UAAU;EACrB;EACA,UAAU;EACV;EACA;EACA;CACF,CAAC;AACH"}
|
|
@@ -6,7 +6,7 @@ import { compileCacheRules, serveStaticAssets } from "./serveStaticAssets.native
|
|
|
6
6
|
|
|
7
7
|
export * from "../utils/getServerEntry.native.js"
|
|
8
8
|
|
|
9
|
-
var serve = async function(param) {
|
|
9
|
+
var serve = async function serve2(param) {
|
|
10
10
|
var { afterRegisterRoutes, beforeRegisterRoutes, app = new Hono(), outDir = "dist", ...optionsIn } = param;
|
|
11
11
|
var { getServerOptionsFilled } = await import("../config/getServerOptionsFilled.native.js");
|
|
12
12
|
var options = await getServerOptionsFilled(optionsIn, "prod");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.native.js","names":[],"sources":["exports/serve.native.js"],"sourcesContent":["import { Hono } from \"hono\";\nimport { serveStatic } from \"@hono/node-server/serve-static\";\nimport { applyCompression, createProdServer } from \"./createServer\";\nimport { loadEnv } from \"../exports/loadEnv\";\nexport * from \"../utils/getServerEntry\";\nimport { createProdServer as createProdServer2, applyCompression as applyCompression2 } from \"./createServer\";\nimport { serveStaticAssets, compileCacheRules } from \"./serveStaticAssets\";\nvar serve = async function(param) {\n var { afterRegisterRoutes, beforeRegisterRoutes, app = new Hono(), outDir = \"dist\", ...optionsIn } = param;\n var { getServerOptionsFilled } = await import(\"../config/getServerOptionsFilled\");\n var options = await getServerOptionsFilled(optionsIn, \"prod\");\n applyCompression(app, options);\n if (beforeRegisterRoutes) {\n await beforeRegisterRoutes(options, app);\n }\n await createProdServer(app, options, {\n skipCompression: true,\n outDir\n });\n if (afterRegisterRoutes) {\n await afterRegisterRoutes(options, app);\n }\n await new Promise(function(res) {\n return setTimeout(res, 1);\n });\n var { honoServeNode } = await import(\"../serve/node\");\n return honoServeNode(app, options);\n};\nexport {\n applyCompression2 as applyCompression,\n compileCacheRules,\n createProdServer2 as createProdServer,\n loadEnv,\n serve,\n serveStatic,\n serveStaticAssets\n};\n//# sourceMappingURL=serve.js.map\n"],"mappings":";;;;;;;;;AAOA,IAAI,QAAQ,eAAe,OAAO;
|
|
1
|
+
{"version":3,"file":"serve.native.js","names":[],"sources":["exports/serve.native.js"],"sourcesContent":["import { Hono } from \"hono\";\nimport { serveStatic } from \"@hono/node-server/serve-static\";\nimport { applyCompression, createProdServer } from \"./createServer\";\nimport { loadEnv } from \"../exports/loadEnv\";\nexport * from \"../utils/getServerEntry\";\nimport { createProdServer as createProdServer2, applyCompression as applyCompression2 } from \"./createServer\";\nimport { serveStaticAssets, compileCacheRules } from \"./serveStaticAssets\";\nvar serve = async function serve2(param) {\n var { afterRegisterRoutes, beforeRegisterRoutes, app = new Hono(), outDir = \"dist\", ...optionsIn } = param;\n var { getServerOptionsFilled } = await import(\"../config/getServerOptionsFilled\");\n var options = await getServerOptionsFilled(optionsIn, \"prod\");\n applyCompression(app, options);\n if (beforeRegisterRoutes) {\n await beforeRegisterRoutes(options, app);\n }\n await createProdServer(app, options, {\n skipCompression: true,\n outDir\n });\n if (afterRegisterRoutes) {\n await afterRegisterRoutes(options, app);\n }\n await new Promise(function(res) {\n return setTimeout(res, 1);\n });\n var { honoServeNode } = await import(\"../serve/node\");\n return honoServeNode(app, options);\n};\nexport {\n applyCompression2 as applyCompression,\n compileCacheRules,\n createProdServer2 as createProdServer,\n loadEnv,\n serve,\n serveStatic,\n serveStaticAssets\n};\n//# sourceMappingURL=serve.js.map\n"],"mappings":";;;;;;;;;AAOA,IAAI,QAAQ,eAAe,OAAO,OAAO;CACvC,IAAI,EAAE,qBAAqB,sBAAsB,MAAM,IAAI,KAAK,GAAG,SAAS,QAAQ,GAAG,cAAc;CACrG,IAAI,EAAE,2BAA2B,MAAM,OAAO;CAC9C,IAAI,UAAU,MAAM,uBAAuB,WAAW,MAAM;CAC5D,iBAAiB,KAAK,OAAO;CAC7B,IAAI,sBAAsB;EACxB,MAAM,qBAAqB,SAAS,GAAG;CACzC;CACA,MAAM,iBAAiB,KAAK,SAAS;EACnC,iBAAiB;EACjB;CACF,CAAC;CACD,IAAI,qBAAqB;EACvB,MAAM,oBAAoB,SAAS,GAAG;CACxC;CACA,MAAM,IAAI,QAAQ,SAAS,KAAK;EAC9B,OAAO,WAAW,KAAK,CAAC;CAC1B,CAAC;CACD,IAAI,EAAE,kBAAkB,MAAM,OAAO;CACrC,OAAO,cAAc,KAAK,OAAO;AACnC"}
|
|
@@ -160,7 +160,7 @@ async function serveStaticAssets(param) {
|
|
|
160
160
|
var response = await serveStatic({
|
|
161
161
|
root,
|
|
162
162
|
path: sibling ? reqPath + sibling.ext : void 0,
|
|
163
|
-
onFound: function(fsPath, c) {
|
|
163
|
+
onFound: function onFound(fsPath, c) {
|
|
164
164
|
var originalFsPath = fsPath.replace(precompressedSuffixRe, "");
|
|
165
165
|
if (sibling) {
|
|
166
166
|
c.header("Content-Encoding", sibling.encoding);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serveStaticAssets.native.js","names":[],"sources":["exports/serveStaticAssets.native.js"],"sourcesContent":["import { serveStatic } from \"@hono/node-server/serve-static\";\nimport { statSync } from \"fs\";\nimport { join } from \"path\";\nimport { getMimeType } from \"hono/utils/mime\";\nimport micromatch from \"micromatch\";\nvar assetsPathRe = /[\\\\/]assets[\\\\/]/;\nvar hashedAssetRe = /[.-](?=[a-zA-Z0-9_-]*\\d)[a-zA-Z0-9_-]{8,}\\.\\w+$/;\nvar precompressedSuffixRe = /\\.(?:br|gz|zst)$/;\nvar PRECOMPRESSED_ENCODINGS = [\n {\n encoding: \"br\",\n ext: \".br\"\n },\n {\n encoding: \"zstd\",\n ext: \".zst\"\n },\n {\n encoding: \"gzip\",\n ext: \".gz\"\n }\n];\nvar compressibleMimeRe = /^\\s*(?:text\\/[^;\\s]+|application\\/(?:javascript|json|xml|xml-dtd|ecmascript|wasm|x-javascript|x-www-form-urlencoded)|font\\/(?:otf|ttf)|image\\/svg\\+xml|[^;\\s]+?\\+(?:json|text|xml|yaml))(?:[;\\s]|$)/i;\nfunction tryStat(path) {\n try {\n return statSync(path);\n } catch (unused) {\n return void 0;\n }\n}\nfunction parseAcceptEncoding(header) {\n if (!header) return /* @__PURE__ */ new Set();\n var out = /* @__PURE__ */ new Set();\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = header.split(\",\")[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var part = _step.value;\n var _part_split_;\n var enc = (_part_split_ = part.split(\";\")[0]) === null || _part_split_ === void 0 ? void 0 : _part_split_.trim().toLowerCase();\n if (enc) out.add(enc);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return out;\n}\nfunction pickFreshSibling(sourceFsPath, acceptEncoding) {\n var accepted = parseAcceptEncoding(acceptEncoding);\n if (accepted.size === 0) return void 0;\n var sourceStat = tryStat(sourceFsPath);\n if (!sourceStat || !sourceStat.isFile()) return void 0;\n var mime = getMimeType(sourceFsPath);\n if (mime && !compressibleMimeRe.test(mime)) return void 0;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = PRECOMPRESSED_ENCODINGS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var candidate = _step.value;\n if (!accepted.has(candidate.encoding)) continue;\n var siblingStat = tryStat(sourceFsPath + candidate.ext);\n if (!siblingStat || !siblingStat.isFile()) continue;\n if (siblingStat.mtimeMs >= sourceStat.mtimeMs) {\n return candidate;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return void 0;\n}\nfunction compileCacheRules(cacheControl) {\n var groups = /* @__PURE__ */ new Map();\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = Object.entries(cacheControl)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var [pattern, value] = _step.value;\n var arr = groups.get(value);\n if (!arr) {\n arr = [];\n groups.set(value, arr);\n }\n arr.push(pattern);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n var values = [];\n var groupSources = [];\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = groups[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var [value1, patterns] = _step1.value;\n values.push(value1);\n var sources = patterns.map(function(p) {\n return micromatch.makeRe(p).source;\n });\n groupSources.push(`(${sources.join(\"|\")})`);\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\n var re = new RegExp(groupSources.join(\"|\"));\n return {\n re,\n values\n };\n}\nasync function serveStaticAssets(param) {\n var { context, next, outDir = \"dist\", cacheRules } = param;\n var didCallNext = false;\n var root = `./${outDir}/client`;\n var rootPrefix = `${outDir}/client/`;\n var reqPath = context.req.path.replace(/^\\/+/, \"\");\n var sibling = pickFreshSibling(join(root, reqPath), context.req.header(\"Accept-Encoding\"));\n var originalMime = sibling ? getMimeType(reqPath) : void 0;\n var response = await serveStatic({\n root,\n // when a fresh sibling exists, pin the served file to <path>.<ext>.\n // hono will stat that path and stream it as-is; we set the right\n // Content-Encoding + Content-Type in onFound.\n path: sibling ? reqPath + sibling.ext : void 0,\n onFound: function(fsPath, c) {\n var originalFsPath = fsPath.replace(precompressedSuffixRe, \"\");\n if (sibling) {\n c.header(\"Content-Encoding\", sibling.encoding);\n c.header(\"Vary\", \"Accept-Encoding\", {\n append: true\n });\n if (originalMime) {\n c.header(\"Content-Type\", originalMime);\n }\n }\n var path = originalFsPath.startsWith(rootPrefix) ? originalFsPath.slice(rootPrefix.length) : originalFsPath;\n if (cacheRules) {\n var m = cacheRules.re.exec(path);\n if (m) {\n for (var i = 1; i < m.length; i++) {\n if (m[i] !== void 0) {\n c.header(\"Cache-Control\", cacheRules.values[i - 1]);\n return;\n }\n }\n }\n }\n if (assetsPathRe.test(originalFsPath) || hashedAssetRe.test(originalFsPath)) {\n c.header(\"Cache-Control\", \"public, immutable, max-age=31536000\");\n } else {\n c.header(\"Cache-Control\", \"public, max-age=0, must-revalidate\");\n }\n }\n })(context, async function() {\n didCallNext = true;\n await (next === null || next === void 0 ? void 0 : next());\n });\n if (!response || didCallNext) {\n return;\n }\n return response;\n}\nexport {\n compileCacheRules,\n serveStaticAssets\n};\n//# sourceMappingURL=serveStaticAssets.js.map\n"],"mappings":";;;;;;;AAKA,IAAI,eAAe;AACnB,IAAI,gBAAgB;AACpB,IAAI,wBAAwB;AAC5B,IAAI,0BAA0B;CAC5B;EACE,UAAU;EACV,KAAK;CACP;CACA;EACE,UAAU;EACV,KAAK;CACP;CACA;EACE,UAAU;EACV,KAAK;CACP;AACF;AACA,IAAI,qBAAqB;AACzB,SAAS,QAAQ,MAAM;CACrB,IAAI;EACF,OAAO,SAAS,IAAI;CACtB,SAAS,QAAQ;EACf,OAAO,KAAK;CACd;AACF;AACA,SAAS,oBAAoB,QAAQ;CACnC,IAAI,CAAC,QAAQ,uBAAuB,IAAI,IAAI;CAC5C,IAAI,sBAAsB,IAAI,IAAI;CAClC,IAAI,4BAA4B,MAAM,oBAAoB,OAAO,iBAAiB,KAAK;CACvF,IAAI;EACF,KAAK,IAAI,YAAY,OAAO,MAAM,GAAG,CAAC,CAAC,OAAO,SAAS,CAAC,GAAG,OAAO,EAAE,6BAA6B,QAAQ,UAAU,KAAK,EAAC,CAAE,OAAO,4BAA4B,MAAM;GAClK,IAAI,OAAO,MAAM;GACjB,IAAI;GACJ,IAAI,OAAO,eAAe,KAAK,MAAM,GAAG,CAAC,CAAC,QAAQ,QAAQ,iBAAiB,KAAK,IAAI,KAAK,IAAI,aAAa,KAAK,C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IACL,EAAE,OAAO,iBAAiB,oCAAoC;GAChE;EACF;CACF,CAAC,CAAC,CAAC,SAAS,iBAAiB;EAC3B,cAAc;EACd,OAAO,SAAS,QAAQ,SAAS,KAAK,IAAI,KAAK,IAAI,KAAK;CAC1D,CAAC;CACD,IAAI,CAAC,YAAY,aAAa;EAC5B;CACF;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"serveStaticAssets.native.js","names":[],"sources":["exports/serveStaticAssets.native.js"],"sourcesContent":["import { serveStatic } from \"@hono/node-server/serve-static\";\nimport { statSync } from \"fs\";\nimport { join } from \"path\";\nimport { getMimeType } from \"hono/utils/mime\";\nimport micromatch from \"micromatch\";\nvar assetsPathRe = /[\\\\/]assets[\\\\/]/;\nvar hashedAssetRe = /[.-](?=[a-zA-Z0-9_-]*\\d)[a-zA-Z0-9_-]{8,}\\.\\w+$/;\nvar precompressedSuffixRe = /\\.(?:br|gz|zst)$/;\nvar PRECOMPRESSED_ENCODINGS = [\n {\n encoding: \"br\",\n ext: \".br\"\n },\n {\n encoding: \"zstd\",\n ext: \".zst\"\n },\n {\n encoding: \"gzip\",\n ext: \".gz\"\n }\n];\nvar compressibleMimeRe = /^\\s*(?:text\\/[^;\\s]+|application\\/(?:javascript|json|xml|xml-dtd|ecmascript|wasm|x-javascript|x-www-form-urlencoded)|font\\/(?:otf|ttf)|image\\/svg\\+xml|[^;\\s]+?\\+(?:json|text|xml|yaml))(?:[;\\s]|$)/i;\nfunction tryStat(path) {\n try {\n return statSync(path);\n } catch (unused) {\n return void 0;\n }\n}\nfunction parseAcceptEncoding(header) {\n if (!header) return /* @__PURE__ */ new Set();\n var out = /* @__PURE__ */ new Set();\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = header.split(\",\")[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var part = _step.value;\n var _part_split_;\n var enc = (_part_split_ = part.split(\";\")[0]) === null || _part_split_ === void 0 ? void 0 : _part_split_.trim().toLowerCase();\n if (enc) out.add(enc);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return out;\n}\nfunction pickFreshSibling(sourceFsPath, acceptEncoding) {\n var accepted = parseAcceptEncoding(acceptEncoding);\n if (accepted.size === 0) return void 0;\n var sourceStat = tryStat(sourceFsPath);\n if (!sourceStat || !sourceStat.isFile()) return void 0;\n var mime = getMimeType(sourceFsPath);\n if (mime && !compressibleMimeRe.test(mime)) return void 0;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = PRECOMPRESSED_ENCODINGS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var candidate = _step.value;\n if (!accepted.has(candidate.encoding)) continue;\n var siblingStat = tryStat(sourceFsPath + candidate.ext);\n if (!siblingStat || !siblingStat.isFile()) continue;\n if (siblingStat.mtimeMs >= sourceStat.mtimeMs) {\n return candidate;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return void 0;\n}\nfunction compileCacheRules(cacheControl) {\n var groups = /* @__PURE__ */ new Map();\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = Object.entries(cacheControl)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var [pattern, value] = _step.value;\n var arr = groups.get(value);\n if (!arr) {\n arr = [];\n groups.set(value, arr);\n }\n arr.push(pattern);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n var values = [];\n var groupSources = [];\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = groups[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var [value1, patterns] = _step1.value;\n values.push(value1);\n var sources = patterns.map(function(p) {\n return micromatch.makeRe(p).source;\n });\n groupSources.push(`(${sources.join(\"|\")})`);\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\n var re = new RegExp(groupSources.join(\"|\"));\n return {\n re,\n values\n };\n}\nasync function serveStaticAssets(param) {\n var { context, next, outDir = \"dist\", cacheRules } = param;\n var didCallNext = false;\n var root = `./${outDir}/client`;\n var rootPrefix = `${outDir}/client/`;\n var reqPath = context.req.path.replace(/^\\/+/, \"\");\n var sibling = pickFreshSibling(join(root, reqPath), context.req.header(\"Accept-Encoding\"));\n var originalMime = sibling ? getMimeType(reqPath) : void 0;\n var response = await serveStatic({\n root,\n // when a fresh sibling exists, pin the served file to <path>.<ext>.\n // hono will stat that path and stream it as-is; we set the right\n // Content-Encoding + Content-Type in onFound.\n path: sibling ? reqPath + sibling.ext : void 0,\n onFound: function onFound(fsPath, c) {\n var originalFsPath = fsPath.replace(precompressedSuffixRe, \"\");\n if (sibling) {\n c.header(\"Content-Encoding\", sibling.encoding);\n c.header(\"Vary\", \"Accept-Encoding\", {\n append: true\n });\n if (originalMime) {\n c.header(\"Content-Type\", originalMime);\n }\n }\n var path = originalFsPath.startsWith(rootPrefix) ? originalFsPath.slice(rootPrefix.length) : originalFsPath;\n if (cacheRules) {\n var m = cacheRules.re.exec(path);\n if (m) {\n for (var i = 1; i < m.length; i++) {\n if (m[i] !== void 0) {\n c.header(\"Cache-Control\", cacheRules.values[i - 1]);\n return;\n }\n }\n }\n }\n if (assetsPathRe.test(originalFsPath) || hashedAssetRe.test(originalFsPath)) {\n c.header(\"Cache-Control\", \"public, immutable, max-age=31536000\");\n } else {\n c.header(\"Cache-Control\", \"public, max-age=0, must-revalidate\");\n }\n }\n })(context, async function() {\n didCallNext = true;\n await (next === null || next === void 0 ? void 0 : next());\n });\n if (!response || didCallNext) {\n return;\n }\n return response;\n}\nexport {\n compileCacheRules,\n serveStaticAssets\n};\n//# sourceMappingURL=serveStaticAssets.js.map\n"],"mappings":";;;;;;;AAKA,IAAI,eAAe;AACnB,IAAI,gBAAgB;AACpB,IAAI,wBAAwB;AAC5B,IAAI,0BAA0B;CAC5B;EACE,UAAU;EACV,KAAK;CACP;CACA;EACE,UAAU;EACV,KAAK;CACP;CACA;EACE,UAAU;EACV,KAAK;CACP;AACF;AACA,IAAI,qBAAqB;AACzB,SAAS,QAAQ,MAAM;CACrB,IAAI;EACF,OAAO,SAAS,IAAI;CACtB,SAAS,QAAQ;EACf,OAAO,KAAK;CACd;AACF;AACA,SAAS,oBAAoB,QAAQ;CACnC,IAAI,CAAC,QAAQ,uBAAuB,IAAI,IAAI;CAC5C,IAAI,sBAAsB,IAAI,IAAI;CAClC,IAAI,4BAA4B,MAAM,oBAAoB,OAAO,iBAAiB,KAAK;CACvF,IAAI;EACF,KAAK,IAAI,YAAY,OAAO,MAAM,GAAG,CAAC,CAAC,OAAO,SAAS,CAAC,GAAG,OAAO,EAAE,6BAA6B,QAAQ,UAAU,KAAK,EAAC,CAAE,OAAO,4BAA4B,MAAM;GAClK,IAAI,OAAO,MAAM;GACjB,IAAI;GACJ,IAAI,OAAO,eAAe,KAAK,MAAM,GAAG,CAAC,CAAC,QAAQ,QAAQ,iBAAiB,KAAK,IAAI,KAAK,IAAI,aAAa,KAAK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E,OAAO;IACL,EAAE,OAAO,iBAAiB,oCAAoC;GAChE;EACF;CACF,CAAC,CAAC,CAAC,SAAS,iBAAiB;EAC3B,cAAc;EACd,OAAO,SAAS,QAAQ,SAAS,KAAK,IAAI,KAAK,IAAI,KAAK;CAC1D,CAAC;CACD,IAAI,CAAC,YAAY,aAAa;EAC5B;CACF;CACA,OAAO;AACT"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { patch } from "./exports/patch.mjs";
|
|
|
9
9
|
import { loadEnv } from "./exports/loadEnv.mjs";
|
|
10
10
|
import { serveStaticAssets } from "./exports/serveStaticAssets.mjs";
|
|
11
11
|
import { fillOptions, getOptionsFilled } from "./config/getOptionsFilled.mjs";
|
|
12
|
+
import { assertBackgroundDependency, createBackgroundWorkletModule, loadBackgroundComputationModule, transformBackgroundComputations } from "./backgroundComputation.mjs";
|
|
12
13
|
|
|
13
14
|
export * from "./config/getOptimizeDeps.mjs"
|
|
14
15
|
|
|
@@ -34,6 +35,8 @@ export * from "./plugins/rnCodegenPlugin.mjs"
|
|
|
34
35
|
|
|
35
36
|
export * from "./plugins/workletImportsPlugin.mjs"
|
|
36
37
|
|
|
38
|
+
export * from "./plugins/backgroundComputationPlugin.mjs"
|
|
39
|
+
|
|
37
40
|
export * from "./types.mjs"
|
|
38
41
|
|
|
39
|
-
export { build, clean, dev, fillOptions, getOptionsFilled, loadEnv, patch, prebuild, runAndroid, runIos, serve, serveStaticAssets };
|
|
42
|
+
export { assertBackgroundDependency, build, clean, createBackgroundWorkletModule, dev, fillOptions, getOptionsFilled, loadBackgroundComputationModule, loadEnv, patch, prebuild, runAndroid, runIos, serve, serveStaticAssets, transformBackgroundComputations };
|
package/dist/index.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { patch } from "./exports/patch.mjs";
|
|
|
9
9
|
import { loadEnv } from "./exports/loadEnv.mjs";
|
|
10
10
|
import { serveStaticAssets } from "./exports/serveStaticAssets.mjs";
|
|
11
11
|
import { fillOptions, getOptionsFilled } from "./config/getOptionsFilled.mjs";
|
|
12
|
+
import { assertBackgroundDependency, createBackgroundWorkletModule, loadBackgroundComputationModule, transformBackgroundComputations } from "./backgroundComputation.mjs";
|
|
12
13
|
|
|
13
14
|
export * from "./config/getOptimizeDeps.mjs"
|
|
14
15
|
|
|
@@ -34,6 +35,8 @@ export * from "./plugins/rnCodegenPlugin.mjs"
|
|
|
34
35
|
|
|
35
36
|
export * from "./plugins/workletImportsPlugin.mjs"
|
|
36
37
|
|
|
38
|
+
export * from "./plugins/backgroundComputationPlugin.mjs"
|
|
39
|
+
|
|
37
40
|
export * from "./types.mjs"
|
|
38
41
|
|
|
39
|
-
export { build, clean, dev, fillOptions, getOptionsFilled, loadEnv, patch, prebuild, runAndroid, runIos, serve, serveStaticAssets };
|
|
42
|
+
export { assertBackgroundDependency, build, clean, createBackgroundWorkletModule, dev, fillOptions, getOptionsFilled, loadBackgroundComputationModule, loadEnv, patch, prebuild, runAndroid, runIos, serve, serveStaticAssets, transformBackgroundComputations };
|
package/dist/index.native.js
CHANGED
|
@@ -9,6 +9,7 @@ import { patch } from "./exports/patch.native.js";
|
|
|
9
9
|
import { loadEnv } from "./exports/loadEnv.native.js";
|
|
10
10
|
import { serveStaticAssets } from "./exports/serveStaticAssets.native.js";
|
|
11
11
|
import { fillOptions, getOptionsFilled } from "./config/getOptionsFilled.native.js";
|
|
12
|
+
import { assertBackgroundDependency, createBackgroundWorkletModule, loadBackgroundComputationModule, transformBackgroundComputations } from "./backgroundComputation.native.js";
|
|
12
13
|
|
|
13
14
|
export * from "./config/getOptimizeDeps.native.js"
|
|
14
15
|
|
|
@@ -34,6 +35,8 @@ export * from "./plugins/rnCodegenPlugin.native.js"
|
|
|
34
35
|
|
|
35
36
|
export * from "./plugins/workletImportsPlugin.native.js"
|
|
36
37
|
|
|
38
|
+
export * from "./plugins/backgroundComputationPlugin.native.js"
|
|
39
|
+
|
|
37
40
|
export * from "./types.native.js"
|
|
38
41
|
|
|
39
|
-
export { build, clean, dev, fillOptions, getOptionsFilled, loadEnv, patch, prebuild, runAndroid, runIos, serve, serveStaticAssets };
|
|
42
|
+
export { assertBackgroundDependency, build, clean, createBackgroundWorkletModule, dev, fillOptions, getOptionsFilled, loadBackgroundComputationModule, loadEnv, patch, prebuild, runAndroid, runIos, serve, serveStaticAssets, transformBackgroundComputations };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { kotlinSourceId, nativeSourceContract, renderKotlinSourceGlue, renderSwiftSourceGlue, swiftPodManifest, writeNativeSourceDeclaration, writeNativeSourceDeclarations, writeSwiftPackageArtifacts } from "./utils/nativeSourceContract.mjs";
|
|
2
|
+
|
|
3
|
+
export { kotlinSourceId, nativeSourceContract, renderKotlinSourceGlue, renderSwiftSourceGlue, swiftPodManifest, writeNativeSourceDeclaration, writeNativeSourceDeclarations, writeSwiftPackageArtifacts };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { kotlinSourceId, nativeSourceContract, renderKotlinSourceGlue, renderSwiftSourceGlue, swiftPodManifest, writeNativeSourceDeclaration, writeNativeSourceDeclarations, writeSwiftPackageArtifacts } from "./utils/nativeSourceContract.native.js";
|
|
2
|
+
|
|
3
|
+
export { kotlinSourceId, nativeSourceContract, renderKotlinSourceGlue, renderSwiftSourceGlue, swiftPodManifest, writeNativeSourceDeclaration, writeNativeSourceDeclarations, writeSwiftPackageArtifacts };
|
|
@@ -288,19 +288,6 @@ const RNV = Platform.constants.reactNativeVersion;
|
|
|
288
288
|
} @finally {`);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
module: "@react-navigation/native",
|
|
294
|
-
patchFiles: {
|
|
295
|
-
version: "8.0.0-alpha.44",
|
|
296
|
-
"android/src/main/java/org/reactnavigation/MaterialSymbolModule.kt": (contents) => {
|
|
297
|
-
assertString(contents);
|
|
298
|
-
bailIfExists(contents, "reactApplicationContext.currentActivity");
|
|
299
|
-
const patched = contents.replace("colorValue, currentActivity ?: reactApplicationContext", "colorValue, reactApplicationContext.currentActivity ?: reactApplicationContext");
|
|
300
|
-
bailIfUnchanged(patched, contents);
|
|
301
|
-
return patched;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
291
|
}
|
|
305
292
|
];
|
|
306
293
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtInDepPatches.js","names":[],"sources":["patches/builtInDepPatches.js"],"sourcesContent":["import { assertString } from \"../utils/assert\";\nimport { bailIfExists, bailIfUnchanged } from \"../utils/patches\";\nconst builtInDepPatches = [\n // @react-navigation/core 7.17 renamed createComponentForStaticNavigation to\n // createComponentForStaticConfigDeprecated, breaking @react-navigation/native\n // which still imports the old name. re-export the old name as an alias.\n {\n module: \"@react-navigation/core\",\n patchFiles: {\n version: \">=7.17.0 <8.0.0\",\n \"lib/module/index.js\": (contents) => {\n assertString(contents);\n if (contents.includes(\"createComponentForStaticNavigation\")) return;\n if (!contents.includes(\"createComponentForStaticConfigDeprecated\")) return;\n return contents.replace(\n /export \\{ createComponentForStaticConfigDeprecated as createComponentForStaticConfig,/,\n \"export { createComponentForStaticConfigDeprecated as createComponentForStaticConfig, createComponentForStaticConfigDeprecated as createComponentForStaticNavigation,\"\n );\n },\n \"lib/commonjs/index.js\": (contents) => {\n if (!contents) return;\n if (contents.includes(\"createComponentForStaticNavigation\")) return;\n if (!contents.includes(\"createComponentForStaticConfigDeprecated\")) return;\n return contents.replace(\n /createComponentForStaticConfigDeprecated as createComponentForStaticConfig,/,\n \"createComponentForStaticConfigDeprecated as createComponentForStaticConfig, createComponentForStaticConfigDeprecated as createComponentForStaticNavigation,\"\n );\n }\n }\n },\n // react-native-maps ships TypeScript source, and every map child component\n // declares the members decorateMapComponent installs on the prototype as\n // definite-assignment class fields (`getNativeComponent!: () => ...`). oxc\n // keeps a field declaration that has no initializer, so constructing the\n // component gives each instance its own `undefined` property that shadows the\n // prototype method, and the first render throws \"this.getNativeComponent is\n // not a function\". babel's loose class properties erase these on native, so\n // only the vite side breaks. oxc ignores useDefineForClassFields, so no\n // tsconfig or oxc option reaches this; `declare` is what the declaration\n // always meant and every transform erases it.\n {\n module: \"react-native-maps\",\n patchFiles: {\n \"src/*.tsx\": (contents) => {\n assertString(contents);\n const patched = contents.replace(\n /^(\\s*)(context|getNativeComponent|getMapManagerCommand|getUIManagerCommand)!:/gm,\n \"$1declare $2:\"\n );\n bailIfUnchanged(patched, contents);\n return patched;\n }\n }\n },\n // react-native-web doesn't export unstable_batchedUpdates but react-native does,\n // so libraries like @legendapp/list break when aliased to rnw on web\n {\n module: \"react-native-web\",\n patchFiles: {\n \"dist/index.js\": (contents) => {\n assertString(contents);\n bailIfExists(contents, \"unstable_batchedUpdates\");\n return `${contents}\nexport { unstable_batchedUpdates } from 'react-dom';\n`;\n }\n }\n },\n {\n module: \"react\",\n patchFiles: {\n version: \"18.*\",\n \"compiler-runtime.js\": `module.exports = require('@vxrn/vendor/react-19-compiler-runtime');`,\n \"index.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-19');`,\n \"jsx-dev-runtime.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-jsx-dev-19');`,\n \"jsx-runtime.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-jsx-19');`,\n \"package.json\": (contents) => {\n assertString(contents);\n const pkg = JSON.parse(contents);\n if (pkg.version.startsWith(\"19.\")) {\n return;\n }\n const existingExports = { ...pkg.exports };\n if (!pkg.exports[\".\"]) {\n throw new Error(\n `Expected a version of React that has package.json exports defined`\n );\n }\n pkg.exports[\".\"] = {\n \"react-server\": \"./react.shared-subset.js\",\n \"vxrn-web\": \"./index.vxrn-web.js\",\n default: \"./index.js\"\n };\n pkg.exports[\"./jsx-runtime\"] = {\n \"vxrn-web\": \"./jsx-runtime.vxrn-web.js\",\n default: \"./jsx-runtime.js\"\n };\n pkg.exports[\"./compiler-runtime\"] = {\n default: \"./compiler-runtime.js\"\n };\n pkg.exports[\"./jsx-dev-runtime\"] = {\n \"vxrn-web\": \"./jsx-dev-runtime.vxrn-web.js\",\n default: \"./jsx-dev-runtime.js\"\n };\n bailIfUnchanged(existingExports, pkg.exports);\n return JSON.stringify(pkg, null, 2);\n },\n // for prod builds we have to actually change the entries:\n // to avoid terrible metro we have to eval :(\n \"index.js\": (contents) => {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-19')\")) } else {\n ${contents}\n}`;\n },\n // to avoid terrible metro we have to eval :(\n \"jsx-runtime.js\": (contents) => {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-jsx-19')\")) } else {\n ${contents}\n}`;\n }\n }\n },\n {\n module: \"react-dom\",\n patchFiles: {\n version: \"18.*\",\n // for prod builds we have to actually change the entries:\n \"index.js\": (contents) => {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-dom-19')\")) } else {\n${contents}\n}`;\n },\n \"client.js\": (contents) => {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-dom-client-19')\")) } else {\n${contents}\n}`;\n },\n \"server.browser.js\": (contents) => {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, require('@vxrn/vendor/react-dom-server.browser-19')) } else {\n${contents}\n}`;\n },\n \"client.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-client-19')`,\n \"index.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-19')`,\n \"server.browser.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-server.browser-19')`,\n \"test-utils.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-test-utils-19')`,\n \"package.json\": (contents) => {\n assertString(contents);\n const pkg = JSON.parse(contents);\n if (pkg.version.startsWith(\"19.\")) {\n return;\n }\n const existingExports = { ...pkg.exports };\n if (!pkg.exports[\".\"]) {\n throw new Error(\n `Expected a version of React that has package.json exports defined`\n );\n }\n pkg.exports[\".\"] = {\n \"vxrn-web\": \"./index.vxrn-web.js\",\n default: \"./index.js\"\n };\n pkg.exports[\"./client\"] = {\n \"vxrn-web\": \"./client.vxrn-web.js\",\n default: \"./client.js\"\n };\n pkg.exports[\"./server.browser\"] = {\n \"vxrn-web\": \"./server.browser.vxrn-web.js\",\n default: \"./server.browser.js\"\n };\n pkg.exports[\"./test-utils\"] = {\n \"vxrn-web\": \"./test-utils.vxrn-web.js\",\n default: \"./test-utils.js\"\n };\n bailIfUnchanged(existingExports, pkg.exports);\n return JSON.stringify(pkg, null, 2);\n }\n }\n },\n // Older versions of the cli-config package will not look for `.cjs` files when loading the config. This isn't necessary for v14.x (which comes with RN 0.75). See: https://hackmd.io/@z/SJghMPN6C.\n {\n module: \"@react-native-community/cli-config\",\n patchFiles: {\n version: \">=13.0.0 <16.0.0\",\n \"build/readConfigFromDisk.js\": (contents) => {\n assertString(contents);\n return contents.replace(\n `['react-native.config.js']`,\n `['react-native.config.js', 'react-native.config.cjs']`\n ).replace(\n \"searchPlaces,\",\n `searchPlaces, loaders: { '.cjs': _cosmiconfig().default.loadJs },`\n ).replace(\n \"stopDir: rootFolder,\",\n `stopDir: rootFolder, loaders: { '.cjs': _cosmiconfig().default.loadJs },`\n );\n }\n }\n },\n {\n module: \"react-native-reanimated\",\n patchFiles: {\n // reanimated 4 ships no JSX in its `.js`. Measured against 4.5.1: all 374\n // files parse with SWC at `jsx: false`, and the only JSX-shaped text is\n // inside comments. The transform still rewrote and reformatted every one\n // of them, which is how a patch aimed at reanimated ended up re-printing\n // its nested `semver` and giving one package@version two contents on\n // disk. Left in place below 4 rather than deleted, because we verified 4\n // and not the 3.x line.\n version: \"<4.0.0\",\n \"**/*.js\": [\"jsx\"]\n }\n },\n // fix RNGH crash on RN 0.86+ new architecture\n // getShadowNodeFromRef crashes when findHostInstance_DEPRECATED returns null\n {\n module: \"react-native-gesture-handler\",\n patchFiles: {\n version: \">=3.0.0\",\n \"lib/module/getShadowNodeFromRef.js\": (contents) => {\n return contents?.replace(\n `const hostInstance = isAlreadyHostInstance ? ref : findHostInstance_DEPRECATED(ref);\n\n // @ts-ignore Fabric\n return getInternalInstanceHandleFromPublicInstance(hostInstance).stateNode.node;`,\n `const hostInstance = isAlreadyHostInstance ? ref : findHostInstance_DEPRECATED(ref);\n if (hostInstance === null || hostInstance === undefined) {\n return null;\n }\n const internalHandle = getInternalInstanceHandleFromPublicInstance(hostInstance);\n if (internalHandle === null || internalHandle === undefined) {\n return null;\n }\n return internalHandle.stateNode?.node ?? null;`\n );\n },\n // metro uses src/ directly via \"react-native\" field in package.json\n \"src/getShadowNodeFromRef.ts\": (contents) => {\n return contents?.replace(\n `const hostInstance = isAlreadyHostInstance\n ? ref\n : findHostInstance_DEPRECATED(ref);\n\n // @ts-ignore Fabric\n return getInternalInstanceHandleFromPublicInstance(hostInstance).stateNode\n .node;`,\n `const hostInstance = isAlreadyHostInstance\n ? ref\n : findHostInstance_DEPRECATED(ref);\n if (hostInstance === null || hostInstance === undefined) {\n return null;\n }\n const internalHandle = getInternalInstanceHandleFromPublicInstance(hostInstance);\n if (internalHandle === null || internalHandle === undefined) {\n return null;\n }\n return internalHandle.stateNode?.node ?? null;`\n );\n }\n }\n },\n {\n module: \"@react-native-masked-view/masked-view\",\n patchFiles: {\n \"**/*.js\": [\"flow\", \"swc\"]\n }\n },\n {\n module: \"react-native-vector-icons\",\n patchFiles: {\n \"**/*.js\": [\"jsx\", \"flow\"]\n }\n },\n {\n module: \"react-native-webview\",\n patchFiles: {\n \"**/*.js\": [\"jsx\"]\n }\n },\n {\n module: \"@react-native/assets-registry\",\n patchFiles: {\n \"**/*.js\": [\"flow\"]\n }\n },\n {\n module: \"react-native-css-interop\",\n patchFiles: {\n // 2 of 53 dist files genuinely need JSX parsing, so this one is real.\n //\n // Two sibling patches were removed here, both dead. A `wrap-jsx.js` entry\n // tried to hoist `require(\"./components\")` out of the function so\n // cssInterop registration runs, but `patches.ts` selects with\n // `filePatches.find(relativePath)` and `dist/**/*.js` is declared first,\n // so the glob shadowed it and the hoist never executed once: the patched\n // file on disk still has the require inside the function. A `package.json`\n // entry set `sideEffects` to keep components.js from being tree-shaken,\n // and 0.2.6 already ships exactly that value.\n //\n // So nativewind registration has never actually been hoisted by this\n // patch. Anyone deciding whether to keep the CSS-on-native path should\n // start from that, not from the assumption that it works today.\n \"dist/**/*.js\": [\"jsx\"]\n }\n },\n {\n module: \"@sentry/react-native\",\n patchFiles: {\n version: \">=5.6.0\",\n \"dist/**/*.js\": [\"jsx\"]\n }\n },\n {\n module: \"@sentry/react-native\",\n patchFiles: {\n version: \">=5.0.0 <5.6.0\",\n \"dist/js/utils/environment.js\": (contents) => {\n assertString(contents);\n return contents.replace(\n `import { version as RNV } from 'react-native/Libraries/Core/ReactNativeVersion';`,\n `import { Platform } from 'react-native';\nconst RNV = Platform.constants.reactNativeVersion;\n`\n );\n },\n \"dist/**/*.js\": [\"jsx\"]\n }\n },\n {\n module: \"qrcode\",\n patchFiles: {\n version: \"<=1.5.1\",\n \"lib/server.js\": (contents) => {\n assertString(contents);\n return contents.replace(\n `const TerminalRenderer = require('./renderer/terminal')`,\n `const TerminalRenderer = require('./renderer/terminal.js')`\n );\n }\n }\n },\n {\n module: \"whatwg-url-without-unicode\",\n // https://github.com/onejs/one/issues/258\n patchFiles: {\n \"**/*.js\": (contents) => contents?.replace(\n /punycode\\.ucs2\\.decode/gm,\n \"(punycode.ucs2decode || punycode.ucs2.decode)\"\n )?.replace(\n /punycode\\.ucs2\\.encode/gm,\n \"(punycode.ucs2encode || punycode.ucs2.encode)\"\n )\n }\n },\n {\n module: \"@hot-updater/plugin-core\",\n patchFiles: {\n version: \"0.*\",\n \"dist/index.cjs\": (contents) => {\n return contents?.replace(\n 'let mime = require(\"mime\");',\n 'let mime = { getType: () => \"application/octet-stream\", getExtension: () => null };'\n );\n }\n }\n },\n // a void TurboModule method that throws an Obj-C NSException crashes the app\n // when React Native rethrows it on the TurboModule queue. there is no JS\n // caller for an async void method to receive an error, so log it instead.\n // see tests/test/IOS_PROD_CRASH.md\n {\n module: \"react-native\",\n patchFiles: {\n version: \">=0.86.0\",\n \"ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm\": (contents) => {\n if (!contents) return;\n return contents.replace(\n ` @try {\n [inv invokeWithTarget:strongModule];\n } @catch (NSException *exception) {\n // Void methods are always async, re-throw instead of converting to\n // JSError, same as the async branch in performMethodInvocation.\n @throw exception;\n } @finally {`,\n ` @try {\n [inv invokeWithTarget:strongModule];\n } @catch (NSException *exception) {\n RCTLogError(@\"Exception in %s.%s: %@\", moduleName, methodNameStr.c_str(), exception.reason);\n } @finally {`\n );\n }\n }\n },\n // react native 0.87 made ReactContextBaseJavaModule a Kotlin class, so the\n // bare `currentActivity` property in @react-navigation/native's MaterialSymbolModule\n // no longer resolves and the Android build fails to compile. upstream alpha.45\n // changed exactly this line; the monorepo stays on alpha.44 because alpha.45\n // also pulls a @react-navigation/core alpha that renames Tabs APIs.\n {\n module: \"@react-navigation/native\",\n patchFiles: {\n version: \"8.0.0-alpha.44\",\n \"android/src/main/java/org/reactnavigation/MaterialSymbolModule.kt\": (contents) => {\n assertString(contents);\n bailIfExists(contents, \"reactApplicationContext.currentActivity\");\n const patched = contents.replace(\n \"colorValue, currentActivity ?: reactApplicationContext\",\n \"colorValue, reactApplicationContext.currentActivity ?: reactApplicationContext\"\n );\n bailIfUnchanged(patched, contents);\n return patched;\n }\n }\n }\n];\nexport {\n builtInDepPatches\n};\n//# sourceMappingURL=builtInDepPatches.js.map\n"],"mappings":";;;;AAEA,MAAM,oBAAoB;CAIxB;EACE,QAAQ;EACR,YAAY;GACV,SAAS;GACT,wBAAwB,aAAa;IACnC,aAAa,QAAQ;IACrB,IAAI,SAAS,SAAS,oCAAoC,GAAG;IAC7D,IAAI,CAAC,SAAS,SAAS,0CAA0C,GAAG;IACpE,OAAO,SAA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AY;GACV,SAAS;GACT,sEAAsE,aAAa;IACjF,aAAa,QAAQ;IACrB,aAAa,UAAU,yCAAyC;IAChE,MAAM,UAAU,SAAS,QACvB,0DACA,gFACF;IACA,gBAAgB,SAAS,QAAQ;IACjC,OAAO;GACT;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"builtInDepPatches.js","names":[],"sources":["patches/builtInDepPatches.js"],"sourcesContent":["import { assertString } from \"../utils/assert\";\nimport { bailIfExists, bailIfUnchanged } from \"../utils/patches\";\nconst builtInDepPatches = [\n // @react-navigation/core 7.17 renamed createComponentForStaticNavigation to\n // createComponentForStaticConfigDeprecated, breaking @react-navigation/native\n // which still imports the old name. re-export the old name as an alias.\n {\n module: \"@react-navigation/core\",\n patchFiles: {\n version: \">=7.17.0 <8.0.0\",\n \"lib/module/index.js\": (contents) => {\n assertString(contents);\n if (contents.includes(\"createComponentForStaticNavigation\")) return;\n if (!contents.includes(\"createComponentForStaticConfigDeprecated\")) return;\n return contents.replace(\n /export \\{ createComponentForStaticConfigDeprecated as createComponentForStaticConfig,/,\n \"export { createComponentForStaticConfigDeprecated as createComponentForStaticConfig, createComponentForStaticConfigDeprecated as createComponentForStaticNavigation,\"\n );\n },\n \"lib/commonjs/index.js\": (contents) => {\n if (!contents) return;\n if (contents.includes(\"createComponentForStaticNavigation\")) return;\n if (!contents.includes(\"createComponentForStaticConfigDeprecated\")) return;\n return contents.replace(\n /createComponentForStaticConfigDeprecated as createComponentForStaticConfig,/,\n \"createComponentForStaticConfigDeprecated as createComponentForStaticConfig, createComponentForStaticConfigDeprecated as createComponentForStaticNavigation,\"\n );\n }\n }\n },\n // react-native-maps ships TypeScript source, and every map child component\n // declares the members decorateMapComponent installs on the prototype as\n // definite-assignment class fields (`getNativeComponent!: () => ...`). oxc\n // keeps a field declaration that has no initializer, so constructing the\n // component gives each instance its own `undefined` property that shadows the\n // prototype method, and the first render throws \"this.getNativeComponent is\n // not a function\". babel's loose class properties erase these on native, so\n // only the vite side breaks. oxc ignores useDefineForClassFields, so no\n // tsconfig or oxc option reaches this; `declare` is what the declaration\n // always meant and every transform erases it.\n {\n module: \"react-native-maps\",\n patchFiles: {\n \"src/*.tsx\": (contents) => {\n assertString(contents);\n const patched = contents.replace(\n /^(\\s*)(context|getNativeComponent|getMapManagerCommand|getUIManagerCommand)!:/gm,\n \"$1declare $2:\"\n );\n bailIfUnchanged(patched, contents);\n return patched;\n }\n }\n },\n // react-native-web doesn't export unstable_batchedUpdates but react-native does,\n // so libraries like @legendapp/list break when aliased to rnw on web\n {\n module: \"react-native-web\",\n patchFiles: {\n \"dist/index.js\": (contents) => {\n assertString(contents);\n bailIfExists(contents, \"unstable_batchedUpdates\");\n return `${contents}\nexport { unstable_batchedUpdates } from 'react-dom';\n`;\n }\n }\n },\n {\n module: \"react\",\n patchFiles: {\n version: \"18.*\",\n \"compiler-runtime.js\": `module.exports = require('@vxrn/vendor/react-19-compiler-runtime');`,\n \"index.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-19');`,\n \"jsx-dev-runtime.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-jsx-dev-19');`,\n \"jsx-runtime.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-jsx-19');`,\n \"package.json\": (contents) => {\n assertString(contents);\n const pkg = JSON.parse(contents);\n if (pkg.version.startsWith(\"19.\")) {\n return;\n }\n const existingExports = { ...pkg.exports };\n if (!pkg.exports[\".\"]) {\n throw new Error(\n `Expected a version of React that has package.json exports defined`\n );\n }\n pkg.exports[\".\"] = {\n \"react-server\": \"./react.shared-subset.js\",\n \"vxrn-web\": \"./index.vxrn-web.js\",\n default: \"./index.js\"\n };\n pkg.exports[\"./jsx-runtime\"] = {\n \"vxrn-web\": \"./jsx-runtime.vxrn-web.js\",\n default: \"./jsx-runtime.js\"\n };\n pkg.exports[\"./compiler-runtime\"] = {\n default: \"./compiler-runtime.js\"\n };\n pkg.exports[\"./jsx-dev-runtime\"] = {\n \"vxrn-web\": \"./jsx-dev-runtime.vxrn-web.js\",\n default: \"./jsx-dev-runtime.js\"\n };\n bailIfUnchanged(existingExports, pkg.exports);\n return JSON.stringify(pkg, null, 2);\n },\n // for prod builds we have to actually change the entries:\n // to avoid terrible metro we have to eval :(\n \"index.js\": (contents) => {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-19')\")) } else {\n ${contents}\n}`;\n },\n // to avoid terrible metro we have to eval :(\n \"jsx-runtime.js\": (contents) => {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-jsx-19')\")) } else {\n ${contents}\n}`;\n }\n }\n },\n {\n module: \"react-dom\",\n patchFiles: {\n version: \"18.*\",\n // for prod builds we have to actually change the entries:\n \"index.js\": (contents) => {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-dom-19')\")) } else {\n${contents}\n}`;\n },\n \"client.js\": (contents) => {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-dom-client-19')\")) } else {\n${contents}\n}`;\n },\n \"server.browser.js\": (contents) => {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, require('@vxrn/vendor/react-dom-server.browser-19')) } else {\n${contents}\n}`;\n },\n \"client.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-client-19')`,\n \"index.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-19')`,\n \"server.browser.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-server.browser-19')`,\n \"test-utils.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-test-utils-19')`,\n \"package.json\": (contents) => {\n assertString(contents);\n const pkg = JSON.parse(contents);\n if (pkg.version.startsWith(\"19.\")) {\n return;\n }\n const existingExports = { ...pkg.exports };\n if (!pkg.exports[\".\"]) {\n throw new Error(\n `Expected a version of React that has package.json exports defined`\n );\n }\n pkg.exports[\".\"] = {\n \"vxrn-web\": \"./index.vxrn-web.js\",\n default: \"./index.js\"\n };\n pkg.exports[\"./client\"] = {\n \"vxrn-web\": \"./client.vxrn-web.js\",\n default: \"./client.js\"\n };\n pkg.exports[\"./server.browser\"] = {\n \"vxrn-web\": \"./server.browser.vxrn-web.js\",\n default: \"./server.browser.js\"\n };\n pkg.exports[\"./test-utils\"] = {\n \"vxrn-web\": \"./test-utils.vxrn-web.js\",\n default: \"./test-utils.js\"\n };\n bailIfUnchanged(existingExports, pkg.exports);\n return JSON.stringify(pkg, null, 2);\n }\n }\n },\n // Older versions of the cli-config package will not look for `.cjs` files when loading the config. This isn't necessary for v14.x (which comes with RN 0.75). See: https://hackmd.io/@z/SJghMPN6C.\n {\n module: \"@react-native-community/cli-config\",\n patchFiles: {\n version: \">=13.0.0 <16.0.0\",\n \"build/readConfigFromDisk.js\": (contents) => {\n assertString(contents);\n return contents.replace(\n `['react-native.config.js']`,\n `['react-native.config.js', 'react-native.config.cjs']`\n ).replace(\n \"searchPlaces,\",\n `searchPlaces, loaders: { '.cjs': _cosmiconfig().default.loadJs },`\n ).replace(\n \"stopDir: rootFolder,\",\n `stopDir: rootFolder, loaders: { '.cjs': _cosmiconfig().default.loadJs },`\n );\n }\n }\n },\n {\n module: \"react-native-reanimated\",\n patchFiles: {\n // reanimated 4 ships no JSX in its `.js`. Measured against 4.5.1: all 374\n // files parse with SWC at `jsx: false`, and the only JSX-shaped text is\n // inside comments. The transform still rewrote and reformatted every one\n // of them, which is how a patch aimed at reanimated ended up re-printing\n // its nested `semver` and giving one package@version two contents on\n // disk. Left in place below 4 rather than deleted, because we verified 4\n // and not the 3.x line.\n version: \"<4.0.0\",\n \"**/*.js\": [\"jsx\"]\n }\n },\n // fix RNGH crash on RN 0.86+ new architecture\n // getShadowNodeFromRef crashes when findHostInstance_DEPRECATED returns null\n {\n module: \"react-native-gesture-handler\",\n patchFiles: {\n version: \">=3.0.0\",\n \"lib/module/getShadowNodeFromRef.js\": (contents) => {\n return contents?.replace(\n `const hostInstance = isAlreadyHostInstance ? ref : findHostInstance_DEPRECATED(ref);\n\n // @ts-ignore Fabric\n return getInternalInstanceHandleFromPublicInstance(hostInstance).stateNode.node;`,\n `const hostInstance = isAlreadyHostInstance ? ref : findHostInstance_DEPRECATED(ref);\n if (hostInstance === null || hostInstance === undefined) {\n return null;\n }\n const internalHandle = getInternalInstanceHandleFromPublicInstance(hostInstance);\n if (internalHandle === null || internalHandle === undefined) {\n return null;\n }\n return internalHandle.stateNode?.node ?? null;`\n );\n },\n // metro uses src/ directly via \"react-native\" field in package.json\n \"src/getShadowNodeFromRef.ts\": (contents) => {\n return contents?.replace(\n `const hostInstance = isAlreadyHostInstance\n ? ref\n : findHostInstance_DEPRECATED(ref);\n\n // @ts-ignore Fabric\n return getInternalInstanceHandleFromPublicInstance(hostInstance).stateNode\n .node;`,\n `const hostInstance = isAlreadyHostInstance\n ? ref\n : findHostInstance_DEPRECATED(ref);\n if (hostInstance === null || hostInstance === undefined) {\n return null;\n }\n const internalHandle = getInternalInstanceHandleFromPublicInstance(hostInstance);\n if (internalHandle === null || internalHandle === undefined) {\n return null;\n }\n return internalHandle.stateNode?.node ?? null;`\n );\n }\n }\n },\n {\n module: \"@react-native-masked-view/masked-view\",\n patchFiles: {\n \"**/*.js\": [\"flow\", \"swc\"]\n }\n },\n {\n module: \"react-native-vector-icons\",\n patchFiles: {\n \"**/*.js\": [\"jsx\", \"flow\"]\n }\n },\n {\n module: \"react-native-webview\",\n patchFiles: {\n \"**/*.js\": [\"jsx\"]\n }\n },\n {\n module: \"@react-native/assets-registry\",\n patchFiles: {\n \"**/*.js\": [\"flow\"]\n }\n },\n {\n module: \"react-native-css-interop\",\n patchFiles: {\n // 2 of 53 dist files genuinely need JSX parsing, so this one is real.\n //\n // Two sibling patches were removed here, both dead. A `wrap-jsx.js` entry\n // tried to hoist `require(\"./components\")` out of the function so\n // cssInterop registration runs, but `patches.ts` selects with\n // `filePatches.find(relativePath)` and `dist/**/*.js` is declared first,\n // so the glob shadowed it and the hoist never executed once: the patched\n // file on disk still has the require inside the function. A `package.json`\n // entry set `sideEffects` to keep components.js from being tree-shaken,\n // and 0.2.6 already ships exactly that value.\n //\n // So nativewind registration has never actually been hoisted by this\n // patch. Anyone deciding whether to keep the CSS-on-native path should\n // start from that, not from the assumption that it works today.\n \"dist/**/*.js\": [\"jsx\"]\n }\n },\n {\n module: \"@sentry/react-native\",\n patchFiles: {\n version: \">=5.6.0\",\n \"dist/**/*.js\": [\"jsx\"]\n }\n },\n {\n module: \"@sentry/react-native\",\n patchFiles: {\n version: \">=5.0.0 <5.6.0\",\n \"dist/js/utils/environment.js\": (contents) => {\n assertString(contents);\n return contents.replace(\n `import { version as RNV } from 'react-native/Libraries/Core/ReactNativeVersion';`,\n `import { Platform } from 'react-native';\nconst RNV = Platform.constants.reactNativeVersion;\n`\n );\n },\n \"dist/**/*.js\": [\"jsx\"]\n }\n },\n {\n module: \"qrcode\",\n patchFiles: {\n version: \"<=1.5.1\",\n \"lib/server.js\": (contents) => {\n assertString(contents);\n return contents.replace(\n `const TerminalRenderer = require('./renderer/terminal')`,\n `const TerminalRenderer = require('./renderer/terminal.js')`\n );\n }\n }\n },\n {\n module: \"whatwg-url-without-unicode\",\n // https://github.com/onejs/one/issues/258\n patchFiles: {\n \"**/*.js\": (contents) => contents?.replace(\n /punycode\\.ucs2\\.decode/gm,\n \"(punycode.ucs2decode || punycode.ucs2.decode)\"\n )?.replace(\n /punycode\\.ucs2\\.encode/gm,\n \"(punycode.ucs2encode || punycode.ucs2.encode)\"\n )\n }\n },\n {\n module: \"@hot-updater/plugin-core\",\n patchFiles: {\n version: \"0.*\",\n \"dist/index.cjs\": (contents) => {\n return contents?.replace(\n 'let mime = require(\"mime\");',\n 'let mime = { getType: () => \"application/octet-stream\", getExtension: () => null };'\n );\n }\n }\n },\n // a void TurboModule method that throws an Obj-C NSException crashes the app\n // when React Native rethrows it on the TurboModule queue. there is no JS\n // caller for an async void method to receive an error, so log it instead.\n // see tests/test/IOS_PROD_CRASH.md\n {\n module: \"react-native\",\n patchFiles: {\n version: \">=0.86.0\",\n \"ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm\": (contents) => {\n if (!contents) return;\n return contents.replace(\n ` @try {\n [inv invokeWithTarget:strongModule];\n } @catch (NSException *exception) {\n // Void methods are always async, re-throw instead of converting to\n // JSError, same as the async branch in performMethodInvocation.\n @throw exception;\n } @finally {`,\n ` @try {\n [inv invokeWithTarget:strongModule];\n } @catch (NSException *exception) {\n RCTLogError(@\"Exception in %s.%s: %@\", moduleName, methodNameStr.c_str(), exception.reason);\n } @finally {`\n );\n }\n }\n }\n];\nexport {\n builtInDepPatches\n};\n//# sourceMappingURL=builtInDepPatches.js.map\n"],"mappings":";;;;AAEA,MAAM,oBAAoB;CAIxB;EACE,QAAQ;EACR,YAAY;GACV,SAAS;GACT,wBAAwB,aAAa;IACnC,aAAa,QAAQ;IACrB,IAAI,SAAS,SAAS,oCAAoC,GAAG;IAC7D,IAAI,CAAC,SAAS,SAAS,0CAA0C,GAAG;IACpE,OAAO,SAAS,QACd,yFACA,sKACF;GACF;GACA,0BAA0B,aAAa;IACrC,IAAI,CAAC,UAAU;IACf,IAAI,SAAS,SAAS,oCAAoC,GAAG;IAC7D,IAAI,CAAC,SAAS,SAAS,0CAA0C,GAAG;IACpE,OAAO,SAAS,QACd,+EACA,6JACF;GACF;EACF;CACF;CAWA;EACE,QAAQ;EACR,YAAY,EACV,cAAc,aAAa;GACzB,aAAa,QAAQ;GACrB,MAAM,UAAU,SAAS,QACvB,mFACA,eACF;GACA,gBAAgB,SAAS,QAAQ;GACjC,OAAO;EACT,EACF;CACF;CAGA;EACE,QAAQ;EACR,YAAY,EACV,kBAAkB,aAAa;GAC7B,aAAa,QAAQ;GACrB,aAAa,UAAU,yBAAyB;GAChD,OAAO,GAAG,SAAS;;;EAGrB,EACF;CACF;CAC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QAAQ;EACR,YAAY;GACV,SAAS;GACT,gBAAgB,CAAC,KAAK;EACxB;CACF;CACA;EACE,QAAQ;EACR,YAAY;GACV,SAAS;GACT,iCAAiC,aAAa;IAC5C,aAAa,QAAQ;IACrB,OAAO,SAAS,QACd,oFACA;;CAGF;GACF;GACA,gBAAgB,CAAC,KAAK;EACxB;CACF;CACA;EACE,QAAQ;EACR,YAAY;GACV,SAAS;GACT,kBAAkB,aAAa;IAC7B,aAAa,QAAQ;IACrB,OAAO,SAAS,QACd,2DACA,4DACF;GACF;EACF;CACF;CACA;EACE,QAAQ;EAER,YAAY,EACV,YAAY,aAAa,UAAU,QACjC,4BACA,+CACF,CAAC,EAAE,QACD,4BACA,+CACF,EACF;CACF;CACA;EACE,QAAQ;EACR,YAAY;GACV,SAAS;GACT,mBAAmB,aAAa;IAC9B,OAAO,UAAU,QACf,iCACA,uFACF;GACF;EACF;CACF;CAKA;EACE,QAAQ;EACR,YAAY;GACV,SAAS;GACT,mFAAmF,aAAa;IAC9F,IAAI,CAAC,UAAU;IACf,OAAO,SAAS,QACd;;;;;;mBAOA;;;;iBAKF;GACF;EACF;CACF;AACF"}
|
|
@@ -291,19 +291,6 @@ const RNV = Platform.constants.reactNativeVersion;
|
|
|
291
291
|
} @finally {`);
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
module: "@react-navigation/native",
|
|
297
|
-
patchFiles: {
|
|
298
|
-
version: "8.0.0-alpha.44",
|
|
299
|
-
"android/src/main/java/org/reactnavigation/MaterialSymbolModule.kt": function(contents) {
|
|
300
|
-
assertString(contents);
|
|
301
|
-
bailIfExists(contents, "reactApplicationContext.currentActivity");
|
|
302
|
-
var patched = contents.replace("colorValue, currentActivity ?: reactApplicationContext", "colorValue, reactApplicationContext.currentActivity ?: reactApplicationContext");
|
|
303
|
-
bailIfUnchanged(patched, contents);
|
|
304
|
-
return patched;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
294
|
}
|
|
308
295
|
];
|
|
309
296
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtInDepPatches.native.js","names":[],"sources":["patches/builtInDepPatches.native.js"],"sourcesContent":["import { assertString } from \"../utils/assert\";\nimport { bailIfExists, bailIfUnchanged } from \"../utils/patches\";\nvar builtInDepPatches = [\n // @react-navigation/core 7.17 renamed createComponentForStaticNavigation to\n // createComponentForStaticConfigDeprecated, breaking @react-navigation/native\n // which still imports the old name. re-export the old name as an alias.\n {\n module: \"@react-navigation/core\",\n patchFiles: {\n version: \">=7.17.0 <8.0.0\",\n \"lib/module/index.js\": function(contents) {\n assertString(contents);\n if (contents.includes(\"createComponentForStaticNavigation\")) return;\n if (!contents.includes(\"createComponentForStaticConfigDeprecated\")) return;\n return contents.replace(/export \\{ createComponentForStaticConfigDeprecated as createComponentForStaticConfig,/, \"export { createComponentForStaticConfigDeprecated as createComponentForStaticConfig, createComponentForStaticConfigDeprecated as createComponentForStaticNavigation,\");\n },\n \"lib/commonjs/index.js\": function(contents) {\n if (!contents) return;\n if (contents.includes(\"createComponentForStaticNavigation\")) return;\n if (!contents.includes(\"createComponentForStaticConfigDeprecated\")) return;\n return contents.replace(/createComponentForStaticConfigDeprecated as createComponentForStaticConfig,/, \"createComponentForStaticConfigDeprecated as createComponentForStaticConfig, createComponentForStaticConfigDeprecated as createComponentForStaticNavigation,\");\n }\n }\n },\n // react-native-maps ships TypeScript source, and every map child component\n // declares the members decorateMapComponent installs on the prototype as\n // definite-assignment class fields (`getNativeComponent!: () => ...`). oxc\n // keeps a field declaration that has no initializer, so constructing the\n // component gives each instance its own `undefined` property that shadows the\n // prototype method, and the first render throws \"this.getNativeComponent is\n // not a function\". babel's loose class properties erase these on native, so\n // only the vite side breaks. oxc ignores useDefineForClassFields, so no\n // tsconfig or oxc option reaches this; `declare` is what the declaration\n // always meant and every transform erases it.\n {\n module: \"react-native-maps\",\n patchFiles: {\n \"src/*.tsx\": function(contents) {\n assertString(contents);\n var patched = contents.replace(/^(\\s*)(context|getNativeComponent|getMapManagerCommand|getUIManagerCommand)!:/gm, \"$1declare $2:\");\n bailIfUnchanged(patched, contents);\n return patched;\n }\n }\n },\n // react-native-web doesn't export unstable_batchedUpdates but react-native does,\n // so libraries like @legendapp/list break when aliased to rnw on web\n {\n module: \"react-native-web\",\n patchFiles: {\n \"dist/index.js\": function(contents) {\n assertString(contents);\n bailIfExists(contents, \"unstable_batchedUpdates\");\n return `${contents}\nexport { unstable_batchedUpdates } from 'react-dom';\n`;\n }\n }\n },\n {\n module: \"react\",\n patchFiles: {\n version: \"18.*\",\n \"compiler-runtime.js\": `module.exports = require('@vxrn/vendor/react-19-compiler-runtime');`,\n \"index.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-19');`,\n \"jsx-dev-runtime.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-jsx-dev-19');`,\n \"jsx-runtime.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-jsx-19');`,\n \"package.json\": function(contents) {\n assertString(contents);\n var pkg = JSON.parse(contents);\n if (pkg.version.startsWith(\"19.\")) {\n return;\n }\n var existingExports = {\n ...pkg.exports\n };\n if (!pkg.exports[\".\"]) {\n throw new Error(`Expected a version of React that has package.json exports defined`);\n }\n pkg.exports[\".\"] = {\n \"react-server\": \"./react.shared-subset.js\",\n \"vxrn-web\": \"./index.vxrn-web.js\",\n default: \"./index.js\"\n };\n pkg.exports[\"./jsx-runtime\"] = {\n \"vxrn-web\": \"./jsx-runtime.vxrn-web.js\",\n default: \"./jsx-runtime.js\"\n };\n pkg.exports[\"./compiler-runtime\"] = {\n default: \"./compiler-runtime.js\"\n };\n pkg.exports[\"./jsx-dev-runtime\"] = {\n \"vxrn-web\": \"./jsx-dev-runtime.vxrn-web.js\",\n default: \"./jsx-dev-runtime.js\"\n };\n bailIfUnchanged(existingExports, pkg.exports);\n return JSON.stringify(pkg, null, 2);\n },\n // for prod builds we have to actually change the entries:\n // to avoid terrible metro we have to eval :(\n \"index.js\": function(contents) {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-19')\")) } else {\n ${contents}\n}`;\n },\n // to avoid terrible metro we have to eval :(\n \"jsx-runtime.js\": function(contents) {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-jsx-19')\")) } else {\n ${contents}\n}`;\n }\n }\n },\n {\n module: \"react-dom\",\n patchFiles: {\n version: \"18.*\",\n // for prod builds we have to actually change the entries:\n \"index.js\": function(contents) {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-dom-19')\")) } else {\n${contents}\n}`;\n },\n \"client.js\": function(contents) {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-dom-client-19')\")) } else {\n${contents}\n}`;\n },\n \"server.browser.js\": function(contents) {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, require('@vxrn/vendor/react-dom-server.browser-19')) } else {\n${contents}\n}`;\n },\n \"client.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-client-19')`,\n \"index.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-19')`,\n \"server.browser.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-server.browser-19')`,\n \"test-utils.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-test-utils-19')`,\n \"package.json\": function(contents) {\n assertString(contents);\n var pkg = JSON.parse(contents);\n if (pkg.version.startsWith(\"19.\")) {\n return;\n }\n var existingExports = {\n ...pkg.exports\n };\n if (!pkg.exports[\".\"]) {\n throw new Error(`Expected a version of React that has package.json exports defined`);\n }\n pkg.exports[\".\"] = {\n \"vxrn-web\": \"./index.vxrn-web.js\",\n default: \"./index.js\"\n };\n pkg.exports[\"./client\"] = {\n \"vxrn-web\": \"./client.vxrn-web.js\",\n default: \"./client.js\"\n };\n pkg.exports[\"./server.browser\"] = {\n \"vxrn-web\": \"./server.browser.vxrn-web.js\",\n default: \"./server.browser.js\"\n };\n pkg.exports[\"./test-utils\"] = {\n \"vxrn-web\": \"./test-utils.vxrn-web.js\",\n default: \"./test-utils.js\"\n };\n bailIfUnchanged(existingExports, pkg.exports);\n return JSON.stringify(pkg, null, 2);\n }\n }\n },\n // Older versions of the cli-config package will not look for `.cjs` files when loading the config. This isn't necessary for v14.x (which comes with RN 0.75). See: https://hackmd.io/@z/SJghMPN6C.\n {\n module: \"@react-native-community/cli-config\",\n patchFiles: {\n version: \">=13.0.0 <16.0.0\",\n \"build/readConfigFromDisk.js\": function(contents) {\n assertString(contents);\n return contents.replace(`['react-native.config.js']`, `['react-native.config.js', 'react-native.config.cjs']`).replace(\"searchPlaces,\", `searchPlaces, loaders: { '.cjs': _cosmiconfig().default.loadJs },`).replace(\"stopDir: rootFolder,\", `stopDir: rootFolder, loaders: { '.cjs': _cosmiconfig().default.loadJs },`);\n }\n }\n },\n {\n module: \"react-native-reanimated\",\n patchFiles: {\n // reanimated 4 ships no JSX in its `.js`. Measured against 4.5.1: all 374\n // files parse with SWC at `jsx: false`, and the only JSX-shaped text is\n // inside comments. The transform still rewrote and reformatted every one\n // of them, which is how a patch aimed at reanimated ended up re-printing\n // its nested `semver` and giving one package@version two contents on\n // disk. Left in place below 4 rather than deleted, because we verified 4\n // and not the 3.x line.\n version: \"<4.0.0\",\n \"**/*.js\": [\n \"jsx\"\n ]\n }\n },\n // fix RNGH crash on RN 0.86+ new architecture\n // getShadowNodeFromRef crashes when findHostInstance_DEPRECATED returns null\n {\n module: \"react-native-gesture-handler\",\n patchFiles: {\n version: \">=3.0.0\",\n \"lib/module/getShadowNodeFromRef.js\": function(contents) {\n return contents === null || contents === void 0 ? void 0 : contents.replace(`const hostInstance = isAlreadyHostInstance ? ref : findHostInstance_DEPRECATED(ref);\n\n // @ts-ignore Fabric\n return getInternalInstanceHandleFromPublicInstance(hostInstance).stateNode.node;`, `const hostInstance = isAlreadyHostInstance ? ref : findHostInstance_DEPRECATED(ref);\n if (hostInstance === null || hostInstance === undefined) {\n return null;\n }\n const internalHandle = getInternalInstanceHandleFromPublicInstance(hostInstance);\n if (internalHandle === null || internalHandle === undefined) {\n return null;\n }\n return internalHandle.stateNode?.node ?? null;`);\n },\n // metro uses src/ directly via \"react-native\" field in package.json\n \"src/getShadowNodeFromRef.ts\": function(contents) {\n return contents === null || contents === void 0 ? void 0 : contents.replace(`const hostInstance = isAlreadyHostInstance\n ? ref\n : findHostInstance_DEPRECATED(ref);\n\n // @ts-ignore Fabric\n return getInternalInstanceHandleFromPublicInstance(hostInstance).stateNode\n .node;`, `const hostInstance = isAlreadyHostInstance\n ? ref\n : findHostInstance_DEPRECATED(ref);\n if (hostInstance === null || hostInstance === undefined) {\n return null;\n }\n const internalHandle = getInternalInstanceHandleFromPublicInstance(hostInstance);\n if (internalHandle === null || internalHandle === undefined) {\n return null;\n }\n return internalHandle.stateNode?.node ?? null;`);\n }\n }\n },\n {\n module: \"@react-native-masked-view/masked-view\",\n patchFiles: {\n \"**/*.js\": [\n \"flow\",\n \"swc\"\n ]\n }\n },\n {\n module: \"react-native-vector-icons\",\n patchFiles: {\n \"**/*.js\": [\n \"jsx\",\n \"flow\"\n ]\n }\n },\n {\n module: \"react-native-webview\",\n patchFiles: {\n \"**/*.js\": [\n \"jsx\"\n ]\n }\n },\n {\n module: \"@react-native/assets-registry\",\n patchFiles: {\n \"**/*.js\": [\n \"flow\"\n ]\n }\n },\n {\n module: \"react-native-css-interop\",\n patchFiles: {\n // 2 of 53 dist files genuinely need JSX parsing, so this one is real.\n //\n // Two sibling patches were removed here, both dead. A `wrap-jsx.js` entry\n // tried to hoist `require(\"./components\")` out of the function so\n // cssInterop registration runs, but `patches.ts` selects with\n // `filePatches.find(relativePath)` and `dist/**/*.js` is declared first,\n // so the glob shadowed it and the hoist never executed once: the patched\n // file on disk still has the require inside the function. A `package.json`\n // entry set `sideEffects` to keep components.js from being tree-shaken,\n // and 0.2.6 already ships exactly that value.\n //\n // So nativewind registration has never actually been hoisted by this\n // patch. Anyone deciding whether to keep the CSS-on-native path should\n // start from that, not from the assumption that it works today.\n \"dist/**/*.js\": [\n \"jsx\"\n ]\n }\n },\n {\n module: \"@sentry/react-native\",\n patchFiles: {\n version: \">=5.6.0\",\n \"dist/**/*.js\": [\n \"jsx\"\n ]\n }\n },\n {\n module: \"@sentry/react-native\",\n patchFiles: {\n version: \">=5.0.0 <5.6.0\",\n \"dist/js/utils/environment.js\": function(contents) {\n assertString(contents);\n return contents.replace(`import { version as RNV } from 'react-native/Libraries/Core/ReactNativeVersion';`, `import { Platform } from 'react-native';\nconst RNV = Platform.constants.reactNativeVersion;\n`);\n },\n \"dist/**/*.js\": [\n \"jsx\"\n ]\n }\n },\n {\n module: \"qrcode\",\n patchFiles: {\n version: \"<=1.5.1\",\n \"lib/server.js\": function(contents) {\n assertString(contents);\n return contents.replace(`const TerminalRenderer = require('./renderer/terminal')`, `const TerminalRenderer = require('./renderer/terminal.js')`);\n }\n }\n },\n {\n module: \"whatwg-url-without-unicode\",\n // https://github.com/onejs/one/issues/258\n patchFiles: {\n \"**/*.js\": function(contents) {\n var _contents_replace;\n return contents === null || contents === void 0 ? void 0 : (_contents_replace = contents.replace(/punycode\\.ucs2\\.decode/gm, \"(punycode.ucs2decode || punycode.ucs2.decode)\")) === null || _contents_replace === void 0 ? void 0 : _contents_replace.replace(/punycode\\.ucs2\\.encode/gm, \"(punycode.ucs2encode || punycode.ucs2.encode)\");\n }\n }\n },\n {\n module: \"@hot-updater/plugin-core\",\n patchFiles: {\n version: \"0.*\",\n \"dist/index.cjs\": function(contents) {\n return contents === null || contents === void 0 ? void 0 : contents.replace('let mime = require(\"mime\");', 'let mime = { getType: () => \"application/octet-stream\", getExtension: () => null };');\n }\n }\n },\n // a void TurboModule method that throws an Obj-C NSException crashes the app\n // when React Native rethrows it on the TurboModule queue. there is no JS\n // caller for an async void method to receive an error, so log it instead.\n // see tests/test/IOS_PROD_CRASH.md\n {\n module: \"react-native\",\n patchFiles: {\n version: \">=0.86.0\",\n \"ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm\": function(contents) {\n if (!contents) return;\n return contents.replace(` @try {\n [inv invokeWithTarget:strongModule];\n } @catch (NSException *exception) {\n // Void methods are always async, re-throw instead of converting to\n // JSError, same as the async branch in performMethodInvocation.\n @throw exception;\n } @finally {`, ` @try {\n [inv invokeWithTarget:strongModule];\n } @catch (NSException *exception) {\n RCTLogError(@\"Exception in %s.%s: %@\", moduleName, methodNameStr.c_str(), exception.reason);\n } @finally {`);\n }\n }\n },\n // react native 0.87 made ReactContextBaseJavaModule a Kotlin class, so the\n // bare `currentActivity` property in @react-navigation/native's MaterialSymbolModule\n // no longer resolves and the Android build fails to compile. upstream alpha.45\n // changed exactly this line; the monorepo stays on alpha.44 because alpha.45\n // also pulls a @react-navigation/core alpha that renames Tabs APIs.\n {\n module: \"@react-navigation/native\",\n patchFiles: {\n version: \"8.0.0-alpha.44\",\n \"android/src/main/java/org/reactnavigation/MaterialSymbolModule.kt\": function(contents) {\n assertString(contents);\n bailIfExists(contents, \"reactApplicationContext.currentActivity\");\n var patched = contents.replace(\"colorValue, currentActivity ?: reactApplicationContext\", \"colorValue, reactApplicationContext.currentActivity ?: reactApplicationContext\");\n bailIfUnchanged(patched, contents);\n return patched;\n }\n }\n }\n];\nexport {\n builtInDepPatches\n};\n//# sourceMappingURL=builtInDepPatches.js.map\n"],"mappings":";;;;AAEA,IAAI,oBAAoB;CAItB;EACE,QAAQ;EACR,YAAY;GACV,SAAS;GACT,uBAAuB,SAAS,UAAU;IACxC,aAAa,QAAQ;IACrB,IAAI,SAAS,SAAS,oCAAoC,GAAG;IAC7D,IAAI,CAAC,SAAS,SAAS,0CAA0C,GAAG;IACpE,OAAO,SAAS,QAAQ,yFAAyF,sKAAsK;GACzR;GACA,yBAAyB,SAAS,UAAU;IAC1C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A+C;EAC1U,EACF;CACF;CACA;EACE,QAAQ;EACR,YAAY;GACV,SAAS;GACT,kBAAkB,SAAS,UAAU;IACnC,OAAO,aAAa,QAAQ,aAAa,KAAK,IAAI,KAAK,IAAI,SAAS,QAAQ,iCAA+B,uFAAqF;GAClM;EACF;CACF;CAKA;EACE,QAAQ;EACR,YAAY;GACV,SAAS;GACT,kFAAkF,SAAS,UAAU;IACnG,IAAI,CAAC,UAAU;IACf,OAAO,SAAS,QAAQ;;;;;;mBAMb;;;;iBAIF;GACX;EACF;CACF;CAMA;EACE,QAAQ;EACR,YAAY;GACV,SAAS;GACT,qEAAqE,SAAS,UAAU;IACtF,aAAa,QAAQ;IACrB,aAAa,UAAU,yCAAyC;IAChE,IAAI,UAAU,SAAS,QAAQ,0DAA0D,gFAAgF;IACzK,gBAAgB,SAAS,QAAQ;IACjC,OAAO;GACT;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"builtInDepPatches.native.js","names":[],"sources":["patches/builtInDepPatches.native.js"],"sourcesContent":["import { assertString } from \"../utils/assert\";\nimport { bailIfExists, bailIfUnchanged } from \"../utils/patches\";\nvar builtInDepPatches = [\n // @react-navigation/core 7.17 renamed createComponentForStaticNavigation to\n // createComponentForStaticConfigDeprecated, breaking @react-navigation/native\n // which still imports the old name. re-export the old name as an alias.\n {\n module: \"@react-navigation/core\",\n patchFiles: {\n version: \">=7.17.0 <8.0.0\",\n \"lib/module/index.js\": function(contents) {\n assertString(contents);\n if (contents.includes(\"createComponentForStaticNavigation\")) return;\n if (!contents.includes(\"createComponentForStaticConfigDeprecated\")) return;\n return contents.replace(/export \\{ createComponentForStaticConfigDeprecated as createComponentForStaticConfig,/, \"export { createComponentForStaticConfigDeprecated as createComponentForStaticConfig, createComponentForStaticConfigDeprecated as createComponentForStaticNavigation,\");\n },\n \"lib/commonjs/index.js\": function(contents) {\n if (!contents) return;\n if (contents.includes(\"createComponentForStaticNavigation\")) return;\n if (!contents.includes(\"createComponentForStaticConfigDeprecated\")) return;\n return contents.replace(/createComponentForStaticConfigDeprecated as createComponentForStaticConfig,/, \"createComponentForStaticConfigDeprecated as createComponentForStaticConfig, createComponentForStaticConfigDeprecated as createComponentForStaticNavigation,\");\n }\n }\n },\n // react-native-maps ships TypeScript source, and every map child component\n // declares the members decorateMapComponent installs on the prototype as\n // definite-assignment class fields (`getNativeComponent!: () => ...`). oxc\n // keeps a field declaration that has no initializer, so constructing the\n // component gives each instance its own `undefined` property that shadows the\n // prototype method, and the first render throws \"this.getNativeComponent is\n // not a function\". babel's loose class properties erase these on native, so\n // only the vite side breaks. oxc ignores useDefineForClassFields, so no\n // tsconfig or oxc option reaches this; `declare` is what the declaration\n // always meant and every transform erases it.\n {\n module: \"react-native-maps\",\n patchFiles: {\n \"src/*.tsx\": function(contents) {\n assertString(contents);\n var patched = contents.replace(/^(\\s*)(context|getNativeComponent|getMapManagerCommand|getUIManagerCommand)!:/gm, \"$1declare $2:\");\n bailIfUnchanged(patched, contents);\n return patched;\n }\n }\n },\n // react-native-web doesn't export unstable_batchedUpdates but react-native does,\n // so libraries like @legendapp/list break when aliased to rnw on web\n {\n module: \"react-native-web\",\n patchFiles: {\n \"dist/index.js\": function(contents) {\n assertString(contents);\n bailIfExists(contents, \"unstable_batchedUpdates\");\n return `${contents}\nexport { unstable_batchedUpdates } from 'react-dom';\n`;\n }\n }\n },\n {\n module: \"react\",\n patchFiles: {\n version: \"18.*\",\n \"compiler-runtime.js\": `module.exports = require('@vxrn/vendor/react-19-compiler-runtime');`,\n \"index.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-19');`,\n \"jsx-dev-runtime.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-jsx-dev-19');`,\n \"jsx-runtime.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-jsx-19');`,\n \"package.json\": function(contents) {\n assertString(contents);\n var pkg = JSON.parse(contents);\n if (pkg.version.startsWith(\"19.\")) {\n return;\n }\n var existingExports = {\n ...pkg.exports\n };\n if (!pkg.exports[\".\"]) {\n throw new Error(`Expected a version of React that has package.json exports defined`);\n }\n pkg.exports[\".\"] = {\n \"react-server\": \"./react.shared-subset.js\",\n \"vxrn-web\": \"./index.vxrn-web.js\",\n default: \"./index.js\"\n };\n pkg.exports[\"./jsx-runtime\"] = {\n \"vxrn-web\": \"./jsx-runtime.vxrn-web.js\",\n default: \"./jsx-runtime.js\"\n };\n pkg.exports[\"./compiler-runtime\"] = {\n default: \"./compiler-runtime.js\"\n };\n pkg.exports[\"./jsx-dev-runtime\"] = {\n \"vxrn-web\": \"./jsx-dev-runtime.vxrn-web.js\",\n default: \"./jsx-dev-runtime.js\"\n };\n bailIfUnchanged(existingExports, pkg.exports);\n return JSON.stringify(pkg, null, 2);\n },\n // for prod builds we have to actually change the entries:\n // to avoid terrible metro we have to eval :(\n \"index.js\": function(contents) {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-19')\")) } else {\n ${contents}\n}`;\n },\n // to avoid terrible metro we have to eval :(\n \"jsx-runtime.js\": function(contents) {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-jsx-19')\")) } else {\n ${contents}\n}`;\n }\n }\n },\n {\n module: \"react-dom\",\n patchFiles: {\n version: \"18.*\",\n // for prod builds we have to actually change the entries:\n \"index.js\": function(contents) {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-dom-19')\")) } else {\n${contents}\n}`;\n },\n \"client.js\": function(contents) {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, eval(\"require('@vxrn/vendor/react-dom-client-19')\")) } else {\n${contents}\n}`;\n },\n \"server.browser.js\": function(contents) {\n assertString(contents);\n return `\nif (process.env.VXRN_REACT_19) { Object.assign(exports, require('@vxrn/vendor/react-dom-server.browser-19')) } else {\n${contents}\n}`;\n },\n \"client.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-client-19')`,\n \"index.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-19')`,\n \"server.browser.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-server.browser-19')`,\n \"test-utils.vxrn-web.js\": `module.exports = require('@vxrn/vendor/react-dom-test-utils-19')`,\n \"package.json\": function(contents) {\n assertString(contents);\n var pkg = JSON.parse(contents);\n if (pkg.version.startsWith(\"19.\")) {\n return;\n }\n var existingExports = {\n ...pkg.exports\n };\n if (!pkg.exports[\".\"]) {\n throw new Error(`Expected a version of React that has package.json exports defined`);\n }\n pkg.exports[\".\"] = {\n \"vxrn-web\": \"./index.vxrn-web.js\",\n default: \"./index.js\"\n };\n pkg.exports[\"./client\"] = {\n \"vxrn-web\": \"./client.vxrn-web.js\",\n default: \"./client.js\"\n };\n pkg.exports[\"./server.browser\"] = {\n \"vxrn-web\": \"./server.browser.vxrn-web.js\",\n default: \"./server.browser.js\"\n };\n pkg.exports[\"./test-utils\"] = {\n \"vxrn-web\": \"./test-utils.vxrn-web.js\",\n default: \"./test-utils.js\"\n };\n bailIfUnchanged(existingExports, pkg.exports);\n return JSON.stringify(pkg, null, 2);\n }\n }\n },\n // Older versions of the cli-config package will not look for `.cjs` files when loading the config. This isn't necessary for v14.x (which comes with RN 0.75). See: https://hackmd.io/@z/SJghMPN6C.\n {\n module: \"@react-native-community/cli-config\",\n patchFiles: {\n version: \">=13.0.0 <16.0.0\",\n \"build/readConfigFromDisk.js\": function(contents) {\n assertString(contents);\n return contents.replace(`['react-native.config.js']`, `['react-native.config.js', 'react-native.config.cjs']`).replace(\"searchPlaces,\", `searchPlaces, loaders: { '.cjs': _cosmiconfig().default.loadJs },`).replace(\"stopDir: rootFolder,\", `stopDir: rootFolder, loaders: { '.cjs': _cosmiconfig().default.loadJs },`);\n }\n }\n },\n {\n module: \"react-native-reanimated\",\n patchFiles: {\n // reanimated 4 ships no JSX in its `.js`. Measured against 4.5.1: all 374\n // files parse with SWC at `jsx: false`, and the only JSX-shaped text is\n // inside comments. The transform still rewrote and reformatted every one\n // of them, which is how a patch aimed at reanimated ended up re-printing\n // its nested `semver` and giving one package@version two contents on\n // disk. Left in place below 4 rather than deleted, because we verified 4\n // and not the 3.x line.\n version: \"<4.0.0\",\n \"**/*.js\": [\n \"jsx\"\n ]\n }\n },\n // fix RNGH crash on RN 0.86+ new architecture\n // getShadowNodeFromRef crashes when findHostInstance_DEPRECATED returns null\n {\n module: \"react-native-gesture-handler\",\n patchFiles: {\n version: \">=3.0.0\",\n \"lib/module/getShadowNodeFromRef.js\": function(contents) {\n return contents === null || contents === void 0 ? void 0 : contents.replace(`const hostInstance = isAlreadyHostInstance ? ref : findHostInstance_DEPRECATED(ref);\n\n // @ts-ignore Fabric\n return getInternalInstanceHandleFromPublicInstance(hostInstance).stateNode.node;`, `const hostInstance = isAlreadyHostInstance ? ref : findHostInstance_DEPRECATED(ref);\n if (hostInstance === null || hostInstance === undefined) {\n return null;\n }\n const internalHandle = getInternalInstanceHandleFromPublicInstance(hostInstance);\n if (internalHandle === null || internalHandle === undefined) {\n return null;\n }\n return internalHandle.stateNode?.node ?? null;`);\n },\n // metro uses src/ directly via \"react-native\" field in package.json\n \"src/getShadowNodeFromRef.ts\": function(contents) {\n return contents === null || contents === void 0 ? void 0 : contents.replace(`const hostInstance = isAlreadyHostInstance\n ? ref\n : findHostInstance_DEPRECATED(ref);\n\n // @ts-ignore Fabric\n return getInternalInstanceHandleFromPublicInstance(hostInstance).stateNode\n .node;`, `const hostInstance = isAlreadyHostInstance\n ? ref\n : findHostInstance_DEPRECATED(ref);\n if (hostInstance === null || hostInstance === undefined) {\n return null;\n }\n const internalHandle = getInternalInstanceHandleFromPublicInstance(hostInstance);\n if (internalHandle === null || internalHandle === undefined) {\n return null;\n }\n return internalHandle.stateNode?.node ?? null;`);\n }\n }\n },\n {\n module: \"@react-native-masked-view/masked-view\",\n patchFiles: {\n \"**/*.js\": [\n \"flow\",\n \"swc\"\n ]\n }\n },\n {\n module: \"react-native-vector-icons\",\n patchFiles: {\n \"**/*.js\": [\n \"jsx\",\n \"flow\"\n ]\n }\n },\n {\n module: \"react-native-webview\",\n patchFiles: {\n \"**/*.js\": [\n \"jsx\"\n ]\n }\n },\n {\n module: \"@react-native/assets-registry\",\n patchFiles: {\n \"**/*.js\": [\n \"flow\"\n ]\n }\n },\n {\n module: \"react-native-css-interop\",\n patchFiles: {\n // 2 of 53 dist files genuinely need JSX parsing, so this one is real.\n //\n // Two sibling patches were removed here, both dead. A `wrap-jsx.js` entry\n // tried to hoist `require(\"./components\")` out of the function so\n // cssInterop registration runs, but `patches.ts` selects with\n // `filePatches.find(relativePath)` and `dist/**/*.js` is declared first,\n // so the glob shadowed it and the hoist never executed once: the patched\n // file on disk still has the require inside the function. A `package.json`\n // entry set `sideEffects` to keep components.js from being tree-shaken,\n // and 0.2.6 already ships exactly that value.\n //\n // So nativewind registration has never actually been hoisted by this\n // patch. Anyone deciding whether to keep the CSS-on-native path should\n // start from that, not from the assumption that it works today.\n \"dist/**/*.js\": [\n \"jsx\"\n ]\n }\n },\n {\n module: \"@sentry/react-native\",\n patchFiles: {\n version: \">=5.6.0\",\n \"dist/**/*.js\": [\n \"jsx\"\n ]\n }\n },\n {\n module: \"@sentry/react-native\",\n patchFiles: {\n version: \">=5.0.0 <5.6.0\",\n \"dist/js/utils/environment.js\": function(contents) {\n assertString(contents);\n return contents.replace(`import { version as RNV } from 'react-native/Libraries/Core/ReactNativeVersion';`, `import { Platform } from 'react-native';\nconst RNV = Platform.constants.reactNativeVersion;\n`);\n },\n \"dist/**/*.js\": [\n \"jsx\"\n ]\n }\n },\n {\n module: \"qrcode\",\n patchFiles: {\n version: \"<=1.5.1\",\n \"lib/server.js\": function(contents) {\n assertString(contents);\n return contents.replace(`const TerminalRenderer = require('./renderer/terminal')`, `const TerminalRenderer = require('./renderer/terminal.js')`);\n }\n }\n },\n {\n module: \"whatwg-url-without-unicode\",\n // https://github.com/onejs/one/issues/258\n patchFiles: {\n \"**/*.js\": function(contents) {\n var _contents_replace;\n return contents === null || contents === void 0 ? void 0 : (_contents_replace = contents.replace(/punycode\\.ucs2\\.decode/gm, \"(punycode.ucs2decode || punycode.ucs2.decode)\")) === null || _contents_replace === void 0 ? void 0 : _contents_replace.replace(/punycode\\.ucs2\\.encode/gm, \"(punycode.ucs2encode || punycode.ucs2.encode)\");\n }\n }\n },\n {\n module: \"@hot-updater/plugin-core\",\n patchFiles: {\n version: \"0.*\",\n \"dist/index.cjs\": function(contents) {\n return contents === null || contents === void 0 ? void 0 : contents.replace('let mime = require(\"mime\");', 'let mime = { getType: () => \"application/octet-stream\", getExtension: () => null };');\n }\n }\n },\n // a void TurboModule method that throws an Obj-C NSException crashes the app\n // when React Native rethrows it on the TurboModule queue. there is no JS\n // caller for an async void method to receive an error, so log it instead.\n // see tests/test/IOS_PROD_CRASH.md\n {\n module: \"react-native\",\n patchFiles: {\n version: \">=0.86.0\",\n \"ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm\": function(contents) {\n if (!contents) return;\n return contents.replace(` @try {\n [inv invokeWithTarget:strongModule];\n } @catch (NSException *exception) {\n // Void methods are always async, re-throw instead of converting to\n // JSError, same as the async branch in performMethodInvocation.\n @throw exception;\n } @finally {`, ` @try {\n [inv invokeWithTarget:strongModule];\n } @catch (NSException *exception) {\n RCTLogError(@\"Exception in %s.%s: %@\", moduleName, methodNameStr.c_str(), exception.reason);\n } @finally {`);\n }\n }\n }\n];\nexport {\n builtInDepPatches\n};\n//# sourceMappingURL=builtInDepPatches.js.map\n"],"mappings":";;;;AAEA,IAAI,oBAAoB;CAItB;EACE,QAAQ;EACR,YAAY;GACV,SAAS;GACT,uBAAuB,SAAS,UAAU;IACxC,aAAa,QAAQ;IACrB,IAAI,SAAS,SAAS,oCAAoC,GAAG;IAC7D,IAAI,CAAC,SAAS,SAAS,0CAA0C,GAAG;IACpE,OAAO,SAAS,QAAQ,yFAAyF,sKAAsK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AAK,IAAI,kBAAkB,QAAQ,4BAA4B,+CAA+C;EAC1U,EACF;CACF;CACA;EACE,QAAQ;EACR,YAAY;GACV,SAAS;GACT,kBAAkB,SAAS,UAAU;IACnC,OAAO,aAAa,QAAQ,aAAa,KAAK,IAAI,KAAK,IAAI,SAAS,QAAQ,iCAA+B,uFAAqF;GAClM;EACF;CACF;CAKA;EACE,QAAQ;EACR,YAAY;GACV,SAAS;GACT,kFAAkF,SAAS,UAAU;IACnG,IAAI,CAAC,UAAU;IACf,OAAO,SAAS,QAAQ;;;;;;mBAMb;;;;iBAIF;GACX;EACF;CACF;AACF"}
|
|
@@ -51,7 +51,7 @@ async function getScannedOptimizeDepsConfig(props) {
|
|
|
51
51
|
include: filteredDeps,
|
|
52
52
|
exclude: EXCLUDE_LIST
|
|
53
53
|
},
|
|
54
|
-
noExternal: filteredDeps
|
|
54
|
+
noExternal: [...filteredDeps, ...result.noExternalDeps.filter((dep) => !excludeSet.has(dep))]
|
|
55
55
|
} };
|
|
56
56
|
}
|
|
57
57
|
let sessionCacheVal = null;
|
|
@@ -67,6 +67,7 @@ async function findDepsToOptimize({ root, mode, exclude, include }) {
|
|
|
67
67
|
"yarn.lock",
|
|
68
68
|
"package-lock.json",
|
|
69
69
|
"pnpm-lock.yaml",
|
|
70
|
+
"bun.lock",
|
|
70
71
|
"bun.lockb"
|
|
71
72
|
]);
|
|
72
73
|
const lockFileHash = lockFile ? await getFileHash(lockFile) : void 0;
|
|
@@ -74,7 +75,7 @@ async function findDepsToOptimize({ root, mode, exclude, include }) {
|
|
|
74
75
|
if (lockFileHash && !noCache) {
|
|
75
76
|
try {
|
|
76
77
|
const { lockFileHash: cachedLockFileHash, depsToPreBundleForSsr: cachedDepsToPreBundle } = await FSExtra.readJSON(cacheFilePath);
|
|
77
|
-
if (lockFileHash === cachedLockFileHash && !!cachedDepsToPreBundle && "prebundleDeps" in cachedDepsToPreBundle) {
|
|
78
|
+
if (lockFileHash === cachedLockFileHash && !!cachedDepsToPreBundle && "prebundleDeps" in cachedDepsToPreBundle && Array.isArray(cachedDepsToPreBundle.noExternalDeps)) {
|
|
78
79
|
value = cachedDepsToPreBundle;
|
|
79
80
|
debug?.(`Using cached scan results from ${cacheFilePath}`);
|
|
80
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoDepOptimizePlugin.js","names":[],"sources":["plugins/autoDepOptimizePlugin.js"],"sourcesContent":["import { createDebugger } from \"@vxrn/debug\";\nimport FSExtra from \"fs-extra\";\nimport path from \"node:path\";\nimport { createFilter } from \"vite\";\nimport {\n EXCLUDE_LIST,\n scanDepsToOptimize\n} from \"../utils/scanDepsToOptimize\";\nimport { getFileHash, lookupFile } from \"../utils/utils\";\nimport { getCacheDir } from \"../utils/getCacheDir\";\nconst name = \"vxrn:auto-dep-optimize\";\nconst { debug, debugDetails } = createDebugger(name);\nfunction autoDepOptimizePlugin(props) {\n return {\n name,\n enforce: \"pre\",\n async config(cfg, env) {\n debug?.(\"Config hook called\");\n const userOptions = globalThis.__oneOptions;\n const depsConfig = userOptions?.deps;\n const exclude = depsConfig ? Object.entries(depsConfig).filter(([_, value]) => value === false).map(([k]) => k) : [];\n const userExcludes = Array.isArray(props.exclude) ? props.exclude : [props.exclude];\n const userViteExcludes = cfg.optimizeDeps?.exclude || [];\n const userSsrExcludes = cfg.ssr?.optimizeDeps?.exclude || [];\n const finalConfig = await getScannedOptimizeDepsConfig({\n ...props,\n mode: env.mode,\n exclude: [\n ...exclude,\n ...userExcludes,\n ...userViteExcludes,\n ...userSsrExcludes\n ].filter(Boolean)\n });\n debugDetails?.(\n `Final auto-dep-optimize config: ${JSON.stringify(finalConfig, null, 2)}\nfrom props: ${JSON.stringify(props)}`\n );\n return finalConfig;\n }\n };\n}\nconst getSSRExternalsCachePath = (root) => {\n return path.join(getCacheDir(root), \"deps-to-pre-bundle-for-ssr-cache.json\");\n};\nasync function getScannedOptimizeDepsConfig(props) {\n const result = await findDepsToOptimize(props);\n props.onScannedDeps?.(result);\n const excludeArray = Array.isArray(props.exclude) ? props.exclude : [props.exclude];\n const excludeStrings = excludeArray.filter((e) => typeof e === \"string\");\n const excludeSet = new Set(excludeStrings);\n const filteredDeps = result.prebundleDeps.filter((dep) => !excludeSet.has(dep));\n return {\n ssr: {\n optimizeDeps: {\n include: filteredDeps,\n exclude: EXCLUDE_LIST\n },\n noExternal: filteredDeps\n }\n };\n}\nlet sessionCacheVal = null;\nasync function findDepsToOptimize({\n root,\n mode,\n exclude,\n include\n}) {\n const cacheFilePath = getSSRExternalsCachePath(root);\n const startedAt = debug ? Date.now() : 0;\n const noCache = mode === \"production\";\n const sessionCache = mode === \"production\";\n if (sessionCache && sessionCacheVal) {\n return sessionCacheVal;\n }\n const lockFile = await lookupFile(root, [\n \"yarn.lock\",\n \"package-lock.json\",\n \"pnpm-lock.yaml\",\n \"bun.lockb\"\n ]);\n const lockFileHash = lockFile ? await getFileHash(lockFile) : void 0;\n let value;\n if (lockFileHash && !noCache) {\n try {\n const {\n lockFileHash: cachedLockFileHash,\n depsToPreBundleForSsr: cachedDepsToPreBundle\n } = await FSExtra.readJSON(cacheFilePath);\n if (lockFileHash === cachedLockFileHash && !!cachedDepsToPreBundle && \"prebundleDeps\" in cachedDepsToPreBundle) {\n value = cachedDepsToPreBundle;\n debug?.(`Using cached scan results from ${cacheFilePath}`);\n }\n } catch (err) {\n debug?.(`${err}`);\n }\n }\n const filter = createFilter(include, exclude);\n if (!value) {\n value = await scanDepsToOptimize(`${root}/package.json`, { filter });\n if (sessionCache) {\n sessionCacheVal = value;\n }\n if (!noCache) {\n void FSExtra.outputJSON(cacheFilePath, {\n lockFileHash,\n depsToPreBundleForSsr: value\n });\n }\n }\n debug?.(`Scanning completed in ${Date.now() - startedAt}ms`);\n debug?.(\n `${value.prebundleDeps.length} deps are discovered and will be pre-bundled for SSR.` + (debugDetails ? \"\" : ` (Focus on this debug scope, \"DEBUG=${debug.namespace}\", to see more details.)`)\n );\n debugDetails?.(\n `Deps discovered to be pre-bundled for SSR: ${value.prebundleDeps.join(\", \")}`\n );\n return value;\n}\nexport {\n autoDepOptimizePlugin,\n findDepsToOptimize,\n getSSRExternalsCachePath,\n getScannedOptimizeDepsConfig\n};\n//# sourceMappingURL=autoDepOptimizePlugin.js.map\n"],"mappings":";;;;;;;;;AAUA,MAAM,OAAO;AACb,MAAM,EAAE,OAAO,iBAAiB,eAAe,IAAI;AACnD,SAAS,sBAAsB,OAAO;CACpC,OAAO;EACL;EACA,SAAS;EACT,MAAM,OAAO,KAAK,KAAK;GACrB,QAAQ,oBAAoB;GAC5B,MAAM,cAAc,WAAW;GAC/B,MAAM,aAAa,aAAa;GAChC,MAAM,UAAU,aAAa,OAAO,QAAQ,UAAU,CAAC,CAAC,QAAQ,CAAC,GAAG,WAAW,UAAU,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;GACnH,MAAM,eAAe,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,UAAU,CAAC,MAAM,OAAO;GAClF,MAAM,mBAAmB,IAAI,cAAc,WAAW,CAAC;GACvD,MAAM,kBAAkB,IAAI,KAAK,cAAc,WAAW,CAAC;GAC3D,MAAM,cAAc,MAAM,6BAA6B;IACrD,GAAG;IACH,MAAM,IAAI;IACV,SAAS;KACP,GAAG;KACH,GAAG;KACH,GAAG;KACH,GAAG;IACL,CAAC,CAAC,OAAO,OAAO;GAClB,CAAC;GACD,eACE,mCAAmC,KAAK,UAAU,aAAa,MAAM,CAAC,EAAE;cAClE,KAAK,UAAU,KAAK,GAC5B;GACA,OAAO;EACT;CACF;AACF;AACA,MAAM,4BAA4B,SAAS;CACzC,OAAO,KAAK,KAAK,YAAY,IAAI,GAAG,uCAAuC;AAC7E;AACA,eAAe,6BAA6B,OAAO;CACjD,MAAM,SAAS,MAAM,mBAAmB,KAAK;CAC7C,MAAM,gBAAgB,MAAM;CAC5B,MAAM,eAAe,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,UAAU,CAAC,MAAM,OAAO;CAClF,MAAM,iBAAiB,aAAa,QAAQ,MAAM,OAAO,MAAM,QAAQ;CACvE,MAAM,aAAa,IAAI,IAAI,cAAc;CACzC,MAAM,eAAe,OAAO,cAAc,QAAQ,QAAQ,CAAC,WAAW,IAAI,GAAG,CAAC;CAC9E,OAAO,EACL,KAAK;EACH,cAAc;GACZ,SAAS;GACT,SAAS;EACX;EACA,YAAY;
|
|
1
|
+
{"version":3,"file":"autoDepOptimizePlugin.js","names":[],"sources":["plugins/autoDepOptimizePlugin.js"],"sourcesContent":["import { createDebugger } from \"@vxrn/debug\";\nimport FSExtra from \"fs-extra\";\nimport path from \"node:path\";\nimport { createFilter } from \"vite\";\nimport {\n EXCLUDE_LIST,\n scanDepsToOptimize\n} from \"../utils/scanDepsToOptimize\";\nimport { getFileHash, lookupFile } from \"../utils/utils\";\nimport { getCacheDir } from \"../utils/getCacheDir\";\nconst name = \"vxrn:auto-dep-optimize\";\nconst { debug, debugDetails } = createDebugger(name);\nfunction autoDepOptimizePlugin(props) {\n return {\n name,\n enforce: \"pre\",\n async config(cfg, env) {\n debug?.(\"Config hook called\");\n const userOptions = globalThis.__oneOptions;\n const depsConfig = userOptions?.deps;\n const exclude = depsConfig ? Object.entries(depsConfig).filter(([_, value]) => value === false).map(([k]) => k) : [];\n const userExcludes = Array.isArray(props.exclude) ? props.exclude : [props.exclude];\n const userViteExcludes = cfg.optimizeDeps?.exclude || [];\n const userSsrExcludes = cfg.ssr?.optimizeDeps?.exclude || [];\n const finalConfig = await getScannedOptimizeDepsConfig({\n ...props,\n mode: env.mode,\n exclude: [\n ...exclude,\n ...userExcludes,\n ...userViteExcludes,\n ...userSsrExcludes\n ].filter(Boolean)\n });\n debugDetails?.(\n `Final auto-dep-optimize config: ${JSON.stringify(finalConfig, null, 2)}\nfrom props: ${JSON.stringify(props)}`\n );\n return finalConfig;\n }\n };\n}\nconst getSSRExternalsCachePath = (root) => {\n return path.join(getCacheDir(root), \"deps-to-pre-bundle-for-ssr-cache.json\");\n};\nasync function getScannedOptimizeDepsConfig(props) {\n const result = await findDepsToOptimize(props);\n props.onScannedDeps?.(result);\n const excludeArray = Array.isArray(props.exclude) ? props.exclude : [props.exclude];\n const excludeStrings = excludeArray.filter((e) => typeof e === \"string\");\n const excludeSet = new Set(excludeStrings);\n const filteredDeps = result.prebundleDeps.filter((dep) => !excludeSet.has(dep));\n return {\n ssr: {\n optimizeDeps: {\n include: filteredDeps,\n exclude: EXCLUDE_LIST\n },\n noExternal: [\n ...filteredDeps,\n ...result.noExternalDeps.filter((dep) => !excludeSet.has(dep))\n ]\n }\n };\n}\nlet sessionCacheVal = null;\nasync function findDepsToOptimize({\n root,\n mode,\n exclude,\n include\n}) {\n const cacheFilePath = getSSRExternalsCachePath(root);\n const startedAt = debug ? Date.now() : 0;\n const noCache = mode === \"production\";\n const sessionCache = mode === \"production\";\n if (sessionCache && sessionCacheVal) {\n return sessionCacheVal;\n }\n const lockFile = await lookupFile(root, [\n \"yarn.lock\",\n \"package-lock.json\",\n \"pnpm-lock.yaml\",\n \"bun.lock\",\n \"bun.lockb\"\n ]);\n const lockFileHash = lockFile ? await getFileHash(lockFile) : void 0;\n let value;\n if (lockFileHash && !noCache) {\n try {\n const {\n lockFileHash: cachedLockFileHash,\n depsToPreBundleForSsr: cachedDepsToPreBundle\n } = await FSExtra.readJSON(cacheFilePath);\n if (lockFileHash === cachedLockFileHash && !!cachedDepsToPreBundle && \"prebundleDeps\" in cachedDepsToPreBundle && Array.isArray(cachedDepsToPreBundle.noExternalDeps)) {\n value = cachedDepsToPreBundle;\n debug?.(`Using cached scan results from ${cacheFilePath}`);\n }\n } catch (err) {\n debug?.(`${err}`);\n }\n }\n const filter = createFilter(include, exclude);\n if (!value) {\n value = await scanDepsToOptimize(`${root}/package.json`, { filter });\n if (sessionCache) {\n sessionCacheVal = value;\n }\n if (!noCache) {\n void FSExtra.outputJSON(cacheFilePath, {\n lockFileHash,\n depsToPreBundleForSsr: value\n });\n }\n }\n debug?.(`Scanning completed in ${Date.now() - startedAt}ms`);\n debug?.(\n `${value.prebundleDeps.length} deps are discovered and will be pre-bundled for SSR.` + (debugDetails ? \"\" : ` (Focus on this debug scope, \"DEBUG=${debug.namespace}\", to see more details.)`)\n );\n debugDetails?.(\n `Deps discovered to be pre-bundled for SSR: ${value.prebundleDeps.join(\", \")}`\n );\n return value;\n}\nexport {\n autoDepOptimizePlugin,\n findDepsToOptimize,\n getSSRExternalsCachePath,\n getScannedOptimizeDepsConfig\n};\n//# sourceMappingURL=autoDepOptimizePlugin.js.map\n"],"mappings":";;;;;;;;;AAUA,MAAM,OAAO;AACb,MAAM,EAAE,OAAO,iBAAiB,eAAe,IAAI;AACnD,SAAS,sBAAsB,OAAO;CACpC,OAAO;EACL;EACA,SAAS;EACT,MAAM,OAAO,KAAK,KAAK;GACrB,QAAQ,oBAAoB;GAC5B,MAAM,cAAc,WAAW;GAC/B,MAAM,aAAa,aAAa;GAChC,MAAM,UAAU,aAAa,OAAO,QAAQ,UAAU,CAAC,CAAC,QAAQ,CAAC,GAAG,WAAW,UAAU,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;GACnH,MAAM,eAAe,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,UAAU,CAAC,MAAM,OAAO;GAClF,MAAM,mBAAmB,IAAI,cAAc,WAAW,CAAC;GACvD,MAAM,kBAAkB,IAAI,KAAK,cAAc,WAAW,CAAC;GAC3D,MAAM,cAAc,MAAM,6BAA6B;IACrD,GAAG;IACH,MAAM,IAAI;IACV,SAAS;KACP,GAAG;KACH,GAAG;KACH,GAAG;KACH,GAAG;IACL,CAAC,CAAC,OAAO,OAAO;GAClB,CAAC;GACD,eACE,mCAAmC,KAAK,UAAU,aAAa,MAAM,CAAC,EAAE;cAClE,KAAK,UAAU,KAAK,GAC5B;GACA,OAAO;EACT;CACF;AACF;AACA,MAAM,4BAA4B,SAAS;CACzC,OAAO,KAAK,KAAK,YAAY,IAAI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MAAM,SAAS,aAAa,SAAS,OAAO;CAC5C,IAAI,CAAC,OAAO;EACV,QAAQ,MAAM,mBAAmB,GAAG,KAAK,gBAAgB,EAAE,OAAO,CAAC;EACnE,IAAI,cAAc;GAChB,kBAAkB;EACpB;EACA,IAAI,CAAC,SAAS;GACZ,KAAK,QAAQ,WAAW,eAAe;IACrC;IACA,uBAAuB;GACzB,CAAC;EACH;CACF;CACA,QAAQ,yBAAyB,KAAK,IAAI,IAAI,UAAU,GAAG;CAC3D,QACE,GAAG,MAAM,cAAc,OAAO,0DAA0D,eAAe,KAAK,uCAAuC,MAAM,UAAU,0BACrK;CACA,eACE,8CAA8C,MAAM,cAAc,KAAK,IAAI,GAC7E;CACA,OAAO;AACT"}
|
|
@@ -43,7 +43,7 @@ from props: ${JSON.stringify(props)}`);
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
var getSSRExternalsCachePath = function(root) {
|
|
46
|
+
var getSSRExternalsCachePath = function getSSRExternalsCachePath2(root) {
|
|
47
47
|
return path.join(getCacheDir(root), "deps-to-pre-bundle-for-ssr-cache.json");
|
|
48
48
|
};
|
|
49
49
|
async function getScannedOptimizeDepsConfig(props) {
|
|
@@ -63,7 +63,9 @@ async function getScannedOptimizeDepsConfig(props) {
|
|
|
63
63
|
include: filteredDeps,
|
|
64
64
|
exclude: EXCLUDE_LIST
|
|
65
65
|
},
|
|
66
|
-
noExternal: filteredDeps
|
|
66
|
+
noExternal: [...filteredDeps, ...result.noExternalDeps.filter(function(dep) {
|
|
67
|
+
return !excludeSet.has(dep);
|
|
68
|
+
})]
|
|
67
69
|
} };
|
|
68
70
|
}
|
|
69
71
|
var sessionCacheVal = null;
|
|
@@ -80,6 +82,7 @@ async function findDepsToOptimize(param) {
|
|
|
80
82
|
"yarn.lock",
|
|
81
83
|
"package-lock.json",
|
|
82
84
|
"pnpm-lock.yaml",
|
|
85
|
+
"bun.lock",
|
|
83
86
|
"bun.lockb"
|
|
84
87
|
]);
|
|
85
88
|
var lockFileHash = lockFile ? await getFileHash(lockFile) : void 0;
|
|
@@ -87,7 +90,7 @@ async function findDepsToOptimize(param) {
|
|
|
87
90
|
if (lockFileHash && !noCache) {
|
|
88
91
|
try {
|
|
89
92
|
var { lockFileHash: cachedLockFileHash, depsToPreBundleForSsr: cachedDepsToPreBundle } = await FSExtra.readJSON(cacheFilePath);
|
|
90
|
-
if (lockFileHash === cachedLockFileHash && !!cachedDepsToPreBundle && "prebundleDeps" in cachedDepsToPreBundle) {
|
|
93
|
+
if (lockFileHash === cachedLockFileHash && !!cachedDepsToPreBundle && "prebundleDeps" in cachedDepsToPreBundle && Array.isArray(cachedDepsToPreBundle.noExternalDeps)) {
|
|
91
94
|
value = cachedDepsToPreBundle;
|
|
92
95
|
debug === null || debug === void 0 ? void 0 : debug(`Using cached scan results from ${cacheFilePath}`);
|
|
93
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoDepOptimizePlugin.native.js","names":[],"sources":["plugins/autoDepOptimizePlugin.native.js"],"sourcesContent":["import { createDebugger } from \"@vxrn/debug\";\nimport FSExtra from \"fs-extra\";\nimport path from \"path\";\nimport { createFilter } from \"vite\";\nimport { EXCLUDE_LIST, scanDepsToOptimize } from \"../utils/scanDepsToOptimize\";\nimport { getFileHash, lookupFile } from \"../utils/utils\";\nimport { getCacheDir } from \"../utils/getCacheDir\";\nvar name = \"vxrn:auto-dep-optimize\";\nvar { debug, debugDetails } = createDebugger(name);\nfunction autoDepOptimizePlugin(props) {\n return {\n name,\n enforce: \"pre\",\n async config(cfg, env) {\n var _cfg_optimizeDeps, _cfg_ssr_optimizeDeps, _cfg_ssr;\n debug === null || debug === void 0 ? void 0 : debug(\"Config hook called\");\n var userOptions = globalThis.__oneOptions;\n var depsConfig = userOptions === null || userOptions === void 0 ? void 0 : userOptions.deps;\n var exclude = depsConfig ? Object.entries(depsConfig).filter(function(param) {\n var [_, value] = param;\n return value === false;\n }).map(function(param) {\n var [k] = param;\n return k;\n }) : [];\n var userExcludes = Array.isArray(props.exclude) ? props.exclude : [\n props.exclude\n ];\n var userViteExcludes = ((_cfg_optimizeDeps = cfg.optimizeDeps) === null || _cfg_optimizeDeps === void 0 ? void 0 : _cfg_optimizeDeps.exclude) || [];\n var userSsrExcludes = ((_cfg_ssr = cfg.ssr) === null || _cfg_ssr === void 0 ? void 0 : (_cfg_ssr_optimizeDeps = _cfg_ssr.optimizeDeps) === null || _cfg_ssr_optimizeDeps === void 0 ? void 0 : _cfg_ssr_optimizeDeps.exclude) || [];\n var finalConfig = await getScannedOptimizeDepsConfig({\n ...props,\n mode: env.mode,\n exclude: [\n ...exclude,\n ...userExcludes,\n ...userViteExcludes,\n ...userSsrExcludes\n ].filter(Boolean)\n });\n debugDetails === null || debugDetails === void 0 ? void 0 : debugDetails(`Final auto-dep-optimize config: ${JSON.stringify(finalConfig, null, 2)}\nfrom props: ${JSON.stringify(props)}`);\n return finalConfig;\n }\n };\n}\nvar getSSRExternalsCachePath = function(root) {\n return path.join(getCacheDir(root), \"deps-to-pre-bundle-for-ssr-cache.json\");\n};\nasync function getScannedOptimizeDepsConfig(props) {\n var _props_onScannedDeps;\n var result = await findDepsToOptimize(props);\n (_props_onScannedDeps = props.onScannedDeps) === null || _props_onScannedDeps === void 0 ? void 0 : _props_onScannedDeps.call(props, result);\n var excludeArray = Array.isArray(props.exclude) ? props.exclude : [\n props.exclude\n ];\n var excludeStrings = excludeArray.filter(function(e) {\n return typeof e === \"string\";\n });\n var excludeSet = new Set(excludeStrings);\n var filteredDeps = result.prebundleDeps.filter(function(dep) {\n return !excludeSet.has(dep);\n });\n return {\n ssr: {\n optimizeDeps: {\n include: filteredDeps,\n exclude: EXCLUDE_LIST\n },\n noExternal: filteredDeps\n }\n };\n}\nvar sessionCacheVal = null;\nasync function findDepsToOptimize(param) {\n var { root, mode, exclude, include } = param;\n var cacheFilePath = getSSRExternalsCachePath(root);\n var startedAt = debug ? Date.now() : 0;\n var noCache = mode === \"production\";\n var sessionCache = mode === \"production\";\n if (sessionCache && sessionCacheVal) {\n return sessionCacheVal;\n }\n var lockFile = await lookupFile(root, [\n \"yarn.lock\",\n \"package-lock.json\",\n \"pnpm-lock.yaml\",\n \"bun.lockb\"\n ]);\n var lockFileHash = lockFile ? await getFileHash(lockFile) : void 0;\n var value;\n if (lockFileHash && !noCache) {\n try {\n var { lockFileHash: cachedLockFileHash, depsToPreBundleForSsr: cachedDepsToPreBundle } = await FSExtra.readJSON(cacheFilePath);\n if (lockFileHash === cachedLockFileHash && !!cachedDepsToPreBundle && \"prebundleDeps\" in cachedDepsToPreBundle) {\n value = cachedDepsToPreBundle;\n debug === null || debug === void 0 ? void 0 : debug(`Using cached scan results from ${cacheFilePath}`);\n }\n } catch (err) {\n debug === null || debug === void 0 ? void 0 : debug(`${err}`);\n }\n }\n var filter = createFilter(include, exclude);\n if (!value) {\n value = await scanDepsToOptimize(`${root}/package.json`, {\n filter\n });\n if (sessionCache) {\n sessionCacheVal = value;\n }\n if (!noCache) {\n void FSExtra.outputJSON(cacheFilePath, {\n lockFileHash,\n depsToPreBundleForSsr: value\n });\n }\n }\n debug === null || debug === void 0 ? void 0 : debug(`Scanning completed in ${Date.now() - startedAt}ms`);\n debug === null || debug === void 0 ? void 0 : debug(`${value.prebundleDeps.length} deps are discovered and will be pre-bundled for SSR.` + (debugDetails ? \"\" : ` (Focus on this debug scope, \"DEBUG=${debug.namespace}\", to see more details.)`));\n debugDetails === null || debugDetails === void 0 ? void 0 : debugDetails(`Deps discovered to be pre-bundled for SSR: ${value.prebundleDeps.join(\", \")}`);\n return value;\n}\nexport {\n autoDepOptimizePlugin,\n findDepsToOptimize,\n getSSRExternalsCachePath,\n getScannedOptimizeDepsConfig\n};\n//# sourceMappingURL=autoDepOptimizePlugin.js.map\n"],"mappings":";;;;;;;;;AAOA,IAAI,OAAO;AACX,IAAI,EAAE,OAAO,iBAAiB,eAAe,IAAI;AACjD,SAAS,sBAAsB,OAAO;CACpC,OA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],"sourcesContent":["import { createDebugger } from \"@vxrn/debug\";\nimport FSExtra from \"fs-extra\";\nimport path from \"path\";\nimport { createFilter } from \"vite\";\nimport { EXCLUDE_LIST, scanDepsToOptimize } from \"../utils/scanDepsToOptimize\";\nimport { getFileHash, lookupFile } from \"../utils/utils\";\nimport { getCacheDir } from \"../utils/getCacheDir\";\nvar name = \"vxrn:auto-dep-optimize\";\nvar { debug, debugDetails } = createDebugger(name);\nfunction autoDepOptimizePlugin(props) {\n return {\n name,\n enforce: \"pre\",\n async config(cfg, env) {\n var _cfg_optimizeDeps, _cfg_ssr_optimizeDeps, _cfg_ssr;\n debug === null || debug === void 0 ? void 0 : debug(\"Config hook called\");\n var userOptions = globalThis.__oneOptions;\n var depsConfig = userOptions === null || userOptions === void 0 ? void 0 : userOptions.deps;\n var exclude = depsConfig ? Object.entries(depsConfig).filter(function(param) {\n var [_, value] = param;\n return value === false;\n }).map(function(param) {\n var [k] = param;\n return k;\n }) : [];\n var userExcludes = Array.isArray(props.exclude) ? props.exclude : [\n props.exclude\n ];\n var userViteExcludes = ((_cfg_optimizeDeps = cfg.optimizeDeps) === null || _cfg_optimizeDeps === void 0 ? void 0 : _cfg_optimizeDeps.exclude) || [];\n var userSsrExcludes = ((_cfg_ssr = cfg.ssr) === null || _cfg_ssr === void 0 ? void 0 : (_cfg_ssr_optimizeDeps = _cfg_ssr.optimizeDeps) === null || _cfg_ssr_optimizeDeps === void 0 ? void 0 : _cfg_ssr_optimizeDeps.exclude) || [];\n var finalConfig = await getScannedOptimizeDepsConfig({\n ...props,\n mode: env.mode,\n exclude: [\n ...exclude,\n ...userExcludes,\n ...userViteExcludes,\n ...userSsrExcludes\n ].filter(Boolean)\n });\n debugDetails === null || debugDetails === void 0 ? void 0 : debugDetails(`Final auto-dep-optimize config: ${JSON.stringify(finalConfig, null, 2)}\nfrom props: ${JSON.stringify(props)}`);\n return finalConfig;\n }\n };\n}\nvar getSSRExternalsCachePath = function getSSRExternalsCachePath2(root) {\n return path.join(getCacheDir(root), \"deps-to-pre-bundle-for-ssr-cache.json\");\n};\nasync function getScannedOptimizeDepsConfig(props) {\n var _props_onScannedDeps;\n var result = await findDepsToOptimize(props);\n (_props_onScannedDeps = props.onScannedDeps) === null || _props_onScannedDeps === void 0 ? void 0 : _props_onScannedDeps.call(props, result);\n var excludeArray = Array.isArray(props.exclude) ? props.exclude : [\n props.exclude\n ];\n var excludeStrings = excludeArray.filter(function(e) {\n return typeof e === \"string\";\n });\n var excludeSet = new Set(excludeStrings);\n var filteredDeps = result.prebundleDeps.filter(function(dep) {\n return !excludeSet.has(dep);\n });\n return {\n ssr: {\n optimizeDeps: {\n include: filteredDeps,\n exclude: EXCLUDE_LIST\n },\n noExternal: [\n ...filteredDeps,\n ...result.noExternalDeps.filter(function(dep) {\n return !excludeSet.has(dep);\n })\n ]\n }\n };\n}\nvar sessionCacheVal = null;\nasync function findDepsToOptimize(param) {\n var { root, mode, exclude, include } = param;\n var cacheFilePath = getSSRExternalsCachePath(root);\n var startedAt = debug ? Date.now() : 0;\n var noCache = mode === \"production\";\n var sessionCache = mode === \"production\";\n if (sessionCache && sessionCacheVal) {\n return sessionCacheVal;\n }\n var lockFile = await lookupFile(root, [\n \"yarn.lock\",\n \"package-lock.json\",\n \"pnpm-lock.yaml\",\n \"bun.lock\",\n \"bun.lockb\"\n ]);\n var lockFileHash = lockFile ? await getFileHash(lockFile) : void 0;\n var value;\n if (lockFileHash && !noCache) {\n try {\n var { lockFileHash: cachedLockFileHash, depsToPreBundleForSsr: cachedDepsToPreBundle } = await FSExtra.readJSON(cacheFilePath);\n if (lockFileHash === cachedLockFileHash && !!cachedDepsToPreBundle && \"prebundleDeps\" in cachedDepsToPreBundle && Array.isArray(cachedDepsToPreBundle.noExternalDeps)) {\n value = cachedDepsToPreBundle;\n debug === null || debug === void 0 ? void 0 : debug(`Using cached scan results from ${cacheFilePath}`);\n }\n } catch (err) {\n debug === null || debug === void 0 ? void 0 : debug(`${err}`);\n }\n }\n var filter = createFilter(include, exclude);\n if (!value) {\n value = await scanDepsToOptimize(`${root}/package.json`, {\n filter\n });\n if (sessionCache) {\n sessionCacheVal = value;\n }\n if (!noCache) {\n void FSExtra.outputJSON(cacheFilePath, {\n lockFileHash,\n depsToPreBundleForSsr: value\n });\n }\n }\n debug === null || debug === void 0 ? void 0 : debug(`Scanning completed in ${Date.now() - startedAt}ms`);\n debug === null || debug === void 0 ? void 0 : debug(`${value.prebundleDeps.length} deps are discovered and will be pre-bundled for SSR.` + (debugDetails ? \"\" : ` (Focus on this debug scope, \"DEBUG=${debug.namespace}\", to see more details.)`));\n debugDetails === null || debugDetails === void 0 ? void 0 : debugDetails(`Deps discovered to be pre-bundled for SSR: ${value.prebundleDeps.join(\", \")}`);\n return value;\n}\nexport {\n autoDepOptimizePlugin,\n findDepsToOptimize,\n getSSRExternalsCachePath,\n getScannedOptimizeDepsConfig\n};\n//# sourceMappingURL=autoDepOptimizePlugin.js.map\n"],"mappings":";;;;;;;;;AAOA,IAAI,OAAO;AACX,IAAI,EAAE,OAAO,iBAAiB,eAAe,IAAI;AACjD,SAAS,sBAAsB,OAAO;CACpC,OAAO;EACL;EACA,SAAS;EACT,MAAM,OAAO,KAAK,KAAK;GACrB,IAAI,mBAAmB,uBAAuB;GAC9C,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM,oBAAoB;GACxE,IAAI,cAAc,WAAW;GAC7B,IAAI,aAAa,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,KAAK,IAAI,YAAY;GACvF,IAAI,UAAU,aAAa,OAAO,QAAQ,UAAU,CAAC,CAAC,OAAO,SAAS,OAAO;IAC3E,IAAI,CAAC,GAAG,SAAS;IACjB,OAAO,UAAU;GACnB,CAAC,CAAC,CAAC,IAAI,SAAS,OAAO;IACrB,IAAI,CAAC,KAAK;IACV,OAAO;GACT,CAAC,IAAI,CAAC;GACN,IAAI,eAAe,MAAM,QAAQ,MAAM,OAAO,IAAI,MAAM,UAAU,CAChE,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