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

chore(gatsby): upgrade latest-version #36434

Merged
merged 8 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require("path")
module.exports = {
sourceType: "module",
plugins: [
[path.resolve(__dirname, "../../babel-transform-compiler-flags.js"),
[path.resolve(__dirname, "../../../babel-transform-compiler-flags.js"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was moved from top-level for all fixtures to one directory below that, hence path adjustment

{
availableFlags: ['MAJOR'],
flags: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export async function someFunction() {
return await import(`path`);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";

exports.__esModule = true;
exports.someFunction = someFunction;

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

async function someFunction() {
return await Promise.resolve().then(() => _interopRequireWildcard(require(`path`)));
Copy link
Contributor Author

@pieh pieh Oct 17, 2022

Choose a reason for hiding this comment

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

ensuring default doesn't change to not introduce accidental regressions

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const path = require("path")

// "babel-plugin-dynamic-import-node" is used in tests, so we force not a test environment
process.env.BABEL_ENV = `not-a-test`

module.exports = {
sourceType: "module",
presets: [
[path.resolve(__dirname, "../../../index.js"),
{
keepDynamicImports: [`./packages/babel-preset-gatsby-package/lib/__tests__/fixtures/keep-dynamic-import/with-override/input.js`]
}
],
],
babelrc: false,
configFile: false,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export async function someFunction2() {
return await import(`path`);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use strict";

exports.__esModule = true;
exports.someFunction2 = someFunction2;

async function someFunction2() {
return await import(`path`);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this file was marked to keep dynamic import in

[path.resolve(__dirname, "../../../index.js"),
{
keepDynamicImports: [`./packages/babel-preset-gatsby-package/lib/__tests__/fixtures/keep-dynamic-import/with-override/input.js`]
}
],
],
and it in fact keep that instead of doing transformation

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const runner = require(`@babel/helper-plugin-test-runner`).default

runner(__dirname)
// runner(__dirname + `/compiler-flags`)
runner(__dirname )