From b5ee6a4b695244e0bf120d466b061ea10fc5ed14 Mon Sep 17 00:00:00 2001 From: Hiroki Osame Date: Mon, 15 Jul 2024 11:04:38 +0900 Subject: [PATCH 1/4] ci: run on master --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cef498c..3b0963a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Test on: push: - branches: [develop] + branches: [master, develop] pull_request: jobs: test: From 0e623be1371d20e677a1dc6d65c6e58b9db5136d Mon Sep 17 00:00:00 2001 From: Hiroki Osame Date: Mon, 15 Jul 2024 11:06:09 +0900 Subject: [PATCH 2/4] style: lint fix --- tests/specs/tsconfig.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/specs/tsconfig.ts b/tests/specs/tsconfig.ts index d196068..e517a10 100644 --- a/tests/specs/tsconfig.ts +++ b/tests/specs/tsconfig.ts @@ -13,7 +13,7 @@ const detectStrictMode = '(function() { return !this; })()'; export default testSuite(({ describe }) => { describe('tsconfig', ({ describe }) => { describe('loader', ({ test }) => { - test('finds tsconfig.json and applies strict mode', async ({ onTestFinish }) => { + test('finds tsconfig.json and applies strict mode', async () => { await using fixture = await createFixture({ src: { 'index.ts': `module.exports = [ @@ -79,7 +79,7 @@ export default testSuite(({ describe }) => { ).toStrictEqual([true, false, true]); }); - test('handles resource with query', async ({ onTestFinish }) => { + test('handles resource with query', async () => { await using fixture = await createFixture({ src: { 'index.ts': `module.exports = [${detectStrictMode}, require("./not-strict.ts?some-query")];`, @@ -133,7 +133,7 @@ export default testSuite(({ describe }) => { ).toStrictEqual([true, false]); }); - test('accepts custom tsconfig.json path', async ({ onTestFinish }) => { + test('accepts custom tsconfig.json path', async () => { await using fixture = await createFixture({ src: { 'index.ts': `module.exports = [${detectStrictMode}, require("./strict.ts")];`, @@ -192,7 +192,7 @@ export default testSuite(({ describe }) => { ).toStrictEqual([true, true]); }); - test('applies different tsconfig.json paths', async ({ onTestFinish }) => { + test('applies different tsconfig.json paths', async () => { await using fixture = await createFixture({ src: { 'index.ts': 'export class C { foo = 100; }', @@ -270,7 +270,7 @@ export default testSuite(({ describe }) => { * Since the plugin applies on distribution assets, it should not apply * any tsconfig settings. */ - test('should not detect tsconfig.json and apply strict mode', async ({ onTestFinish }) => { + test('should not detect tsconfig.json and apply strict mode', async () => { await using fixture = await createFixture({ src: { 'index.js': 'console.log(1)', From a89e486a650b61d471bd71f0c9d3c7c33869cf46 Mon Sep 17 00:00:00 2001 From: Hiroki Osame Date: Mon, 15 Jul 2024 11:07:02 +0900 Subject: [PATCH 3/4] style: add tsconfig.json lib for type check to pass --- tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tsconfig.json b/tsconfig.json index 6696b1b..e262f52 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "target": "es2022", + "lib": ["ESNext"], "moduleDetection": "force", "module": "preserve", From 3dd11071fd1c773d1e61aabcf33d3ff0daf942db Mon Sep 17 00:00:00 2001 From: Hiroki Osame Date: Mon, 15 Jul 2024 11:33:37 +0900 Subject: [PATCH 4/4] fix: explicitly import webpack as type --- src/plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugin.ts b/src/plugin.ts index 6c6b251..199fd1e 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -3,8 +3,8 @@ import { RawSource as WP4RawSource, SourceMapSource as WP4SourceMapSource, } from 'webpack-sources'; -import webpack4 from 'webpack'; -import webpack5 from 'webpack5'; +import type webpack4 from 'webpack'; +import type webpack5 from 'webpack5'; import ModuleFilenameHelpers from 'webpack/lib/ModuleFilenameHelpers.js'; import { version } from '../package.json'; import type { EsbuildPluginOptions } from './types.js';