@@ -356,61 +356,17 @@ export function oxcPlugin(config: ResolvedConfig): Plugin {
356
356
resolveId : {
357
357
// @ts -expect-error TODO: fix the types
358
358
filter : {
359
- id : / ^ @ b a b e l \/ r u n t i m e \/ / ,
359
+ id : / ^ @ o x c - p r o j e c t \/ r u n t i m e \/ / ,
360
360
} ,
361
361
async handler ( id , _importer , opts ) {
362
- if ( ! id . startsWith ( '@babel /runtime/' ) ) return
362
+ if ( ! id . startsWith ( '@oxc-project /runtime/' ) ) return
363
363
364
- if (
365
- id === '@babel/runtime/helpers/decorate' ||
366
- id === '@babel/runtime/helpers/decorateParam'
367
- ) {
368
- return id
369
- }
370
-
371
- // @babel /runtime imports will be injected by OXC transform
372
- // since it's injected by the transform, @babel/runtime should be resolved to the one Vite depends on
364
+ // @oxc -project/runtime imports will be injected by OXC transform
365
+ // since it's injected by the transform, @oxc-project/runtime should be resolved to the one Vite depends on
373
366
const resolved = await this . resolve ( id , _filename , opts )
374
367
return resolved
375
368
} ,
376
369
} ,
377
- // TODO: applied a workaround for now
378
- load : {
379
- handler ( id ) {
380
- if ( id === '@babel/runtime/helpers/decorateParam' ) {
381
- return `function __decorateParam(paramIndex, decorator) {
382
- return function (target, key) {
383
- decorator(target, key, paramIndex);
384
- };
385
- }
386
-
387
- export { __decorateParam as default };`
388
- }
389
- if ( id === '@babel/runtime/helpers/decorate' ) {
390
- return `function __decorate(decorators, target, key, desc) {
391
- var c = arguments.length,
392
- r =
393
- c < 3
394
- ? target
395
- : desc === null
396
- ? (desc = Object.getOwnPropertyDescriptor(target, key))
397
- : desc,
398
- d;
399
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
400
- r = Reflect.decorate(decorators, target, key, desc);
401
- else
402
- for (var i = decorators.length - 1; i >= 0; i--)
403
- if ((d = decorators[i]))
404
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
405
- return c > 3 && r && Object.defineProperty(target, key, r), r;
406
- }
407
-
408
- (module.exports = __decorate),
409
- (module.exports.__esModule = true),
410
- (module.exports["default"] = module.exports);`
411
- }
412
- } ,
413
- } ,
414
370
async transform ( code , id ) {
415
371
if ( filter ( id ) || filter ( cleanUrl ( id ) ) ) {
416
372
const modifiedOxcTransformOptions = getModifiedOxcTransformOptions (
0 commit comments