Skip to content

Commit

Permalink
feat: Add new version of SWC to fix gulpjs#98
Browse files Browse the repository at this point in the history
From fork codermarcos/interpret

On branch master
Changes to be committed:
	modified:   index.js
  • Loading branch information
codermarcos committed Mar 28, 2024
1 parent 972be61 commit 5c551c7
Showing 1 changed file with 233 additions and 82 deletions.
315 changes: 233 additions & 82 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,100 +263,204 @@ var extensions = {
hook.registerTSX(config);
},
},
'.swc.js': {
module: '@swc/register',
register: function (hook, config) {
config = config || {
only: [endsInSwcJs],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'ecmascript',
'.swc.js': [
{
module: '@swc-node/register',
register: function (mod, config) {
config = config || {
only: [endsInSwcJs],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'ecmascript',
},
},
},
module: {
type: 'commonjs',
},
};
module: {
type: 'commonjs',
},
};

hook(
Object.assign({}, config, {
extensions: '.js',
})
);
mod.register(
Object.assign({}, config, {
extensions: '.js',
})
);
},
},
},
'.swc.jsx': {
module: '@swc/register',
register: function (hook, config) {
config = config || {
only: [endsInSwcJsx],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'ecmascript',
jsx: true,
{
module: '@swc/register',
register: function (hook, config) {
config = config || {
only: [endsInSwcJs],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'ecmascript',
},
},
},
module: {
type: 'commonjs',
},
};
module: {
type: 'commonjs',
},
};

console.log(hook)

hook(
Object.assign({}, config, {
extensions: '.js',
})
);
},
}
],
'.swc.jsx': [
{
module: '@swc-node/register',
register: function (mod, config) {
config = config || {
only: [endsInSwcJsx],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'ecmascript',
jsx: true,
},
},
module: {
type: 'commonjs',
},
};

hook(
Object.assign({}, config, {
extensions: '.jsx',
})
);
mod.register(
Object.assign({}, config, {
extensions: '.jsx',
})
);
},
},
},
'.swc.ts': {
module: '@swc/register',
register: function (hook, config) {
config = config || {
only: [endsInSwcTs],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'typescript',
{
module: '@swc/register',
register: function (hook, config) {
config = config || {
only: [endsInSwcJsx],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'ecmascript',
jsx: true,
},
},
},
module: {
type: 'commonjs',
},
};
module: {
type: 'commonjs',
},
};

hook(
Object.assign({}, config, {
extensions: '.jsx',
})
);
},
}
],
'.swc.ts': [
{
module: '@swc-node/register',
register: function (mod, config) {
config = config || {
only: [endsInSwcTs],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'typescript',
},
},
module: {
type: 'commonjs',
},
};

hook(
Object.assign({}, config, {
extensions: '.ts',
})
);
mod.register(
Object.assign({}, config, {
extensions: '.ts',
})
);
},
},
},
'.swc.tsx': {
module: '@swc/register',
register: function (hook, config) {
config = config || {
only: [endsInSwcTsx],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
{
module: '@swc/register',
register: function (hook, config) {
config = config || {
only: [endsInSwcTs],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'typescript',
},
},
},
module: {
type: 'commonjs',
},
};
module: {
type: 'commonjs',
},
};

hook(
Object.assign({}, config, {
extensions: '.ts',
})
);
},
}
],
'.swc.tsx': [
{
module: '@swc-node/register',
register: function (mod, config) {
config = config || {
only: [endsInSwcTsx],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
},
module: {
type: 'commonjs',
},
};

hook(
Object.assign({}, config, {
extensions: '.tsx',
})
);
mod.register(
Object.assign({}, config, {
extensions: '.tsx',
})
);
},
},
},
{
module: '@swc/register',
register: function (hook, config) {
config = config || {
only: [endsInSwcTsx],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
},
module: {
type: 'commonjs',
},
};

hook(
Object.assign({}, config, {
extensions: '.tsx',
})
);
},
}
],
'.toml': {
module: 'toml-require',
register: function (hook, config) {
Expand Down Expand Up @@ -401,6 +505,29 @@ var extensions = {
);
},
},
{
module: '@swc-node/register',
register: function (mod, config) {
config = config || {
only: [endsInTs],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'typescript',
},
},
module: {
type: 'commonjs',
},
};

mod.register(
Object.assign({}, config, {
extensions: '.ts',
})
);
},
},
{
module: '@swc/register',
register: function (hook, config) {
Expand Down Expand Up @@ -474,6 +601,30 @@ var extensions = {
);
},
},
{
module: '@swc-node/register',
register: function (mod, config) {
config = config || {
only: [endsInTsx],
ignore: [isNodeModules],
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
},
module: {
type: 'commonjs',
},
};

mod.register(
Object.assign({}, config, {
extensions: '.tsx',
})
);
},
},
{
module: '@swc/register',
register: function (hook, config) {
Expand Down

0 comments on commit 5c551c7

Please sign in to comment.