@rollup/plugin-babel 5.3.0 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/index.es.js +10 -11
- package/dist/index.js +12 -13
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -327,7 +327,7 @@ It's main purpose is to allow other tools for configuration of transpilation wit
|
|
|
327
327
|
```js
|
|
328
328
|
import { createBabelInputPluginFactory } from '@rollup/plugin-babel';
|
|
329
329
|
|
|
330
|
-
export default createBabelInputPluginFactory(babelCore => {
|
|
330
|
+
export default createBabelInputPluginFactory((babelCore) => {
|
|
331
331
|
function myPlugin() {
|
|
332
332
|
return {
|
|
333
333
|
visitor: {}
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as babel from '@babel/core';
|
|
2
|
-
import { transformAsync, loadPartialConfigAsync, loadPartialConfig, buildExternalHelpers, DEFAULT_EXTENSIONS } from '@babel/core';
|
|
3
2
|
import { createFilter } from '@rollup/pluginutils';
|
|
4
3
|
import { addNamed } from '@babel/helper-module-imports';
|
|
5
4
|
|
|
@@ -160,12 +159,13 @@ function helpersTestTransform() {
|
|
|
160
159
|
};
|
|
161
160
|
}
|
|
162
161
|
|
|
163
|
-
const mismatchError = (actual, expected, filename) => `You have declared using "${expected}" babelHelpers, but transforming ${filename} resulted in "${actual}". Please check your configuration.`;
|
|
162
|
+
const mismatchError = (actual, expected, filename) => `You have declared using "${expected}" babelHelpers, but transforming ${filename} resulted in "${actual}". Please check your configuration.`; // Revert to /\/helpers\/(esm\/)?inherits/ when Babel 8 gets released, this was fixed in https://github.com/babel/babel/issues/14185
|
|
164
163
|
|
|
165
|
-
|
|
164
|
+
|
|
165
|
+
const inheritsHelperRe = /[\\/]+helpers[\\/]+(esm[\\/]+)?inherits/;
|
|
166
166
|
async function preflightCheck(ctx, babelHelpers, transformOptions) {
|
|
167
167
|
const finalOptions = addBabelPlugin(transformOptions, helpersTestTransform);
|
|
168
|
-
const check = (await transformAsync(PREFLIGHT_INPUT, finalOptions)).code; // Babel sometimes splits ExportDefaultDeclaration into 2 statements, so we also check for ExportNamedDeclaration
|
|
168
|
+
const check = (await babel.transformAsync(PREFLIGHT_INPUT, finalOptions)).code; // Babel sometimes splits ExportDefaultDeclaration into 2 statements, so we also check for ExportNamedDeclaration
|
|
169
169
|
|
|
170
170
|
if (!/export (d|{)/.test(check)) {
|
|
171
171
|
ctx.error(MODULE_ERROR);
|
|
@@ -205,7 +205,7 @@ async function preflightCheck(ctx, babelHelpers, transformOptions) {
|
|
|
205
205
|
|
|
206
206
|
async function transformCode(inputCode, babelOptions, overrides, customOptions, ctx, finalizeOptions) {
|
|
207
207
|
// loadPartialConfigAsync has become available in @babel/core@7.8.0
|
|
208
|
-
const config = await (loadPartialConfigAsync || loadPartialConfig)(babelOptions); // file is ignored by babel
|
|
208
|
+
const config = await (babel.loadPartialConfigAsync || babel.loadPartialConfig)(babelOptions); // file is ignored by babel
|
|
209
209
|
|
|
210
210
|
if (!config) {
|
|
211
211
|
return null;
|
|
@@ -224,14 +224,14 @@ async function transformCode(inputCode, babelOptions, overrides, customOptions,
|
|
|
224
224
|
const {
|
|
225
225
|
code,
|
|
226
226
|
map
|
|
227
|
-
} = await transformAsync(inputCode, transformOptions);
|
|
227
|
+
} = await babel.transformAsync(inputCode, transformOptions);
|
|
228
228
|
return {
|
|
229
229
|
code,
|
|
230
230
|
map
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
const result = await transformAsync(inputCode, transformOptions);
|
|
234
|
+
const result = await babel.transformAsync(inputCode, transformOptions);
|
|
235
235
|
const {
|
|
236
236
|
code,
|
|
237
237
|
map
|
|
@@ -249,7 +249,7 @@ async function transformCode(inputCode, babelOptions, overrides, customOptions,
|
|
|
249
249
|
|
|
250
250
|
const unpackOptions = (_ref = {}) => {
|
|
251
251
|
let {
|
|
252
|
-
extensions = DEFAULT_EXTENSIONS,
|
|
252
|
+
extensions = babel.DEFAULT_EXTENSIONS,
|
|
253
253
|
// rollup uses sourcemap, babel uses sourceMaps
|
|
254
254
|
// just normalize them here so people don't have to worry about it
|
|
255
255
|
sourcemap = true,
|
|
@@ -402,7 +402,7 @@ function createBabelInputPluginFactory(customCallback = returnObject) {
|
|
|
402
402
|
return null;
|
|
403
403
|
}
|
|
404
404
|
|
|
405
|
-
return buildExternalHelpers(null, 'module');
|
|
405
|
+
return babel.buildExternalHelpers(null, 'module');
|
|
406
406
|
},
|
|
407
407
|
|
|
408
408
|
transform(code, filename) {
|
|
@@ -485,5 +485,4 @@ function createBabelOutputPluginFactory(customCallback = returnObject) {
|
|
|
485
485
|
const getBabelInputPlugin = createBabelInputPluginFactory();
|
|
486
486
|
const getBabelOutputPlugin = createBabelOutputPluginFactory();
|
|
487
487
|
|
|
488
|
-
export default getBabelInputPlugin;
|
|
489
|
-
export { getBabelInputPlugin as babel, createBabelInputPluginFactory, createBabelOutputPluginFactory, getBabelInputPlugin, getBabelOutputPlugin };
|
|
488
|
+
export { getBabelInputPlugin as babel, createBabelInputPluginFactory, createBabelOutputPluginFactory, getBabelInputPlugin as default, getBabelInputPlugin, getBabelOutputPlugin };
|
package/dist/index.js
CHANGED
|
@@ -15,14 +15,12 @@ function _interopNamespace(e) {
|
|
|
15
15
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
16
|
Object.defineProperty(n, k, d.get ? d : {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () {
|
|
19
|
-
return e[k];
|
|
20
|
-
}
|
|
18
|
+
get: function () { return e[k]; }
|
|
21
19
|
});
|
|
22
20
|
}
|
|
23
21
|
});
|
|
24
22
|
}
|
|
25
|
-
n[
|
|
23
|
+
n["default"] = e;
|
|
26
24
|
return Object.freeze(n);
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -185,12 +183,13 @@ function helpersTestTransform() {
|
|
|
185
183
|
};
|
|
186
184
|
}
|
|
187
185
|
|
|
188
|
-
const mismatchError = (actual, expected, filename) => `You have declared using "${expected}" babelHelpers, but transforming ${filename} resulted in "${actual}". Please check your configuration.`;
|
|
186
|
+
const mismatchError = (actual, expected, filename) => `You have declared using "${expected}" babelHelpers, but transforming ${filename} resulted in "${actual}". Please check your configuration.`; // Revert to /\/helpers\/(esm\/)?inherits/ when Babel 8 gets released, this was fixed in https://github.com/babel/babel/issues/14185
|
|
187
|
+
|
|
189
188
|
|
|
190
|
-
const inheritsHelperRe =
|
|
189
|
+
const inheritsHelperRe = /[\\/]+helpers[\\/]+(esm[\\/]+)?inherits/;
|
|
191
190
|
async function preflightCheck(ctx, babelHelpers, transformOptions) {
|
|
192
191
|
const finalOptions = addBabelPlugin(transformOptions, helpersTestTransform);
|
|
193
|
-
const check = (await
|
|
192
|
+
const check = (await babel__namespace.transformAsync(PREFLIGHT_INPUT, finalOptions)).code; // Babel sometimes splits ExportDefaultDeclaration into 2 statements, so we also check for ExportNamedDeclaration
|
|
194
193
|
|
|
195
194
|
if (!/export (d|{)/.test(check)) {
|
|
196
195
|
ctx.error(MODULE_ERROR);
|
|
@@ -230,7 +229,7 @@ async function preflightCheck(ctx, babelHelpers, transformOptions) {
|
|
|
230
229
|
|
|
231
230
|
async function transformCode(inputCode, babelOptions, overrides, customOptions, ctx, finalizeOptions) {
|
|
232
231
|
// loadPartialConfigAsync has become available in @babel/core@7.8.0
|
|
233
|
-
const config = await (
|
|
232
|
+
const config = await (babel__namespace.loadPartialConfigAsync || babel__namespace.loadPartialConfig)(babelOptions); // file is ignored by babel
|
|
234
233
|
|
|
235
234
|
if (!config) {
|
|
236
235
|
return null;
|
|
@@ -249,14 +248,14 @@ async function transformCode(inputCode, babelOptions, overrides, customOptions,
|
|
|
249
248
|
const {
|
|
250
249
|
code,
|
|
251
250
|
map
|
|
252
|
-
} = await
|
|
251
|
+
} = await babel__namespace.transformAsync(inputCode, transformOptions);
|
|
253
252
|
return {
|
|
254
253
|
code,
|
|
255
254
|
map
|
|
256
255
|
};
|
|
257
256
|
}
|
|
258
257
|
|
|
259
|
-
const result = await
|
|
258
|
+
const result = await babel__namespace.transformAsync(inputCode, transformOptions);
|
|
260
259
|
const {
|
|
261
260
|
code,
|
|
262
261
|
map
|
|
@@ -274,7 +273,7 @@ async function transformCode(inputCode, babelOptions, overrides, customOptions,
|
|
|
274
273
|
|
|
275
274
|
const unpackOptions = (_ref = {}) => {
|
|
276
275
|
let {
|
|
277
|
-
extensions =
|
|
276
|
+
extensions = babel__namespace.DEFAULT_EXTENSIONS,
|
|
278
277
|
// rollup uses sourcemap, babel uses sourceMaps
|
|
279
278
|
// just normalize them here so people don't have to worry about it
|
|
280
279
|
sourcemap = true,
|
|
@@ -427,7 +426,7 @@ function createBabelInputPluginFactory(customCallback = returnObject) {
|
|
|
427
426
|
return null;
|
|
428
427
|
}
|
|
429
428
|
|
|
430
|
-
return
|
|
429
|
+
return babel__namespace.buildExternalHelpers(null, 'module');
|
|
431
430
|
},
|
|
432
431
|
|
|
433
432
|
transform(code, filename) {
|
|
@@ -513,6 +512,6 @@ const getBabelOutputPlugin = createBabelOutputPluginFactory();
|
|
|
513
512
|
exports.babel = getBabelInputPlugin;
|
|
514
513
|
exports.createBabelInputPluginFactory = createBabelInputPluginFactory;
|
|
515
514
|
exports.createBabelOutputPluginFactory = createBabelOutputPluginFactory;
|
|
516
|
-
exports
|
|
515
|
+
exports["default"] = getBabelInputPlugin;
|
|
517
516
|
exports.getBabelInputPlugin = getBabelInputPlugin;
|
|
518
517
|
exports.getBabelOutputPlugin = getBabelOutputPlugin;
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rollup/plugin-babel",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"description": "Seamless integration between Rollup and Babel.",
|
|
8
8
|
"license": "MIT",
|
|
9
|
-
"repository":
|
|
9
|
+
"repository": {
|
|
10
|
+
"url": "rollup/plugins",
|
|
11
|
+
"directory": "packages/babel"
|
|
12
|
+
},
|
|
10
13
|
"author": "Rich Harris",
|
|
11
14
|
"homepage": "https://github.com/rollup/plugins/tree/master/packages/babel#readme",
|
|
12
15
|
"bugs": "https://github.com/rollup/plugins/issues",
|
|
@@ -17,17 +20,14 @@
|
|
|
17
20
|
},
|
|
18
21
|
"scripts": {
|
|
19
22
|
"build": "rollup -c",
|
|
20
|
-
"ci:coverage": "nyc pnpm
|
|
21
|
-
"ci:lint": "pnpm
|
|
23
|
+
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov",
|
|
24
|
+
"ci:lint": "pnpm build && pnpm lint",
|
|
22
25
|
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
|
|
23
|
-
"ci:test": "pnpm
|
|
24
|
-
"lint": "pnpm run lint:js && pnpm run lint:docs && pnpm run lint:package",
|
|
25
|
-
"lint:docs": "prettier --single-quote --arrow-parens avoid --trailing-comma none --write README.md",
|
|
26
|
-
"lint:js": "eslint --fix --cache src test",
|
|
27
|
-
"lint:package": "prettier --write package.json --plugin=prettier-plugin-package",
|
|
26
|
+
"ci:test": "pnpm test -- --verbose",
|
|
28
27
|
"prebuild": "del-cli dist",
|
|
29
|
-
"
|
|
30
|
-
"pretest": "pnpm
|
|
28
|
+
"prerelease": "pnpm build",
|
|
29
|
+
"pretest": "pnpm build",
|
|
30
|
+
"release": "pnpm plugin:release --workspace-root -- --pkg $npm_package_name",
|
|
31
31
|
"test": "ava",
|
|
32
32
|
"test:ts": "tsc types/index.d.ts test/types.ts --noEmit"
|
|
33
33
|
},
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@rollup/plugin-json": "^4.1.0",
|
|
70
70
|
"@rollup/plugin-node-resolve": "^10.0.0",
|
|
71
71
|
"@types/babel__core": "^7.1.9",
|
|
72
|
-
"rollup": "^2.
|
|
72
|
+
"rollup": "^2.67.3",
|
|
73
73
|
"source-map": "^0.7.3"
|
|
74
74
|
},
|
|
75
75
|
"types": "types/index.d.ts",
|