Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/pages/versions/unversioned/sdk/maps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Expo Maps provides access to the platform native map APIs on Android and iOS.
<Tab label="For development builds">

- If you have already created a [development build](/develop/development-builds/introduction/), your project will be signed using a debug keystore.
- After the build is complete, go to your [project's dashboard](https://expo.dev/accounts/[username]/projects/[project-name]), then, under **Configure** > click **Credentials**.
- After the build is complete, go to your [project's dashboard](https://expo.dev/accounts/[username]/projects/[project-name]), then, under **Project settings** > click **Credentials**.
- Under **Application Identifiers**, click your project's package name and under **Android Keystore** copy the value of **SHA-1 Certificate Fingerprint**.

</Tab>
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/versions/v53.0.0/sdk/maps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Expo Maps provides access to the platform native map APIs on Android and iOS.
<Tab label="For development builds">

- If you have already created a [development build](/develop/development-builds/introduction/), your project will be signed using a debug keystore.
- After the build is complete, go to your [project's dashboard](https://expo.dev/accounts/[username]/projects/[project-name]), then, under **Configure** > click **Credentials**.
- After the build is complete, go to your [project's dashboard](https://expo.dev/accounts/[username]/projects/[project-name]), then, under **Project settings** > click **Credentials**.
- Under **Application Identifiers**, click your project's package name and under **Android Keystore** copy the value of **SHA-1 Certificate Fingerprint**.

</Tab>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { importExportPlugin } from '../import-export-plugin';
import { compare } from './__mocks__/test-helpers-upstream';
import { showTransformedDeps } from './utils';

// This file includes test for functionality that was added to the import-export-plugin
// and has not been upstreamed yet.

const opts = {
importAll: '_$$_IMPORT_ALL',
importDefault: '_$$_IMPORT_DEFAULT',
};

it('correctly transforms "export * as" namespace from import', () => {
const code = `
export * as AppleIcons from 'apple-icons';
`;

const expected = `
Object.defineProperty(exports, '__esModule', {value: true});

var _AppleIcons = _$$_IMPORT_ALL('apple-icons');
exports.AppleIcons = _AppleIcons;
`;

compare([importExportPlugin], code, expected, opts);

expect(showTransformedDeps(code, [importExportPlugin])).toMatchInlineSnapshot(`
"
> 2 | export * as AppleIcons from 'apple-icons';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dep #0 (apple-icons)"
`);
});

it('correctly transforms "export * as" combined with other ESM imports and exports', () => {
const code = `
import React from 'react';
import { Component } from 'react';
export * as Icons from 'icons';
export { default as Button } from 'button';
export const MyComponent = () => React.createElement('div');
`;

const expected = `
Object.defineProperty(exports, '__esModule', {value: true});

var React = _$$_IMPORT_DEFAULT('react');
var Component = require('react').Component;
var _Icons = _$$_IMPORT_ALL('icons');
var _default = _$$_IMPORT_DEFAULT('button');
const MyComponent = () => React.createElement('div');
exports.Icons = _Icons;
exports.Button = _default;
exports.MyComponent = MyComponent;
`;

compare([importExportPlugin], code, expected, opts);

expect(showTransformedDeps(code, [importExportPlugin])).toMatchInlineSnapshot(`
"
> 2 | import React from 'react';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ dep #0 (react)
> 3 | import { Component } from 'react';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dep #0 (react)
> 4 | export * as Icons from 'icons';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dep #1 (icons)
> 5 | export { default as Button } from 'button';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dep #2 (button)"
`);
});
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,14 @@ export function importExportPlugin({ types: t }: { types: Types }): PluginObj<St
if (specifiers) {
specifiers.forEach((s) => {
// @ts-expect-error Property 'local' does not exist on type 'ExportDefaultSpecifier'
const local = s.local;
let local = s.local;
const remote = s.exported;

// export * as b from 'a'
if (!local && s.type === 'ExportNamespaceSpecifier') {
local = s.exported;
}

if (remote.type === 'StringLiteral') {
// https://babeljs.io/docs/en/babel-plugin-syntax-module-string-names
throw path.buildCodeFrameError('Module string names are not supported');
Expand Down Expand Up @@ -320,6 +325,25 @@ export function importExportPlugin({ types: t }: { types: Types }): PluginObj<St
);

state.exportDefault.push({ local: temp.name, loc });
} else if (s.type === 'ExportNamespaceSpecifier') {
path.insertBefore(
withLocation(
importTemplate({
IMPORT: t.cloneNode(state.importAll),
FILE: resolvePath(
t.cloneNode(nullthrows(path.node.source)),
state.opts.resolve
),
LOCAL: temp,
}),
loc
)
);
state.exportNamed.push({
local: temp.name,
remote: remote.name,
loc,
});
} else {
path.insertBefore(
withLocation(
Expand Down
Loading