@o.z/vite-plugin-swc 0.8.0 → 0.9.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/dist/index.cjs +1 -1
- package/dist/index.js +39 -36
- package/package.json +20 -19
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require(
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("@rollup/pluginutils"),t=require("@swc/core");function n(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function r(e){return function(){var t=this,r=arguments;return new Promise(function(i,a){var o=e.apply(t,r);function s(e){n(o,i,a,s,c,`next`,e)}function c(e){n(o,i,a,s,c,`throw`,e)}s(void 0)})}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t],r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){i(e,t,n[t])})}return e}function o(e,t){if(e==null)return{};var n=s(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function s(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function c(e,t){var n,r,i,a,o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return c([e,t])}}function c(a){if(n)throw TypeError(`Generator is already executing.`);for(;o;)try{if(n=1,r&&(i=a[0]&2?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}var l=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{swcrc:!1,configFile:!1,minify:!0,jsc:{parser:{syntax:`typescript`,decorators:!0},transform:{decoratorMetadata:!0,decoratorVersion:`2022-03`}}},i=n.include,s=i===void 0?/\.(ts|tsx|js|jsx)$/:i,l=n.exclude,u=l===void 0?`node_modules`:l,d=o(n,[`include`,`exclude`]),f=(0,e.createFilter)(s,u);return{name:`vite-plugin-swc`,enforce:`pre`,config:function(){return{oxc:!1,esbuild:!1}},transform:function(e,n){return r(function(){var r,i,o;return c(this,function(s){switch(s.label){case 0:if(!f(n))return[2,null];s.label=1;case 1:return s.trys.push([1,3,,4]),r=this.environment.config.command===`build`?!!this.environment.config.build.sourcemap:!!this.environment.config.css?.devSourcemap,[4,(0,t.transform)(e,a({filename:n,sourceFileName:n.split(`?`,1)[0],sourceMaps:r},d))];case 2:return i=s.sent(),[2,{code:i.code,map:i.map}];case 3:return o=s.sent(),this.error(`SWC transform failed in ${n}: ${o?.message||o}`),[3,4];case 4:return[2]}})}).apply(this)}}};exports.default=l,exports.swc=l;
|
package/dist/index.js
CHANGED
|
@@ -46,22 +46,21 @@ function a(e) {
|
|
|
46
46
|
}
|
|
47
47
|
function o(e, t) {
|
|
48
48
|
if (e == null) return {};
|
|
49
|
-
var n =
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
var n = s(e, t), r, i;
|
|
50
|
+
if (Object.getOwnPropertySymbols) {
|
|
51
|
+
var a = Object.getOwnPropertySymbols(e);
|
|
52
|
+
for (i = 0; i < a.length; i++) r = a[i], !(t.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(e, r) && (n[r] = e[r]);
|
|
53
53
|
}
|
|
54
|
-
if (n = s(e, t), Object.getOwnPropertySymbols) for (r = Object.getOwnPropertySymbols(e), a = 0; a < r.length; a++) i = r[a], !(t.indexOf(i) >= 0) && Object.prototype.propertyIsEnumerable.call(e, i) && (n[i] = e[i]);
|
|
55
54
|
return n;
|
|
56
55
|
}
|
|
57
56
|
function s(e, t) {
|
|
58
57
|
if (e == null) return {};
|
|
59
|
-
var n = {}, r = Object.
|
|
60
|
-
for (a = 0; a < r.length; a++) i = r[a], !(t.indexOf(i) >= 0) &&
|
|
58
|
+
var n = {}, r = Object.keys(e), i, a;
|
|
59
|
+
for (a = 0; a < r.length; a++) i = r[a], !(t.indexOf(i) >= 0) && (n[i] = e[i]);
|
|
61
60
|
return n;
|
|
62
61
|
}
|
|
63
62
|
function c(e, t) {
|
|
64
|
-
var n, r, i, a = {
|
|
63
|
+
var n, r, i, a, o = {
|
|
65
64
|
label: 0,
|
|
66
65
|
sent: function() {
|
|
67
66
|
if (i[0] & 1) throw i[1];
|
|
@@ -69,63 +68,67 @@ function c(e, t) {
|
|
|
69
68
|
},
|
|
70
69
|
trys: [],
|
|
71
70
|
ops: []
|
|
72
|
-
}
|
|
73
|
-
return
|
|
71
|
+
};
|
|
72
|
+
return a = {
|
|
73
|
+
next: s(0),
|
|
74
|
+
throw: s(1),
|
|
75
|
+
return: s(2)
|
|
76
|
+
}, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
|
|
74
77
|
return this;
|
|
75
|
-
}
|
|
76
|
-
function
|
|
78
|
+
}), a;
|
|
79
|
+
function s(e) {
|
|
77
80
|
return function(t) {
|
|
78
|
-
return
|
|
81
|
+
return c([e, t]);
|
|
79
82
|
};
|
|
80
83
|
}
|
|
81
|
-
function
|
|
84
|
+
function c(a) {
|
|
82
85
|
if (n) throw TypeError("Generator is already executing.");
|
|
83
|
-
for (; o
|
|
84
|
-
if (n = 1, r && (i =
|
|
85
|
-
switch (r = 0, i && (
|
|
86
|
+
for (; o;) try {
|
|
87
|
+
if (n = 1, r && (i = a[0] & 2 ? r.return : a[0] ? r.throw || ((i = r.return) && i.call(r), 0) : r.next) && !(i = i.call(r, a[1])).done) return i;
|
|
88
|
+
switch (r = 0, i && (a = [a[0] & 2, i.value]), a[0]) {
|
|
86
89
|
case 0:
|
|
87
90
|
case 1:
|
|
88
|
-
i =
|
|
91
|
+
i = a;
|
|
89
92
|
break;
|
|
90
|
-
case 4: return
|
|
91
|
-
value:
|
|
93
|
+
case 4: return o.label++, {
|
|
94
|
+
value: a[1],
|
|
92
95
|
done: !1
|
|
93
96
|
};
|
|
94
97
|
case 5:
|
|
95
|
-
|
|
98
|
+
o.label++, r = a[1], a = [0];
|
|
96
99
|
continue;
|
|
97
100
|
case 7:
|
|
98
|
-
|
|
101
|
+
a = o.ops.pop(), o.trys.pop();
|
|
99
102
|
continue;
|
|
100
103
|
default:
|
|
101
|
-
if (
|
|
102
|
-
|
|
104
|
+
if (i = o.trys, !(i = i.length > 0 && i[i.length - 1]) && (a[0] === 6 || a[0] === 2)) {
|
|
105
|
+
o = 0;
|
|
103
106
|
continue;
|
|
104
107
|
}
|
|
105
|
-
if (
|
|
106
|
-
|
|
108
|
+
if (a[0] === 3 && (!i || a[1] > i[0] && a[1] < i[3])) {
|
|
109
|
+
o.label = a[1];
|
|
107
110
|
break;
|
|
108
111
|
}
|
|
109
|
-
if (
|
|
110
|
-
|
|
112
|
+
if (a[0] === 6 && o.label < i[1]) {
|
|
113
|
+
o.label = i[1], i = a;
|
|
111
114
|
break;
|
|
112
115
|
}
|
|
113
|
-
if (i &&
|
|
114
|
-
|
|
116
|
+
if (i && o.label < i[2]) {
|
|
117
|
+
o.label = i[2], o.ops.push(a);
|
|
115
118
|
break;
|
|
116
119
|
}
|
|
117
|
-
i[2] &&
|
|
120
|
+
i[2] && o.ops.pop(), o.trys.pop();
|
|
118
121
|
continue;
|
|
119
122
|
}
|
|
120
|
-
|
|
123
|
+
a = t.call(e, o);
|
|
121
124
|
} catch (e) {
|
|
122
|
-
|
|
125
|
+
a = [6, e], r = 0;
|
|
123
126
|
} finally {
|
|
124
127
|
n = i = 0;
|
|
125
128
|
}
|
|
126
|
-
if (
|
|
129
|
+
if (a[0] & 5) throw a[1];
|
|
127
130
|
return {
|
|
128
|
-
value:
|
|
131
|
+
value: a[0] ? a[1] : void 0,
|
|
129
132
|
done: !0
|
|
130
133
|
};
|
|
131
134
|
}
|
|
@@ -181,7 +184,7 @@ var l = function() {
|
|
|
181
184
|
case 4: return [2];
|
|
182
185
|
}
|
|
183
186
|
});
|
|
184
|
-
}).
|
|
187
|
+
}).apply(this);
|
|
185
188
|
}
|
|
186
189
|
};
|
|
187
190
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o.z/vite-plugin-swc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "A high-performance Vite plugin that transforms TypeScript and JavaScript files using SWC for lightning-fast builds",
|
|
5
5
|
"homepage": "https://github.com/z-npm/vite-plugin-swc#readme",
|
|
6
6
|
"docs": "https://github.com/z-npm/vite-plugin-swc#readme",
|
|
@@ -90,29 +90,30 @@
|
|
|
90
90
|
"test:coverage": "vitest run --coverage"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
+
"@swc/wasm": "^1.16.1",
|
|
93
94
|
"@testing-library/dom": "^10.4.1",
|
|
94
|
-
"@testing-library/user-event": "^14.6.
|
|
95
|
-
"@types/jsdom": "^
|
|
96
|
-
"@types/node": "^
|
|
97
|
-
"@vitest/coverage-v8": "^4.1.
|
|
98
|
-
"@vitest/ui": "^4.1.
|
|
95
|
+
"@testing-library/user-event": "^14.6.6",
|
|
96
|
+
"@types/jsdom": "^30.0.0",
|
|
97
|
+
"@types/node": "^26.4.0",
|
|
98
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
99
|
+
"@vitest/ui": "^4.1.11",
|
|
99
100
|
"glob": "^13.0.6",
|
|
100
|
-
"jsdom": "^
|
|
101
|
-
"rollup-plugin-node-externals": "^
|
|
102
|
-
"sass": "^1.
|
|
103
|
-
"typedoc": "^0.28.
|
|
104
|
-
"typedoc-plugin-markdown": "^4.
|
|
105
|
-
"typescript": "
|
|
106
|
-
"vite": "^8.
|
|
107
|
-
"vite-plugin-dts": "^
|
|
108
|
-
"vite-plugin-lib-inject-css": "
|
|
109
|
-
"vitest": "^4.1.
|
|
101
|
+
"jsdom": "^30.0.1",
|
|
102
|
+
"rollup-plugin-node-externals": "^9.0.1",
|
|
103
|
+
"sass": "^1.103.1",
|
|
104
|
+
"typedoc": "^0.28.20",
|
|
105
|
+
"typedoc-plugin-markdown": "^4.13.0",
|
|
106
|
+
"typescript": "~6.0.2",
|
|
107
|
+
"vite": "^8.2.2",
|
|
108
|
+
"vite-plugin-dts": "^5.0.1",
|
|
109
|
+
"vite-plugin-lib-inject-css": "2.0.1",
|
|
110
|
+
"vitest": "^4.1.11"
|
|
110
111
|
},
|
|
111
112
|
"dependencies": {
|
|
112
|
-
"@rollup/pluginutils": "^5.
|
|
113
|
-
"@swc/core": "
|
|
113
|
+
"@rollup/pluginutils": "^5.4.0",
|
|
114
|
+
"@swc/core": "1.3.106"
|
|
114
115
|
},
|
|
115
|
-
"packageManager": "yarn@4.
|
|
116
|
+
"packageManager": "yarn@4.18.0",
|
|
116
117
|
"types": "./dist/index.d.ts",
|
|
117
118
|
"module": "./dist/index.js",
|
|
118
119
|
"main": "./dist/index.cjs",
|