Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: @swc/helpers #7147

Merged
merged 13 commits into from
Mar 31, 2023
Merged

fix: @swc/helpers #7147

merged 13 commits into from
Mar 31, 2023

Conversation

magic-akari
Copy link
Member

@magic-akari magic-akari commented Mar 26, 2023

  • use snake_case
  • use named export

Description:

generated by Babel plugin

const node_path = require("node:path");
const { declare } = require("@babel/helper-plugin-utils");

module.exports = declare((api, opt) => {
    return {
        visitor: {
            ExportDefaultDeclaration(path, state) {
                const { filename } = state;
                const newName = node_path.basename(filename, ".mjs");
                if (path.node.declaration.type !== "FunctionDeclaration") {
                    return;
                }
                const oldName = path.node.declaration.id.name;

                path.replaceWith(api.types.exportNamedDeclaration(path.node.declaration));
                path.node.declaration.id.name = newName;

                path.scope.rename(oldName, newName);
            },

            ImportDefaultSpecifier(path) {
                const source = path.parentPath.node.source.value;
                const newName = node_path.basename(source, ".mjs");
                const oldName = path.node.local.name;
                path.scope.rename(oldName, newName);
                path.replaceWith(api.types.importSpecifier(path.node.local, path.node.local));
            }
        }
    };
});

I will doublecheck the result.

BREAKING CHANGE:

Related issue (if exists):

@magic-akari
Copy link
Member Author

Test node bindings with _defineProperty caused the CI to fail.
Is this indicative of a breaking change for NAPI and WASM? @kdy1

- use snake_case
- fix: typeof
- fix: _sliced_to_array
@magic-akari magic-akari force-pushed the fix/issue-7144 branch 2 times, most recently from 335547c to 9571ea9 Compare March 27, 2023 11:55
@magic-akari magic-akari marked this pull request as ready for review March 27, 2023 13:54
@kdy1
Copy link
Member

kdy1 commented Mar 28, 2023

I don't think it's a breaking change of @swc/core, but I'm not sure about the exact cause

@kdy1 kdy1 self-assigned this Mar 28, 2023
@kdy1 kdy1 added this to the Planned milestone Mar 28, 2023
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to avoid mistake


swc-bump:

  • swc_atoms
  • swc_ecma_transformrs_base --breaking

@magic-akari magic-akari marked this pull request as ready for review March 28, 2023 09:50
@magic-akari magic-akari requested a review from kdy1 March 28, 2023 12:42
package.json Show resolved Hide resolved
@magic-akari magic-akari requested a review from kdy1 March 29, 2023 08:31
@kdy1 kdy1 enabled auto-merge (squash) March 31, 2023 02:49
Copy link
Collaborator

@swc-bot swc-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review comment generated by auto-rebase script

@kdy1 kdy1 disabled auto-merge March 31, 2023 03:19
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know the reason, but CI failed

@magic-akari
Copy link
Member Author

I don't know the reason, but CI failed

run: |
echo '[patch.crates-io]' >> bindings/Cargo.toml
./scripts/cargo/patch-section.sh >> bindings/Cargo.toml
cd bindings && cargo update -p swc_core

It caused by patch-section.
I will run it locally and update the test results.

@kdy1 kdy1 enabled auto-merge (squash) March 31, 2023 05:33
Copy link
Collaborator

@swc-bot swc-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review comment generated by auto-rebase script

@kdy1 kdy1 merged commit 3ca954b into swc-project:main Mar 31, 2023
@magic-akari magic-akari deleted the fix/issue-7144 branch March 31, 2023 07:08
@kdy1 kdy1 modified the milestones: Planned, v1.3.45 Apr 4, 2023
@swc-project swc-project locked as resolved and limited conversation to collaborators May 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
3 participants