Skip to content

Commit

Permalink
Fix auth compat import (#5090)
Browse files Browse the repository at this point in the history
* fix auth compat import

* do not use g flag in regex

* revert changes for testing

* update
  • Loading branch information
Feiyang1 committed Jul 1, 2021
1 parent ca85752 commit 75ab880
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 17 deletions.
13 changes: 6 additions & 7 deletions packages-exp/auth-compat-exp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import firebase, { _FirebaseNamespace } from '@firebase/app-compat';
import * as impl from '@firebase/auth-exp/internal';
import * as externs from '@firebase/auth-exp';
import {
Component,
ComponentType,
Expand Down Expand Up @@ -87,14 +86,14 @@ function registerAuthCompat(instance: _FirebaseNamespace): void {
.setServiceProps({
ActionCodeInfo: {
Operation: {
EMAIL_SIGNIN: externs.ActionCodeOperation.EMAIL_SIGNIN,
PASSWORD_RESET: externs.ActionCodeOperation.PASSWORD_RESET,
RECOVER_EMAIL: externs.ActionCodeOperation.RECOVER_EMAIL,
EMAIL_SIGNIN: impl.ActionCodeOperation.EMAIL_SIGNIN,
PASSWORD_RESET: impl.ActionCodeOperation.PASSWORD_RESET,
RECOVER_EMAIL: impl.ActionCodeOperation.RECOVER_EMAIL,
REVERT_SECOND_FACTOR_ADDITION:
externs.ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION,
impl.ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION,
VERIFY_AND_CHANGE_EMAIL:
externs.ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL,
VERIFY_EMAIL: externs.ActionCodeOperation.VERIFY_EMAIL
impl.ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL,
VERIFY_EMAIL: impl.ActionCodeOperation.VERIFY_EMAIL
}
},
EmailAuthProvider: impl.EmailAuthProvider,
Expand Down
4 changes: 2 additions & 2 deletions packages/database/rollup.config.compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const es5BuildPlugins = [
transformers: [
getImportPathTransformer({
// ../../exp/index
pattern: /^.*exp\/index$/g,
pattern: /^.*exp\/index$/,
template: ['@firebase/database']
})
]
Expand Down Expand Up @@ -111,7 +111,7 @@ const es2017BuildPlugins = [
transformers: [
getImportPathTransformer({
// ../../exp/index
pattern: /^.*exp\/index$/g,
pattern: /^.*exp\/index$/,
template: ['@firebase/database']
})
]
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/rollup.config.browser.compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default [
'browser',
getImportPathTransformer({
// ../../exp/index
pattern: /^.*exp\/index$/g,
pattern: /^.*exp\/index$/,
template: ['@firebase/firestore']
}),
/* mangled= */ false
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/rollup.config.node.compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default [
'node',
getImportPathTransformer({
// ../../exp/index
pattern: /^.*exp\/index$/g,
pattern: /^.*exp\/index$/,
template: ['@firebase/firestore']
})
),
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/rollup.config.rn.compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default [
'rn',
getImportPathTransformer({
// ../../exp/index
pattern: /^.*exp\/index$/g,
pattern: /^.*exp\/index$/,
template: ['@firebase/firestore']
}),
/* mangled= */ false
Expand Down
4 changes: 2 additions & 2 deletions packages/storage/rollup.config.compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const es5BuildPlugins = [
transformers: [
getImportPathTransformer({
// ../exp/index
pattern: /^.*exp\/api$/g,
pattern: /^.*exp\/api$/,
template: ['@firebase/storage']
})
]
Expand Down Expand Up @@ -80,7 +80,7 @@ const es2017BuildPlugins = [
transformers: [
getImportPathTransformer({
// ../exp/index
pattern: /^.*exp\/api$/g,
pattern: /^.*exp\/api$/,
template: ['@firebase/storage']
})
],
Expand Down
5 changes: 2 additions & 3 deletions scripts/exp/ts-transform-import-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export function getImportPathTransformer({ pattern, template }) {
export const importPathTransformer = () => ({
before: [
transformImportPath({
pattern: /^(@firebase.*)-exp(.*)$/g,
pattern: /^(@firebase.*)-exp(.*)$/,
template: [1, 2]
})
],
after: [],
afterDeclarations: [
transformImportPath({
pattern: /^(@firebase.*)-exp(.*)$/g,
pattern: /^(@firebase.*)-exp(.*)$/,
template: [1, 2]
})
]
Expand Down Expand Up @@ -75,7 +75,6 @@ function visitNode(node, { pattern, template }) {
);

const captures = pattern.exec(importPath);

if (captures) {
const newNameFragments = [];
for (const fragment of template) {
Expand Down

0 comments on commit 75ab880

Please sign in to comment.