This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Ability to pass custom options #6
Comments
register(); <---------
function register(opts) {
if (opts === void 0) { opts = {}; }
// Clone to avoid mutating the arguments object with the 'delete's below.
opts = __assign({}, opts);
hookExtensions(opts.extensions || swc.DEFAULT_EXTENSIONS);
delete opts.extensions;
transformOpts = __assign(__assign({}, opts), { caller: __assign({ name: "@swc/register" }, (opts.caller || {})) });
var _a = transformOpts.cwd, cwd = _a === void 0 ? "." : _a;
// Ensure that the working directory is resolved up front so that
// things don't break if it changes later.
cwd = transformOpts.cwd = path_1.default.resolve(cwd);
if (transformOpts.ignore === undefined && transformOpts.only === undefined) {
transformOpts.only = [
// Only compile things inside the current working directory.
new RegExp("^" + lodash_escaperegexp_1.default(cwd), "i")
];
transformOpts.ignore = [
// Ignore any node_modules inside the current working directory.
new RegExp("^" +
lodash_escaperegexp_1.default(cwd) +
"(?:" +
path_1.default.sep +
".*)?" +
lodash_escaperegexp_1.default(path_1.default.sep + "node_modules" + path_1.default.sep), "i")
];
}
}
exports.default = register; There currently appears to be a way by using the default export, but the |
Just looked and realized you can already do this. Here's the PR that docs it: https://github.com/swc-project/register/pull/15/files Close this? |
It's possible but the types in d.ts are incorrect |
Hey folks! Its been a while, are you still supporting this package? In case you need example of import type { Swcrc } from '@swc/core'
declare module '@swc/register' {
export default function register(options?: Swcrc): void
} |
Hello everyone, does the "swc-node" support custom options? |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If I understand correctly
swc-register
will at the moment use.swcrc
for options. Could we have ability to pass custom options in code API similar to@babel/register
: https://babeljs.io/docs/en/babel-register/#specifying-optionsThe text was updated successfully, but these errors were encountered: