Skip to content

Commit 9cce17e

Browse files
committed
refactor(linter/plugins): remove oxlint/plugins export (oxc-project#18829)
Continuation of oxc-project#18824, oxc-project#18828, oxc-project#18903. Remove the `oxlint/plugins` export and the `plugins.ts` entry point. These are now only used in tests, where the files can be loaded from `dist-pkg-plugins` instead. We don't want to encourage people to use `oxlint/plugins` in their plugins - they should be using `@oxlint/plugins` package instead to avoid their plugin having a dependency on `oxlint`. Due to less shared dependencies between files, this results in 5 less files in `dist` directory in release build. This also allows re-enabling the debug assertions in this code in tests.
1 parent 0182779 commit 9cce17e

3 files changed

Lines changed: 11 additions & 18 deletions

File tree

apps/oxlint/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@
88
"main": "dist/index.js",
99
"imports": {
1010
"#oxlint": "./dist/index.js",
11-
"#oxlint/plugins": "./dist/plugins.js",
11+
"#oxlint/plugins": "./dist-pkg-plugins/index.js",
1212
"#oxlint/plugins-dev": "./dist/plugins-dev.js"
1313
},
1414
"exports": {
1515
".": {
1616
"types": "./dist/index.d.ts",
1717
"default": "./dist/index.js"
1818
},
19-
"./plugins": {
20-
"types": "./dist/plugins.d.ts",
21-
"default": "./dist/plugins.js"
22-
},
2319
"./plugins-dev": {
2420
"types": "./dist/plugins-dev.d.ts",
2521
"default": "./dist/plugins-dev.js"

apps/oxlint/tsdown.config.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ const minifyConfig = {
4040
codegen: { removeWhitespace: false },
4141
};
4242

43+
// Defined globals.
44+
// `DEBUG: false` allows minifier to remove debug assertions and debug-only code in release build.
45+
const definedGlobals = {
46+
DEBUG: DEBUG ? "true" : "false",
47+
CONFORMANCE: CONFORMANCE ? "true" : "false",
48+
};
49+
4350
// Base config for `@oxlint/plugins` package.
4451
// "node12" target to match `engines` field of last ESLint 8 release (8.57.1).
4552
const pluginsPkgConfig = defineConfig({
@@ -53,10 +60,7 @@ const pluginsPkgConfig = defineConfig({
5360
clean: false,
5461
target: "node12",
5562
minify: minifyConfig,
56-
define: {
57-
DEBUG: "false",
58-
CONFORMANCE: "false",
59-
},
63+
define: definedGlobals,
6064
});
6165

6266
// Plugins.
@@ -69,7 +73,7 @@ export default defineConfig([
6973
// Main build
7074
{
7175
...commonConfig,
72-
entry: ["src-js/cli.ts", "src-js/index.ts", "src-js/plugins.ts", "src-js/plugins-dev.ts"],
76+
entry: ["src-js/cli.ts", "src-js/index.ts", "src-js/plugins-dev.ts"],
7377
format: "esm",
7478
external: [
7579
// External native bindings
@@ -79,10 +83,7 @@ export default defineConfig([
7983
minify: minifyConfig,
8084
dts: true,
8185
attw: { profile: "esm-only" },
82-
define: {
83-
DEBUG: DEBUG ? "true" : "false",
84-
CONFORMANCE: CONFORMANCE ? "true" : "false",
85-
},
86+
define: definedGlobals,
8687
plugins,
8788
inputOptions: {
8889
// For `replaceAssertsPlugin` and `replaceGlobalsPlugin`

npm/oxlint/package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@
3939
"types": "./dist/index.d.ts",
4040
"default": "./dist/index.js"
4141
},
42-
"./plugins": {
43-
"types": "./dist/plugins.d.ts",
44-
"default": "./dist/plugins.js"
45-
},
4642
"./plugins-dev": {
4743
"types": "./dist/plugins-dev.d.ts",
4844
"default": "./dist/plugins-dev.js"

0 commit comments

Comments
 (0)