Skip to content

Commit

Permalink
compile firebase pkgs to cjs so they can be stubbed in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Feiyang1 committed Oct 20, 2020
1 parent 7d536d0 commit 1cf00d0
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 4 deletions.
21 changes: 19 additions & 2 deletions config/webpack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,30 @@ module.exports = {
]
}
}
},
{
test: /\.js$/,
include: function (modulePath) {
const match = /node_modules\/@firebase.*/.test(modulePath);
if (match) {
console.log('modulePath', modulePath, match);
}
return match;
},
use: {
loader: 'babel-loader',
options: {
plugins: ['@babel/plugin-transform-modules-commonjs']
}
}
}
]
},
resolve: {
modules: ['node_modules', path.resolve(__dirname, '../../node_modules')],
mainFields: ['browser', 'main', 'module'],
extensions: ['.js', '.ts']
mainFields: ['browser', 'module', 'main'],
extensions: ['.js', '.ts'],
symlinks: false
},
plugins: [
new webpack.NormalModuleReplacementPlugin(
Expand Down
2 changes: 0 additions & 2 deletions integration/firebase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
},
"devDependencies": {
"firebase": "7.24.0",
"@babel/core": "7.11.6",
"@babel/preset-env": "7.11.5",
"@types/chai": "4.2.13",
"@types/mocha": "7.0.2",
"chai": "4.2.0",
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
"@typescript-eslint/eslint-plugin-tslint": "4.4.1",
"@typescript-eslint/parser": "4.4.1",
"babel-loader": "8.1.0",
"@babel/core": "7.11.6",
"@babel/preset-env": "7.11.5",
"@babel/plugin-transform-modules-commonjs": "7.12.1",
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"chalk": "4.1.0",
Expand Down
94 changes: 94 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@
jsesc "^2.5.1"
source-map "^0.5.0"

"@babel/generator@^7.12.1":
version "7.12.1"
resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.12.1.tgz#0d70be32bdaa03d7c51c8597dda76e0df1f15468"
integrity sha512-DB+6rafIdc9o72Yc3/Ph5h+6hUjeOp66pF0naQBgUFFuPqzQwIlPTm3xZR7YNvduIMtkDIj2t21LSQwnbCrXvg==
dependencies:
"@babel/types" "^7.12.1"
jsesc "^2.5.1"
source-map "^0.5.0"

"@babel/helper-annotate-as-pure@^7.10.4":
version "7.10.4"
resolved "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.10.4.tgz#5bf0d495a3f757ac3bda48b5bf3b3ba309c72ba3"
Expand Down Expand Up @@ -151,13 +160,27 @@
dependencies:
"@babel/types" "^7.11.0"

"@babel/helper-member-expression-to-functions@^7.12.1":
version "7.12.1"
resolved "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.1.tgz#fba0f2fcff3fba00e6ecb664bb5e6e26e2d6165c"
integrity sha512-k0CIe3tXUKTRSoEx1LQEPFU9vRQfqHtl+kf8eNnDqb4AUJEy5pz6aIiog+YWtVm2jpggjS1laH68bPsR+KWWPQ==
dependencies:
"@babel/types" "^7.12.1"

"@babel/helper-module-imports@^7.10.4":
version "7.10.4"
resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz#4c5c54be04bd31670a7382797d75b9fa2e5b5620"
integrity sha512-nEQJHqYavI217oD9+s5MUBzk6x1IlvoS9WTPfgG43CbMEeStE0v+r+TucWdx8KFGowPGvyOkDT9+7DHedIDnVw==
dependencies:
"@babel/types" "^7.10.4"

"@babel/helper-module-imports@^7.12.1":
version "7.12.1"
resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.1.tgz#1644c01591a15a2f084dd6d092d9430eb1d1216c"
integrity sha512-ZeC1TlMSvikvJNy1v/wPIazCu3NdOwgYZLIkmIyAsGhqkNpiDoQQRmaCK8YP4Pq3GPTLPV9WXaPCJKvx06JxKA==
dependencies:
"@babel/types" "^7.12.1"

"@babel/helper-module-transforms@^7.10.4", "@babel/helper-module-transforms@^7.10.5", "@babel/helper-module-transforms@^7.11.0":
version "7.11.0"
resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.11.0.tgz#b16f250229e47211abdd84b34b64737c2ab2d359"
Expand All @@ -171,6 +194,21 @@
"@babel/types" "^7.11.0"
lodash "^4.17.19"

"@babel/helper-module-transforms@^7.12.1":
version "7.12.1"
resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz#7954fec71f5b32c48e4b303b437c34453fd7247c"
integrity sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w==
dependencies:
"@babel/helper-module-imports" "^7.12.1"
"@babel/helper-replace-supers" "^7.12.1"
"@babel/helper-simple-access" "^7.12.1"
"@babel/helper-split-export-declaration" "^7.11.0"
"@babel/helper-validator-identifier" "^7.10.4"
"@babel/template" "^7.10.4"
"@babel/traverse" "^7.12.1"
"@babel/types" "^7.12.1"
lodash "^4.17.19"

"@babel/helper-optimise-call-expression@^7.10.4":
version "7.10.4"
resolved "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz#50dc96413d594f995a77905905b05893cd779673"
Expand Down Expand Up @@ -210,6 +248,16 @@
"@babel/traverse" "^7.10.4"
"@babel/types" "^7.10.4"

"@babel/helper-replace-supers@^7.12.1":
version "7.12.1"
resolved "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.1.tgz#f15c9cc897439281891e11d5ce12562ac0cf3fa9"
integrity sha512-zJjTvtNJnCFsCXVi5rUInstLd/EIVNmIKA1Q9ynESmMBWPWd+7sdR+G4/wdu+Mppfep0XLyG2m7EBPvjCeFyrw==
dependencies:
"@babel/helper-member-expression-to-functions" "^7.12.1"
"@babel/helper-optimise-call-expression" "^7.10.4"
"@babel/traverse" "^7.12.1"
"@babel/types" "^7.12.1"

"@babel/helper-simple-access@^7.10.4":
version "7.10.4"
resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.10.4.tgz#0f5ccda2945277a2a7a2d3a821e15395edcf3461"
Expand All @@ -218,6 +266,13 @@
"@babel/template" "^7.10.4"
"@babel/types" "^7.10.4"

"@babel/helper-simple-access@^7.12.1":
version "7.12.1"
resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz#32427e5aa61547d38eb1e6eaf5fd1426fdad9136"
integrity sha512-OxBp7pMrjVewSSC8fXDFrHrBcJATOOFssZwv16F3/6Xtc138GHybBfPbm9kfiqQHKhYQrlamWILwlDCeyMFEaA==
dependencies:
"@babel/types" "^7.12.1"

"@babel/helper-skip-transparent-expression-wrappers@^7.11.0":
version "7.11.0"
resolved "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.11.0.tgz#eec162f112c2f58d3af0af125e3bb57665146729"
Expand Down Expand Up @@ -270,6 +325,11 @@
resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.11.5.tgz#c7ff6303df71080ec7a4f5b8c003c58f1cf51037"
integrity sha512-X9rD8qqm695vgmeaQ4fvz/o3+Wk4ZzQvSHkDBgpYKxpD4qTAUm88ZKtHkVqIOsYFFbIQ6wQYhC6q7pjqVK0E0Q==

"@babel/parser@^7.12.1":
version "7.12.3"
resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.12.3.tgz#a305415ebe7a6c7023b40b5122a0662d928334cd"
integrity sha512-kFsOS0IbsuhO5ojF8Hc8z/8vEIOkylVBrjiZUbLTE3XFe0Qi+uu6HjzQixkFaqr0ZPAMZcBVxEwmsnsLPZ2Xsw==

"@babel/plugin-proposal-async-generator-functions@^7.10.4":
version "7.10.5"
resolved "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.10.5.tgz#3491cabf2f7c179ab820606cec27fed15e0e8558"
Expand Down Expand Up @@ -580,6 +640,16 @@
"@babel/helper-plugin-utils" "^7.10.4"
babel-plugin-dynamic-import-node "^2.3.3"

"@babel/plugin-transform-modules-commonjs@7.12.1":
version "7.12.1"
resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.12.1.tgz#fa403124542636c786cf9b460a0ffbb48a86e648"
integrity sha512-dY789wq6l0uLY8py9c1B48V8mVL5gZh/+PQ5ZPrylPYsnAvnEMjqsUXkuoDVPeVK+0VyGar+D08107LzDQ6pag==
dependencies:
"@babel/helper-module-transforms" "^7.12.1"
"@babel/helper-plugin-utils" "^7.10.4"
"@babel/helper-simple-access" "^7.12.1"
babel-plugin-dynamic-import-node "^2.3.3"

"@babel/plugin-transform-modules-commonjs@^7.10.4":
version "7.10.4"
resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.10.4.tgz#66667c3eeda1ebf7896d41f1f16b17105a2fbca0"
Expand Down Expand Up @@ -828,6 +898,21 @@
globals "^11.1.0"
lodash "^4.17.19"

"@babel/traverse@^7.12.1":
version "7.12.1"
resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.1.tgz#941395e0c5cc86d5d3e75caa095d3924526f0c1e"
integrity sha512-MA3WPoRt1ZHo2ZmoGKNqi20YnPt0B1S0GTZEPhhd+hw2KGUzBlHuVunj6K4sNuK+reEvyiPwtp0cpaqLzJDmAw==
dependencies:
"@babel/code-frame" "^7.10.4"
"@babel/generator" "^7.12.1"
"@babel/helper-function-name" "^7.10.4"
"@babel/helper-split-export-declaration" "^7.11.0"
"@babel/parser" "^7.12.1"
"@babel/types" "^7.12.1"
debug "^4.1.0"
globals "^11.1.0"
lodash "^4.17.19"

"@babel/types@^7.10.4", "@babel/types@^7.10.5", "@babel/types@^7.11.0", "@babel/types@^7.11.5", "@babel/types@^7.4.0", "@babel/types@^7.4.4":
version "7.11.5"
resolved "https://registry.npmjs.org/@babel/types/-/types-7.11.5.tgz#d9de577d01252d77c6800cee039ee64faf75662d"
Expand All @@ -837,6 +922,15 @@
lodash "^4.17.19"
to-fast-properties "^2.0.0"

"@babel/types@^7.12.1":
version "7.12.1"
resolved "https://registry.npmjs.org/@babel/types/-/types-7.12.1.tgz#e109d9ab99a8de735be287ee3d6a9947a190c4ae"
integrity sha512-BzSY3NJBKM4kyatSOWh3D/JJ2O3CVzBybHWxtgxnggaxEuaSTTDqeiSb/xk9lrkw2Tbqyivw5ZU4rT+EfznQsA==
dependencies:
"@babel/helper-validator-identifier" "^7.10.4"
lodash "^4.17.19"
to-fast-properties "^2.0.0"

"@changesets/apply-release-plan@^4.0.0":
version "4.0.0"
resolved "https://registry.npmjs.org/@changesets/apply-release-plan/-/apply-release-plan-4.0.0.tgz#e78efb56a4e459a8dab814ba43045f2ace0f27c9"
Expand Down

0 comments on commit 1cf00d0

Please sign in to comment.