@pi-r/babel 0.11.2 → 0.12.0
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/index.js +7 -6
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
2
|
+
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const { asFunction } = require('@e-mc/types');
|
|
5
5
|
const MATCH_PATTERN = ['babelrcRoots', 'include', 'exclude', 'ignore', 'only'];
|
|
6
6
|
function checkMatchPattern(options) {
|
|
7
7
|
for (const attr of MATCH_PATTERN) {
|
|
@@ -10,7 +10,7 @@ function checkMatchPattern(options) {
|
|
|
10
10
|
if (typeof value === 'string') {
|
|
11
11
|
const out = parseString(value);
|
|
12
12
|
if (out !== null) {
|
|
13
|
-
options[attr] = out;
|
|
13
|
+
options[attr] = [out];
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
else if (Array.isArray(value)) {
|
|
@@ -29,7 +29,7 @@ function checkMatchPattern(options) {
|
|
|
29
29
|
return options;
|
|
30
30
|
}
|
|
31
31
|
function parseString(value) {
|
|
32
|
-
if (
|
|
32
|
+
if (/^\/(?:[^/]|(?<=\\)\/)+\/[dgimsuvy]*$/.test(value)) {
|
|
33
33
|
if (!value.includes('**')) {
|
|
34
34
|
try {
|
|
35
35
|
const pattern = eval(value);
|
|
@@ -42,7 +42,7 @@ function parseString(value) {
|
|
|
42
42
|
}
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
|
-
return
|
|
45
|
+
return asFunction(value);
|
|
46
46
|
}
|
|
47
47
|
function transform(context, value, options) {
|
|
48
48
|
context = options.upgrade(context, __dirname, '@babel/core');
|
|
@@ -101,4 +101,5 @@ function transform(context, value, options) {
|
|
|
101
101
|
return code;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
+
|
|
104
105
|
module.exports = transform;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/babel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Babel transform function for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/core": "^7.29.0",
|
|
23
|
-
"@e-mc/types": "^0.
|
|
23
|
+
"@e-mc/types": "^0.14.0"
|
|
24
24
|
}
|
|
25
25
|
}
|