@expo/metro-config
Advanced tools
Comparing version 0.19.6 to 0.19.7
@@ -51,2 +51,3 @@ "use strict"; | ||
const metro_config_1 = require("./traveling/metro-config"); | ||
const filePath_1 = require("./utils/filePath"); | ||
const debug = require('debug')('expo:metro:config'); | ||
@@ -128,6 +129,6 @@ function getAssetPlugins(projectRoot) { | ||
else if (path_1.default.isAbsolute(modulePath)) { | ||
return path_1.default.relative(root, modulePath) + scope; | ||
return (0, filePath_1.toPosixPath)(path_1.default.relative(root, modulePath)) + scope; | ||
} | ||
else { | ||
return modulePath + scope; | ||
return (0, filePath_1.toPosixPath)(modulePath) + scope; | ||
} | ||
@@ -134,0 +135,0 @@ }; |
@@ -10,2 +10,3 @@ "use strict"; | ||
const css_1 = require("../transform-worker/css"); | ||
const filePath_1 = require("../utils/filePath"); | ||
const hash_1 = require("../utils/hash"); | ||
@@ -24,4 +25,6 @@ // s = static | ||
const contents = cssMetadata.code; | ||
const originFilename = path_1.default.relative(projectRoot, module.path); | ||
const filename = path_1.default.join( | ||
// NOTE(cedric): these relative paths are used as URL pathnames when serializing HTML | ||
// Use POSIX-format to avoid urls like `_expo/static/css/some\\file\\name.css` | ||
const originFilename = (0, filePath_1.toPosixPath)(path_1.default.relative(projectRoot, module.path)); | ||
const filename = (0, filePath_1.toPosixPath)(path_1.default.join( | ||
// Consistent location | ||
@@ -34,3 +37,3 @@ STATIC_EXPORT_DIRECTORY, | ||
src: contents, | ||
}) + '.css'); | ||
}) + '.css')); | ||
if (cssMetadata.externalImports) { | ||
@@ -37,0 +40,0 @@ for (const external of cssMetadata.externalImports) { |
@@ -71,3 +71,3 @@ "use strict"; | ||
} | ||
if (filename.match(/@expo\/metro-runtime\/rsc\/virtual\.js/)) { | ||
if (posixFilename.match(/@expo\/metro-runtime\/rsc\/virtual\.js/)) { | ||
const environment = options.customTransformOptions?.environment; | ||
@@ -84,3 +84,4 @@ const isServer = environment === 'node' || environment === 'react-server'; | ||
.map((boundary) => { | ||
return `[\`$\{require.resolveWeak('${boundary}')}\`]: /* ${boundary} */ () => import('${boundary}'),`; | ||
const serializedBoundary = JSON.stringify(boundary); | ||
return `[\`$\{require.resolveWeak(${serializedBoundary})}\`]: /* ${boundary} */ () => import(${serializedBoundary}),`; | ||
}) | ||
@@ -145,3 +146,5 @@ .join('\n') + | ||
const results = await (0, css_modules_1.transformCssModuleWeb)({ | ||
filename, | ||
// NOTE(cedric): use POSIX-formatted filename fo rconsistent CSS module class names. | ||
// This affects the content hashes, which should be stable across platforms. | ||
filename: posixFilename, | ||
src: code, | ||
@@ -148,0 +151,0 @@ options: { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toPosixPath = void 0; | ||
const node_process_1 = require("node:process"); | ||
const REGEXP_REPLACE_SLASHES = /\\/g; | ||
@@ -9,5 +10,5 @@ /** | ||
function toPosixPath(filePath) { | ||
return filePath.replace(REGEXP_REPLACE_SLASHES, '/'); | ||
return node_process_1.platform === 'win32' ? filePath.replace(REGEXP_REPLACE_SLASHES, '/') : filePath; | ||
} | ||
exports.toPosixPath = toPosixPath; | ||
//# sourceMappingURL=filePath.js.map |
{ | ||
"name": "@expo/metro-config", | ||
"version": "0.19.6", | ||
"version": "0.19.7", | ||
"description": "A Metro config for running React Native projects with the Metro bundler", | ||
@@ -65,3 +65,3 @@ "main": "build/ExpoMetroConfig.js", | ||
}, | ||
"gitHead": "9d4e373d6a0feaaba5df625f0b2eb3a60be16616" | ||
"gitHead": "1faceb8d22bebee4571ef3a2f9578bec33dc26b1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
465138
6565