Skip to content

Commit 1cf00d0

Browse files
committed
compile firebase pkgs to cjs so they can be stubbed in tests
1 parent 7d536d0 commit 1cf00d0

File tree

4 files changed

+116
-4
lines changed

4 files changed

+116
-4
lines changed

config/webpack.test.js

+19-2
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,30 @@ module.exports = {
7474
]
7575
}
7676
}
77+
},
78+
{
79+
test: /\.js$/,
80+
include: function (modulePath) {
81+
const match = /node_modules\/@firebase.*/.test(modulePath);
82+
if (match) {
83+
console.log('modulePath', modulePath, match);
84+
}
85+
return match;
86+
},
87+
use: {
88+
loader: 'babel-loader',
89+
options: {
90+
plugins: ['@babel/plugin-transform-modules-commonjs']
91+
}
92+
}
7793
}
7894
]
7995
},
8096
resolve: {
8197
modules: ['node_modules', path.resolve(__dirname, '../../node_modules')],
82-
mainFields: ['browser', 'main', 'module'],
83-
extensions: ['.js', '.ts']
98+
mainFields: ['browser', 'module', 'main'],
99+
extensions: ['.js', '.ts'],
100+
symlinks: false
84101
},
85102
plugins: [
86103
new webpack.NormalModuleReplacementPlugin(

integration/firebase/package.json

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
},
99
"devDependencies": {
1010
"firebase": "7.24.0",
11-
"@babel/core": "7.11.6",
12-
"@babel/preset-env": "7.11.5",
1311
"@types/chai": "4.2.13",
1412
"@types/mocha": "7.0.2",
1513
"chai": "4.2.0",

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@
8787
"@typescript-eslint/eslint-plugin-tslint": "4.4.1",
8888
"@typescript-eslint/parser": "4.4.1",
8989
"babel-loader": "8.1.0",
90+
"@babel/core": "7.11.6",
91+
"@babel/preset-env": "7.11.5",
92+
"@babel/plugin-transform-modules-commonjs": "7.12.1",
9093
"chai": "4.2.0",
9194
"chai-as-promised": "7.1.1",
9295
"chalk": "4.1.0",

yarn.lock

+94
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@
5858
jsesc "^2.5.1"
5959
source-map "^0.5.0"
6060

61+
"@babel/generator@^7.12.1":
62+
version "7.12.1"
63+
resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.12.1.tgz#0d70be32bdaa03d7c51c8597dda76e0df1f15468"
64+
integrity sha512-DB+6rafIdc9o72Yc3/Ph5h+6hUjeOp66pF0naQBgUFFuPqzQwIlPTm3xZR7YNvduIMtkDIj2t21LSQwnbCrXvg==
65+
dependencies:
66+
"@babel/types" "^7.12.1"
67+
jsesc "^2.5.1"
68+
source-map "^0.5.0"
69+
6170
"@babel/helper-annotate-as-pure@^7.10.4":
6271
version "7.10.4"
6372
resolved "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.10.4.tgz#5bf0d495a3f757ac3bda48b5bf3b3ba309c72ba3"
@@ -151,13 +160,27 @@
151160
dependencies:
152161
"@babel/types" "^7.11.0"
153162

163+
"@babel/helper-member-expression-to-functions@^7.12.1":
164+
version "7.12.1"
165+
resolved "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.1.tgz#fba0f2fcff3fba00e6ecb664bb5e6e26e2d6165c"
166+
integrity sha512-k0CIe3tXUKTRSoEx1LQEPFU9vRQfqHtl+kf8eNnDqb4AUJEy5pz6aIiog+YWtVm2jpggjS1laH68bPsR+KWWPQ==
167+
dependencies:
168+
"@babel/types" "^7.12.1"
169+
154170
"@babel/helper-module-imports@^7.10.4":
155171
version "7.10.4"
156172
resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz#4c5c54be04bd31670a7382797d75b9fa2e5b5620"
157173
integrity sha512-nEQJHqYavI217oD9+s5MUBzk6x1IlvoS9WTPfgG43CbMEeStE0v+r+TucWdx8KFGowPGvyOkDT9+7DHedIDnVw==
158174
dependencies:
159175
"@babel/types" "^7.10.4"
160176

177+
"@babel/helper-module-imports@^7.12.1":
178+
version "7.12.1"
179+
resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.1.tgz#1644c01591a15a2f084dd6d092d9430eb1d1216c"
180+
integrity sha512-ZeC1TlMSvikvJNy1v/wPIazCu3NdOwgYZLIkmIyAsGhqkNpiDoQQRmaCK8YP4Pq3GPTLPV9WXaPCJKvx06JxKA==
181+
dependencies:
182+
"@babel/types" "^7.12.1"
183+
161184
"@babel/helper-module-transforms@^7.10.4", "@babel/helper-module-transforms@^7.10.5", "@babel/helper-module-transforms@^7.11.0":
162185
version "7.11.0"
163186
resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.11.0.tgz#b16f250229e47211abdd84b34b64737c2ab2d359"
@@ -171,6 +194,21 @@
171194
"@babel/types" "^7.11.0"
172195
lodash "^4.17.19"
173196

197+
"@babel/helper-module-transforms@^7.12.1":
198+
version "7.12.1"
199+
resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz#7954fec71f5b32c48e4b303b437c34453fd7247c"
200+
integrity sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w==
201+
dependencies:
202+
"@babel/helper-module-imports" "^7.12.1"
203+
"@babel/helper-replace-supers" "^7.12.1"
204+
"@babel/helper-simple-access" "^7.12.1"
205+
"@babel/helper-split-export-declaration" "^7.11.0"
206+
"@babel/helper-validator-identifier" "^7.10.4"
207+
"@babel/template" "^7.10.4"
208+
"@babel/traverse" "^7.12.1"
209+
"@babel/types" "^7.12.1"
210+
lodash "^4.17.19"
211+
174212
"@babel/helper-optimise-call-expression@^7.10.4":
175213
version "7.10.4"
176214
resolved "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz#50dc96413d594f995a77905905b05893cd779673"
@@ -210,6 +248,16 @@
210248
"@babel/traverse" "^7.10.4"
211249
"@babel/types" "^7.10.4"
212250

251+
"@babel/helper-replace-supers@^7.12.1":
252+
version "7.12.1"
253+
resolved "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.1.tgz#f15c9cc897439281891e11d5ce12562ac0cf3fa9"
254+
integrity sha512-zJjTvtNJnCFsCXVi5rUInstLd/EIVNmIKA1Q9ynESmMBWPWd+7sdR+G4/wdu+Mppfep0XLyG2m7EBPvjCeFyrw==
255+
dependencies:
256+
"@babel/helper-member-expression-to-functions" "^7.12.1"
257+
"@babel/helper-optimise-call-expression" "^7.10.4"
258+
"@babel/traverse" "^7.12.1"
259+
"@babel/types" "^7.12.1"
260+
213261
"@babel/helper-simple-access@^7.10.4":
214262
version "7.10.4"
215263
resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.10.4.tgz#0f5ccda2945277a2a7a2d3a821e15395edcf3461"
@@ -218,6 +266,13 @@
218266
"@babel/template" "^7.10.4"
219267
"@babel/types" "^7.10.4"
220268

269+
"@babel/helper-simple-access@^7.12.1":
270+
version "7.12.1"
271+
resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz#32427e5aa61547d38eb1e6eaf5fd1426fdad9136"
272+
integrity sha512-OxBp7pMrjVewSSC8fXDFrHrBcJATOOFssZwv16F3/6Xtc138GHybBfPbm9kfiqQHKhYQrlamWILwlDCeyMFEaA==
273+
dependencies:
274+
"@babel/types" "^7.12.1"
275+
221276
"@babel/helper-skip-transparent-expression-wrappers@^7.11.0":
222277
version "7.11.0"
223278
resolved "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.11.0.tgz#eec162f112c2f58d3af0af125e3bb57665146729"
@@ -270,6 +325,11 @@
270325
resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.11.5.tgz#c7ff6303df71080ec7a4f5b8c003c58f1cf51037"
271326
integrity sha512-X9rD8qqm695vgmeaQ4fvz/o3+Wk4ZzQvSHkDBgpYKxpD4qTAUm88ZKtHkVqIOsYFFbIQ6wQYhC6q7pjqVK0E0Q==
272327

328+
"@babel/parser@^7.12.1":
329+
version "7.12.3"
330+
resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.12.3.tgz#a305415ebe7a6c7023b40b5122a0662d928334cd"
331+
integrity sha512-kFsOS0IbsuhO5ojF8Hc8z/8vEIOkylVBrjiZUbLTE3XFe0Qi+uu6HjzQixkFaqr0ZPAMZcBVxEwmsnsLPZ2Xsw==
332+
273333
"@babel/plugin-proposal-async-generator-functions@^7.10.4":
274334
version "7.10.5"
275335
resolved "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.10.5.tgz#3491cabf2f7c179ab820606cec27fed15e0e8558"
@@ -580,6 +640,16 @@
580640
"@babel/helper-plugin-utils" "^7.10.4"
581641
babel-plugin-dynamic-import-node "^2.3.3"
582642

643+
644+
version "7.12.1"
645+
resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.12.1.tgz#fa403124542636c786cf9b460a0ffbb48a86e648"
646+
integrity sha512-dY789wq6l0uLY8py9c1B48V8mVL5gZh/+PQ5ZPrylPYsnAvnEMjqsUXkuoDVPeVK+0VyGar+D08107LzDQ6pag==
647+
dependencies:
648+
"@babel/helper-module-transforms" "^7.12.1"
649+
"@babel/helper-plugin-utils" "^7.10.4"
650+
"@babel/helper-simple-access" "^7.12.1"
651+
babel-plugin-dynamic-import-node "^2.3.3"
652+
583653
"@babel/plugin-transform-modules-commonjs@^7.10.4":
584654
version "7.10.4"
585655
resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.10.4.tgz#66667c3eeda1ebf7896d41f1f16b17105a2fbca0"
@@ -828,6 +898,21 @@
828898
globals "^11.1.0"
829899
lodash "^4.17.19"
830900

901+
"@babel/traverse@^7.12.1":
902+
version "7.12.1"
903+
resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.1.tgz#941395e0c5cc86d5d3e75caa095d3924526f0c1e"
904+
integrity sha512-MA3WPoRt1ZHo2ZmoGKNqi20YnPt0B1S0GTZEPhhd+hw2KGUzBlHuVunj6K4sNuK+reEvyiPwtp0cpaqLzJDmAw==
905+
dependencies:
906+
"@babel/code-frame" "^7.10.4"
907+
"@babel/generator" "^7.12.1"
908+
"@babel/helper-function-name" "^7.10.4"
909+
"@babel/helper-split-export-declaration" "^7.11.0"
910+
"@babel/parser" "^7.12.1"
911+
"@babel/types" "^7.12.1"
912+
debug "^4.1.0"
913+
globals "^11.1.0"
914+
lodash "^4.17.19"
915+
831916
"@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":
832917
version "7.11.5"
833918
resolved "https://registry.npmjs.org/@babel/types/-/types-7.11.5.tgz#d9de577d01252d77c6800cee039ee64faf75662d"
@@ -837,6 +922,15 @@
837922
lodash "^4.17.19"
838923
to-fast-properties "^2.0.0"
839924

925+
"@babel/types@^7.12.1":
926+
version "7.12.1"
927+
resolved "https://registry.npmjs.org/@babel/types/-/types-7.12.1.tgz#e109d9ab99a8de735be287ee3d6a9947a190c4ae"
928+
integrity sha512-BzSY3NJBKM4kyatSOWh3D/JJ2O3CVzBybHWxtgxnggaxEuaSTTDqeiSb/xk9lrkw2Tbqyivw5ZU4rT+EfznQsA==
929+
dependencies:
930+
"@babel/helper-validator-identifier" "^7.10.4"
931+
lodash "^4.17.19"
932+
to-fast-properties "^2.0.0"
933+
840934
"@changesets/apply-release-plan@^4.0.0":
841935
version "4.0.0"
842936
resolved "https://registry.npmjs.org/@changesets/apply-release-plan/-/apply-release-plan-4.0.0.tgz#e78efb56a4e459a8dab814ba43045f2ace0f27c9"

0 commit comments

Comments
 (0)