Skip to content

Commit fe61c6e

Browse files
committed
style: format with prettier v3
1 parent 09c1e7d commit fe61c6e

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

src/babel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ export default function transform(opts: TransformOptions): TRANSFORM_RESULT {
3838
// `unshift` because these plugin must come before `@babel/plugin-syntax-class-properties`
3939
_opts.plugins.unshift(
4040
[require("babel-plugin-transform-typescript-metadata")],
41-
[require("@babel/plugin-proposal-decorators"), { legacy: true }]
41+
[require("@babel/plugin-proposal-decorators"), { legacy: true }],
4242
);
4343
_opts.plugins.push(require("babel-plugin-parameter-decorator"));
4444
_opts.plugins.push(require("@babel/plugin-syntax-import-assertions"));
4545
}
4646

4747
if (opts.legacy) {
4848
_opts.plugins.push(
49-
require("@babel/plugin-proposal-nullish-coalescing-operator")
49+
require("@babel/plugin-proposal-nullish-coalescing-operator"),
5050
);
5151
_opts.plugins.push(require("@babel/plugin-proposal-optional-chaining"));
5252
}

src/jiti.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default function createJITI(
7676
_filename: string,
7777
opts: JITIOptions = {},
7878
parentModule?: Module,
79-
parentCache?: ModuleCache
79+
parentCache?: ModuleCache,
8080
): JITI {
8181
opts = { ...defaults, ...opts };
8282

@@ -100,12 +100,12 @@ export default function createJITI(
100100
const isNativeRe = new RegExp(
101101
`node_modules/(${nativeModules
102102
.map((m) => escapeStringRegexp(m))
103-
.join("|")})/`
103+
.join("|")})/`,
104104
);
105105
const isTransformRe = new RegExp(
106106
`node_modules/(${transformModules
107107
.map((m) => escapeStringRegexp(m))
108-
.join("|")})/`
108+
.join("|")})/`,
109109
);
110110

111111
function debug(...args: string[]) {
@@ -141,7 +141,7 @@ export default function createJITI(
141141
const nativeRequire = createRequire(
142142
isWindows
143143
? _filename.replace(/\//g, "\\") // Import maps does not work with normalized paths!
144-
: _filename
144+
: _filename,
145145
);
146146

147147
const tryResolve = (id: string, options?: { paths?: string[] }) => {
@@ -152,7 +152,7 @@ export default function createJITI(
152152

153153
const _url = pathToFileURL(_filename);
154154
const _additionalExts = [...(opts.extensions as string[])].filter(
155-
(ext) => ext !== ".js"
155+
(ext) => ext !== ".js",
156156
);
157157
const _resolve = (id: string, options?: { paths?: string[] }) => {
158158
let resolved, err;
@@ -211,7 +211,7 @@ export default function createJITI(
211211
function getCache(
212212
filename: string | undefined,
213213
source: string,
214-
get: () => string
214+
get: () => string,
215215
): string {
216216
if (!opts.cache || !filename) {
217217
return get();
@@ -224,7 +224,7 @@ export default function createJITI(
224224
const filebase = basename(dirname(filename)) + "-" + basename(filename);
225225
const cacheFile = join(
226226
opts.cache as string,
227-
filebase + "." + md5(filename) + ".js"
227+
filebase + "." + md5(filename) + ".js",
228228
);
229229

230230
if (existsSync(cacheFile)) {
@@ -362,7 +362,7 @@ export default function createJITI(
362362
debug(
363363
`[transpile]${isNativeModule ? " [esm]" : ""}`,
364364
filename,
365-
`(${time}ms)`
365+
`(${time}ms)`,
366366
);
367367
} else {
368368
try {
@@ -426,7 +426,7 @@ export default function createJITI(
426426
mod.require,
427427
mod,
428428
mod.filename,
429-
dirname(mod.filename)
429+
dirname(mod.filename),
430430
);
431431
} catch (error: any) {
432432
if (opts.requireCache) {
@@ -459,7 +459,7 @@ export default function createJITI(
459459
return addHook(
460460
(source: string, filename: string) =>
461461
jiti.transform({ source, filename, ts: !!/\.[cm]?ts$/.test(filename) }),
462-
{ exts: opts.extensions }
462+
{ exts: opts.extensions },
463463
);
464464
}
465465

src/plugins/babel-plugin-transform-import-meta.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { Statement, MemberExpression } from "@babel/types";
77
// Modification: Inlines resolved filename into the code when possible instead of injecting a require
88
export function TransformImportMetaPlugin(
99
_ctx: any,
10-
opts: { filename?: string }
10+
opts: { filename?: string },
1111
) {
1212
return <PluginObj>{
1313
name: "transform-import-meta",
@@ -41,7 +41,7 @@ export function TransformImportMetaPlugin(
4141
opts.filename
4242
? JSON.stringify(pathToFileURL(opts.filename))
4343
: "require('url').pathToFileURL(__filename).toString()"
44-
}` as Statement
44+
}` as Statement,
4545
);
4646
}
4747
},

src/plugins/import-meta-env.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const accessor = `process.env`;
3535

3636
const replaceEnvForRuntime = (
3737
template: typeof BabelCore.template,
38-
property: string
38+
property: string,
3939
) => template.expression.ast(`${accessor}.${property}`);
4040

4141
export function importMetaEnvPlugin({ template, types }: any) {
@@ -97,7 +97,7 @@ export function importMetaEnvPlugin({ template, types }: any) {
9797

9898
path.parentPath.replaceWith(
9999
// @ts-ignore
100-
replaceEnvForRuntime(template, path.parentPath.node.property.name)
100+
replaceEnvForRuntime(template, path.parentPath.node.property.name),
101101
);
102102
},
103103
},

test/fixtures/typescript/decorators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function anotherDecorator() {
77
return function (object: any, propertyName: any) {
88
console.log(
99
"Decorator metadata keys: " +
10-
Reflect.getMetadataKeys(object, propertyName)
10+
Reflect.getMetadataKeys(object, propertyName),
1111
);
1212
};
1313
}

test/fixtures/typescript/satisfies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const normalizeUserEntity = (({ name, avatar }: User) =>
3939
width: 100,
4040
height: 100,
4141
},
42-
} satisfies NormalizedUser)) satisfies UserNormalizer;
42+
}) satisfies NormalizedUser) satisfies UserNormalizer;
4343

4444
export const test = () => {
4545
return {

0 commit comments

Comments
 (0)