From ad737f1dceb3cae171abaa07828636ad03941a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20T=C3=B4rres?= Date: Fri, 14 Feb 2020 16:24:55 -0800 Subject: [PATCH] Fix Invalid Regular Expression (#3795) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pedro Tôrres --- ...ive-win32-2020-02-15-01-31-40-patch-2.json | 9 +++++++++ ...e-windows-2020-02-15-01-31-40-patch-2.json | 9 +++++++++ packages/E2ETest/metro.config.js | 18 ++++++++--------- .../metro.config.js | 20 ++++++++----------- packages/playground/metro.config.js | 18 +++++++---------- packages/react-native-win32/metro.config.js | 4 ++-- .../templates/metro.config.js | 6 ++---- vnext/metro.config.js | 10 ++++------ 8 files changed, 49 insertions(+), 45 deletions(-) create mode 100644 change/@office-iss-react-native-win32-2020-02-15-01-31-40-patch-2.json create mode 100644 change/react-native-windows-2020-02-15-01-31-40-patch-2.json diff --git a/change/@office-iss-react-native-win32-2020-02-15-01-31-40-patch-2.json b/change/@office-iss-react-native-win32-2020-02-15-01-31-40-patch-2.json new file mode 100644 index 00000000000..55d9ff49e27 --- /dev/null +++ b/change/@office-iss-react-native-win32-2020-02-15-01-31-40-patch-2.json @@ -0,0 +1,9 @@ +{ + "type": "none", + "comment": "Fix Invalid Regular Expression (#3795)", + "packageName": "@office-iss/react-native-win32", + "email": "t-pesant@microsoft.com", + "commit": "5d51eb6cc6b9610b35ff76c8ce1d4270661b22cd", + "dependentChangeType": "patch", + "date": "2020-02-15T01:31:37.614Z" +} \ No newline at end of file diff --git a/change/react-native-windows-2020-02-15-01-31-40-patch-2.json b/change/react-native-windows-2020-02-15-01-31-40-patch-2.json new file mode 100644 index 00000000000..818e0696816 --- /dev/null +++ b/change/react-native-windows-2020-02-15-01-31-40-patch-2.json @@ -0,0 +1,9 @@ +{ + "type": "none", + "comment": "Fix Invalid Regular Expression (#3795)", + "packageName": "react-native-windows", + "email": "t-pesant@microsoft.com", + "commit": "5d51eb6cc6b9610b35ff76c8ce1d4270661b22cd", + "dependentChangeType": "patch", + "date": "2020-02-15T01:31:40.076Z" +} \ No newline at end of file diff --git a/packages/E2ETest/metro.config.js b/packages/E2ETest/metro.config.js index 649ef4128a3..d670cb8ba39 100644 --- a/packages/E2ETest/metro.config.js +++ b/packages/E2ETest/metro.config.js @@ -39,28 +39,26 @@ module.exports = { blacklistRE: blacklist([ new RegExp( `${'.*E2ETest/msbuild.*' - .replace(/[/\\\\]/g, '[/\\\\]')}.*` + .replace(/[/\\\\]/g, '/')}.*` ), // Avoid error EBUSY: resource busy or locked, open 'D:\a\1\s\packages\E2ETest\msbuild.ProjectImports.zip' in pipeline - new RegExp(`${path.resolve(rnPath).replace(/[/\\\\]/g, '[/\\\\]')}.*`), + new RegExp(`${path.resolve(rnPath).replace(/[/\\\\]/g, '/')}.*`), new RegExp( - `${path - .resolve(rnwPath, 'RNTesterCopy') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + `${path.resolve(rnwPath, 'RNTesterCopy').replace(/[/\\\\]/g, '/')}.*`, ), new RegExp( `${path .resolve(rnwPath, 'IntegrationTestsCopy') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + .replace(/[/\\\\]/g, '/')}.*`, ), new RegExp( `${path .resolve(rnwPath, 'node_modules/react-native') - .replace(/[/\\\\]/g, '[/\\\\]')}.*` + .replace(/[/\\\\]/g, '/')}.*` ), new RegExp( `${path .resolve(rnwePath, 'node_modules/react-native') - .replace(/[/\\\\]/g, '[/\\\\]')}.*` + .replace(/[/\\\\]/g, '/')}.*` ), new RegExp( `${path @@ -68,12 +66,12 @@ module.exports = { require.resolve('@react-native-community/cli/package.json'), '../node_modules/react-native' ) - .replace(/[/\\\\]/g, '[/\\\\]')}.*` + .replace(/[/\\\\]/g, '/')}.*` ), // This stops "react-native run-windows" from causing the metro server to crash if its already running new RegExp( - `${path.resolve(__dirname, 'windows').replace(/[/\\\\]/g, '[/\\\\]')}.*` + `${path.resolve(__dirname, 'windows').replace(/[/\\\\]/g, '/')}.*` ), ]), }, diff --git a/packages/microsoft-reactnative-sampleapps/metro.config.js b/packages/microsoft-reactnative-sampleapps/metro.config.js index 36b5020f7d3..0cfca29594d 100644 --- a/packages/microsoft-reactnative-sampleapps/metro.config.js +++ b/packages/microsoft-reactnative-sampleapps/metro.config.js @@ -40,29 +40,27 @@ module.exports = { new RegExp( `${'.*microsoft-reactnative-sampleapps/msbuild.*'.replace( /[/\\\\]/g, - '[/\\\\]', + '/', )}.*`, ), // Avoid error EBUSY: resource busy or locked, open 'D:\a\1\s\packages\E2ETest\msbuild.ProjectImports.zip' in pipeline - new RegExp(`${path.resolve(rnPath).replace(/[/\\\\]/g, '[/\\\\]')}.*`), + new RegExp(`${path.resolve(rnPath).replace(/[/\\\\]/g, '/')}.*`), new RegExp( - `${path - .resolve(rnwPath, 'RNTesterCopy') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + `${path.resolve(rnwPath, 'RNTesterCopy').replace(/[/\\\\]/g, '/')}.*`, ), new RegExp( `${path .resolve(rnwPath, 'IntegrationTestsCopy') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + .replace(/[/\\\\]/g, '/')}.*`, ), new RegExp( `${path .resolve(rnwPath, 'node_modules/react-native') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + .replace(/[/\\\\]/g, '/')}.*`, ), new RegExp( `${path .resolve(rnwePath, 'node_modules/react-native') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + .replace(/[/\\\\]/g, '/')}.*`, ), new RegExp( `${path @@ -70,13 +68,11 @@ module.exports = { require.resolve('@react-native-community/cli/package.json'), '../node_modules/react-native', ) - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + .replace(/[/\\\\]/g, '/')}.*`, ), // This stops "react-native run-windows" from causing the metro server to crash if its already running new RegExp( - `${path - .resolve(__dirname, 'windows') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + `${path.resolve(__dirname, 'windows').replace(/[/\\\\]/g, '/')}.*`, ), ]), }, diff --git a/packages/playground/metro.config.js b/packages/playground/metro.config.js index 677e1a348a6..d4c6a7476b1 100644 --- a/packages/playground/metro.config.js +++ b/packages/playground/metro.config.js @@ -39,26 +39,24 @@ module.exports = { // Since there are multiple copies of react-native, we need to ensure that metro only sees one of them // This should go away after RN 0.61 when haste is removed blacklistRE: blacklist([ - new RegExp(`${path.resolve(rnPath).replace(/[/\\\\]/g, '[/\\\\]')}.*`), + new RegExp(`${path.resolve(rnPath).replace(/[/\\\\]/g, '/')}.*`), new RegExp( `${path .resolve(rnwPath, 'node_modules/react-native') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + .replace(/[/\\\\]/g, '/')}.*`, ), new RegExp( - `${path - .resolve(rnwPath, 'RNTesterCopy') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + `${path.resolve(rnwPath, 'RNTesterCopy').replace(/[/\\\\]/g, '/')}.*`, ), new RegExp( `${path .resolve(rnwPath, 'IntegrationTestsCopy') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + .replace(/[/\\\\]/g, '/')}.*`, ), new RegExp( `${path .resolve(rnwePath, 'node_modules/react-native') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + .replace(/[/\\\\]/g, '/')}.*`, ), new RegExp( `${path @@ -66,14 +64,12 @@ module.exports = { require.resolve('@react-native-community/cli/package.json'), '../node_modules/react-native', ) - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + .replace(/[/\\\\]/g, '/')}.*`, ), // This stops "react-native run-windows" from causing the metro server to crash if its already running new RegExp( - `${path - .resolve(__dirname, 'windows') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + `${path.resolve(__dirname, 'windows').replace(/[/\\\\]/g, '/')}.*`, ), ]), }, diff --git a/packages/react-native-win32/metro.config.js b/packages/react-native-win32/metro.config.js index c752a914a2a..15a90c687b3 100644 --- a/packages/react-native-win32/metro.config.js +++ b/packages/react-native-win32/metro.config.js @@ -38,14 +38,14 @@ module.exports = { // Since there are multiple copies of react-native, we need to ensure that metro only sees one of them // This should go away after RN 0.61 when haste is removed blacklistRE: blacklist([ - new RegExp(`${path.resolve(rnPath).replace(/[/\\\\]/g, '[/\\\\]')}.*`), + new RegExp(`${path.resolve(rnPath).replace(/[/\\\\]/g, '/')}.*`), new RegExp( `${path .resolve( require.resolve('@react-native-community/cli/package.json'), '../node_modules/react-native', ) - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + .replace(/[/\\\\]/g, '/')}.*`, ), ]), }, diff --git a/vnext/local-cli/generator-windows/templates/metro.config.js b/vnext/local-cli/generator-windows/templates/metro.config.js index 9c4bbcdfdc3..6e774aa31f6 100644 --- a/vnext/local-cli/generator-windows/templates/metro.config.js +++ b/vnext/local-cli/generator-windows/templates/metro.config.js @@ -28,14 +28,12 @@ module.exports = { // This should go in RN 0.61 when haste is removed blacklistRE: blacklist([ new RegExp( - `${(path.resolve(rnPath) + path.sep).replace(/[/\\\\]/g, '[/\\\\]')}.*`, + `${(path.resolve(rnPath) + path.sep).replace(/[/\\\\]/g, '/')}.*`, ), // This stops "react-native run-windows" from causing the metro server to crash if its already running new RegExp( - `${path - .resolve(__dirname, 'windows') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + `${path.resolve(__dirname, 'windows').replace(/[/\\\\]/g, '/')}.*`, ), ]), }, diff --git a/vnext/metro.config.js b/vnext/metro.config.js index ef013da86ed..0f1320e5ad1 100644 --- a/vnext/metro.config.js +++ b/vnext/metro.config.js @@ -30,16 +30,14 @@ module.exports = { // Since there are multiple copies of react-native, we need to ensure that metro only sees one of them // This should go away after RN 0.61 when haste is removed blacklistRE: blacklist([ - new RegExp(`${path.resolve(rnPath).replace(/[/\\\\]/g, '[/\\\\]')}.*`), + new RegExp(`${path.resolve(rnPath).replace(/[/\\\\]/g, '/')}.*`), new RegExp( - `${path - .resolve(rnwPath, 'RNTesterCopy') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + `${path.resolve(rnwPath, 'RNTesterCopy').replace(/[/\\\\]/g, '/')}.*`, ), new RegExp( `${path .resolve(rnwPath, 'IntegrationTestsCopy') - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + .replace(/[/\\\\]/g, '/')}.*`, ), new RegExp( `${path @@ -47,7 +45,7 @@ module.exports = { require.resolve('@react-native-community/cli/package.json'), '../node_modules/react-native', ) - .replace(/[/\\\\]/g, '[/\\\\]')}.*`, + .replace(/[/\\\\]/g, '/')}.*`, ), ]), hasteImplModulePath: path.resolve(__dirname, 'jest/hasteImpl.js'),