@stll/oxlint-config 0.12.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +261 -1
- package/dist/cloud-setup-cli.cjs +6 -4
- package/dist/cloud-setup-cli.cjs.map +1 -1
- package/dist/cloud-setup-cli.mjs +3 -1
- package/dist/cloud-setup-cli.mjs.map +1 -1
- package/dist/compiler-packages.cjs +28 -0
- package/dist/compiler-packages.cjs.map +1 -0
- package/dist/compiler-packages.mjs +17 -0
- package/dist/compiler-packages.mjs.map +1 -0
- package/dist/consumer-compat-cli.cjs +1091 -0
- package/dist/consumer-compat-cli.cjs.map +1 -0
- package/dist/consumer-compat-cli.d.cts +1 -0
- package/dist/consumer-compat-cli.d.mts +1 -0
- package/dist/consumer-compat-cli.mjs +1089 -0
- package/dist/consumer-compat-cli.mjs.map +1 -0
- package/dist/index.cjs +50 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -41
- package/dist/index.d.mts +46 -41
- package/dist/index.mjs +50 -41
- package/dist/index.mjs.map +1 -1
- package/dist/publish-build-target-nuxt-helper.cjs +71 -0
- package/dist/publish-build-target-nuxt-helper.cjs.map +1 -0
- package/dist/publish-build-target-nuxt-helper.d.cts +10 -0
- package/dist/publish-build-target-nuxt-helper.d.mts +10 -0
- package/dist/publish-build-target-nuxt-helper.mjs +68 -0
- package/dist/publish-build-target-nuxt-helper.mjs.map +1 -0
- package/dist/publish-build-target-vite-dts-helper.cjs +3 -0
- package/dist/publish-build-target-vite-dts-helper.d.cts +24 -0
- package/dist/publish-build-target-vite-dts-helper.d.mts +24 -0
- package/dist/publish-build-target-vite-dts-helper.mjs +2 -0
- package/dist/publish-build-target-vite-dts-helper2.cjs +372 -0
- package/dist/publish-build-target-vite-dts-helper2.cjs.map +1 -0
- package/dist/publish-build-target-vite-dts-helper2.mjs +359 -0
- package/dist/publish-build-target-vite-dts-helper2.mjs.map +1 -0
- package/dist/publish-contract-cli.cjs +983 -0
- package/dist/publish-contract-cli.cjs.map +1 -0
- package/dist/publish-contract-cli.d.cts +1 -0
- package/dist/publish-contract-cli.d.mts +1 -0
- package/dist/publish-contract-cli.mjs +981 -0
- package/dist/publish-contract-cli.mjs.map +1 -0
- package/dist/publish-contract.cjs +431 -0
- package/dist/publish-contract.cjs.map +1 -0
- package/dist/publish-contract.mjs +396 -0
- package/dist/publish-contract.mjs.map +1 -0
- package/dist/rolldown-runtime.cjs +28 -0
- package/dist/toolchain-changed-cli.cjs +34 -0
- package/dist/toolchain-changed-cli.cjs.map +1 -0
- package/dist/toolchain-changed-cli.d.cts +1 -0
- package/dist/toolchain-changed-cli.d.mts +1 -0
- package/dist/toolchain-changed-cli.mjs +34 -0
- package/dist/toolchain-changed-cli.mjs.map +1 -0
- package/dist/toolchain-changed.cjs +1470 -0
- package/dist/toolchain-changed.cjs.map +1 -0
- package/dist/toolchain-changed.mjs +1463 -0
- package/dist/toolchain-changed.mjs.map +1 -0
- package/dist/toolchain-check-cli.cjs +2 -1
- package/dist/toolchain-check-cli.cjs.map +1 -1
- package/dist/toolchain-check-cli.mjs +2 -1
- package/dist/toolchain-check-cli.mjs.map +1 -1
- package/dist/toolchain-guard.cjs +360 -1161
- package/dist/toolchain-guard.cjs.map +1 -1
- package/dist/toolchain-guard.mjs +338 -1100
- package/dist/toolchain-guard.mjs.map +1 -1
- package/dist/toolchain-inputs.cjs +926 -0
- package/dist/toolchain-inputs.cjs.map +1 -0
- package/dist/toolchain-inputs.mjs +816 -0
- package/dist/toolchain-inputs.mjs.map +1 -0
- package/dist/toolchain-schema.cjs +702 -0
- package/dist/toolchain-schema.cjs.map +1 -0
- package/dist/toolchain-schema.mjs +580 -0
- package/dist/toolchain-schema.mjs.map +1 -0
- package/dist/typecheck-parity-cli.cjs +38 -898
- package/dist/typecheck-parity-cli.cjs.map +1 -1
- package/dist/typecheck-parity-cli.mjs +39 -899
- package/dist/typecheck-parity-cli.mjs.map +1 -1
- package/dist/typecheck-parity.cjs +905 -0
- package/dist/typecheck-parity.cjs.map +1 -0
- package/dist/typecheck-parity.mjs +894 -0
- package/dist/typecheck-parity.mjs.map +1 -0
- package/dist/typecheck-probe-cli.cjs +176 -0
- package/dist/typecheck-probe-cli.cjs.map +1 -0
- package/dist/typecheck-probe-cli.d.cts +1 -0
- package/dist/typecheck-probe-cli.d.mts +1 -0
- package/dist/typecheck-probe-cli.mjs +174 -0
- package/dist/typecheck-probe-cli.mjs.map +1 -0
- package/package.json +43 -5
- package/toolchain.json +9 -1
package/dist/index.d.mts
CHANGED
|
@@ -11,11 +11,14 @@ type LibraryOptions = {
|
|
|
11
11
|
overrides?: OxlintOverride[];
|
|
12
12
|
plugins?: Plugins;
|
|
13
13
|
rules?: Rules;
|
|
14
|
+
react?: {
|
|
15
|
+
files: [string, ...string[]];
|
|
16
|
+
};
|
|
14
17
|
};
|
|
15
18
|
declare const stellaLowercasePluginSpecifier = "@stll/oxlint-config/plugin";
|
|
16
19
|
declare const noRawColorsPluginSpecifier = "@stll/oxlint-config/no-raw-colors";
|
|
17
20
|
declare const libraryIgnorePatterns: string[];
|
|
18
|
-
declare const libraryPlugins: ("eslint" | "import" | "oxc" | "promise" | "
|
|
21
|
+
declare const libraryPlugins: ("eslint" | "import" | "oxc" | "promise" | "typescript" | "unicorn")[];
|
|
19
22
|
declare const reactCompilerRules: {
|
|
20
23
|
"react/capitalized-calls": "error";
|
|
21
24
|
"react/error-boundaries": "error";
|
|
@@ -41,28 +44,6 @@ declare const reactCompilerRules: {
|
|
|
41
44
|
"react/void-use-memo": "error";
|
|
42
45
|
};
|
|
43
46
|
declare const libraryRules: {
|
|
44
|
-
"react/capitalized-calls": "error";
|
|
45
|
-
"react/error-boundaries": "error";
|
|
46
|
-
"react/exhaustive-effect-dependencies": "error";
|
|
47
|
-
"react/globals": "error";
|
|
48
|
-
"react/hooks": "error";
|
|
49
|
-
"react/immutability": "error";
|
|
50
|
-
"react/incompatible-library": "error";
|
|
51
|
-
"react/invariant": "off";
|
|
52
|
-
"react/memo-dependencies": "error";
|
|
53
|
-
"react/no-deriving-state-in-effects": "error";
|
|
54
|
-
"react/preserve-manual-memoization": "error";
|
|
55
|
-
"react/purity": "error";
|
|
56
|
-
"react/refs": "error";
|
|
57
|
-
"react/rule-suppression": "error";
|
|
58
|
-
"react/set-state-in-effect": "error";
|
|
59
|
-
"react/set-state-in-render": "error";
|
|
60
|
-
"react/static-components": "error";
|
|
61
|
-
"react/syntax": "error";
|
|
62
|
-
"react/todo": "off";
|
|
63
|
-
"react/unsupported-syntax": "error";
|
|
64
|
-
"react/use-memo": "error";
|
|
65
|
-
"react/void-use-memo": "error";
|
|
66
47
|
"no-console": "off";
|
|
67
48
|
"no-shadow": "error";
|
|
68
49
|
"require-await": "error";
|
|
@@ -133,6 +114,47 @@ declare const libraryRules: {
|
|
|
133
114
|
"promise/prefer-await-to-then": "off";
|
|
134
115
|
"promise/prefer-await-to-callbacks": "off";
|
|
135
116
|
"promise/avoid-new": "off";
|
|
117
|
+
"sort-keys": "off";
|
|
118
|
+
"no-plusplus": "off";
|
|
119
|
+
"no-inline-comments": "off";
|
|
120
|
+
"max-statements": "off";
|
|
121
|
+
"prefer-destructuring": "off";
|
|
122
|
+
"no-negated-condition": "off";
|
|
123
|
+
"no-use-before-define": "off";
|
|
124
|
+
"no-useless-return": "off";
|
|
125
|
+
"no-warning-comments": "off";
|
|
126
|
+
"no-unexpected-multiline": "off";
|
|
127
|
+
"max-classes-per-file": "off";
|
|
128
|
+
"class-methods-use-this": "off";
|
|
129
|
+
"no-unmodified-loop-condition": "off";
|
|
130
|
+
complexity: "off";
|
|
131
|
+
"func-style": "off";
|
|
132
|
+
"func-names": "off";
|
|
133
|
+
"default-case": "off";
|
|
134
|
+
};
|
|
135
|
+
declare const reactRules: {
|
|
136
|
+
"react/capitalized-calls": "error";
|
|
137
|
+
"react/error-boundaries": "error";
|
|
138
|
+
"react/exhaustive-effect-dependencies": "error";
|
|
139
|
+
"react/globals": "error";
|
|
140
|
+
"react/hooks": "error";
|
|
141
|
+
"react/immutability": "error";
|
|
142
|
+
"react/incompatible-library": "error";
|
|
143
|
+
"react/invariant": "off";
|
|
144
|
+
"react/memo-dependencies": "error";
|
|
145
|
+
"react/no-deriving-state-in-effects": "error";
|
|
146
|
+
"react/preserve-manual-memoization": "error";
|
|
147
|
+
"react/purity": "error";
|
|
148
|
+
"react/refs": "error";
|
|
149
|
+
"react/rule-suppression": "error";
|
|
150
|
+
"react/set-state-in-effect": "error";
|
|
151
|
+
"react/set-state-in-render": "error";
|
|
152
|
+
"react/static-components": "error";
|
|
153
|
+
"react/syntax": "error";
|
|
154
|
+
"react/todo": "off";
|
|
155
|
+
"react/unsupported-syntax": "error";
|
|
156
|
+
"react/use-memo": "error";
|
|
157
|
+
"react/void-use-memo": "error";
|
|
136
158
|
"react/exhaustive-deps": "off";
|
|
137
159
|
"react/forward-ref-uses-ref": "off";
|
|
138
160
|
"react/jsx-key": "off";
|
|
@@ -152,23 +174,6 @@ declare const libraryRules: {
|
|
|
152
174
|
"react/no-unsafe": "off";
|
|
153
175
|
"react/no-will-update-set-state": "off";
|
|
154
176
|
"react/void-dom-elements-no-children": "off";
|
|
155
|
-
"sort-keys": "off";
|
|
156
|
-
"no-plusplus": "off";
|
|
157
|
-
"no-inline-comments": "off";
|
|
158
|
-
"max-statements": "off";
|
|
159
|
-
"prefer-destructuring": "off";
|
|
160
|
-
"no-negated-condition": "off";
|
|
161
|
-
"no-use-before-define": "off";
|
|
162
|
-
"no-useless-return": "off";
|
|
163
|
-
"no-warning-comments": "off";
|
|
164
|
-
"no-unexpected-multiline": "off";
|
|
165
|
-
"max-classes-per-file": "off";
|
|
166
|
-
"class-methods-use-this": "off";
|
|
167
|
-
"no-unmodified-loop-condition": "off";
|
|
168
|
-
complexity: "off";
|
|
169
|
-
"func-style": "off";
|
|
170
|
-
"func-names": "off";
|
|
171
|
-
"default-case": "off";
|
|
172
177
|
};
|
|
173
178
|
declare const libraryOverrides: {
|
|
174
179
|
files: string[];
|
|
@@ -181,5 +186,5 @@ declare const libraryOverrides: {
|
|
|
181
186
|
declare const library: (options?: LibraryOptions) => OxlintConfig;
|
|
182
187
|
declare const _default: OxlintConfig;
|
|
183
188
|
//#endregion
|
|
184
|
-
export { LibraryOptions, _default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, reactCompilerRules, stellaLowercasePluginSpecifier };
|
|
189
|
+
export { LibraryOptions, _default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, reactCompilerRules, reactRules, stellaLowercasePluginSpecifier };
|
|
185
190
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -13,8 +13,7 @@ const libraryPlugins = [
|
|
|
13
13
|
"unicorn",
|
|
14
14
|
"oxc",
|
|
15
15
|
"import",
|
|
16
|
-
"promise"
|
|
17
|
-
"react"
|
|
16
|
+
"promise"
|
|
18
17
|
];
|
|
19
18
|
const reactCompilerRules = {
|
|
20
19
|
"react/capitalized-calls": "error",
|
|
@@ -99,6 +98,25 @@ const libraryRules = {
|
|
|
99
98
|
"promise/prefer-await-to-then": "off",
|
|
100
99
|
"promise/prefer-await-to-callbacks": "off",
|
|
101
100
|
"promise/avoid-new": "off",
|
|
101
|
+
"sort-keys": "off",
|
|
102
|
+
"no-plusplus": "off",
|
|
103
|
+
"no-inline-comments": "off",
|
|
104
|
+
"max-statements": "off",
|
|
105
|
+
"prefer-destructuring": "off",
|
|
106
|
+
"no-negated-condition": "off",
|
|
107
|
+
"no-use-before-define": "off",
|
|
108
|
+
"no-useless-return": "off",
|
|
109
|
+
"no-warning-comments": "off",
|
|
110
|
+
"no-unexpected-multiline": "off",
|
|
111
|
+
"max-classes-per-file": "off",
|
|
112
|
+
"class-methods-use-this": "off",
|
|
113
|
+
"no-unmodified-loop-condition": "off",
|
|
114
|
+
complexity: "off",
|
|
115
|
+
"func-style": "off",
|
|
116
|
+
"func-names": "off",
|
|
117
|
+
"default-case": "off"
|
|
118
|
+
};
|
|
119
|
+
const reactRules = {
|
|
102
120
|
"react/exhaustive-deps": "off",
|
|
103
121
|
"react/forward-ref-uses-ref": "off",
|
|
104
122
|
"react/jsx-key": "off",
|
|
@@ -118,24 +136,7 @@ const libraryRules = {
|
|
|
118
136
|
"react/no-unsafe": "off",
|
|
119
137
|
"react/no-will-update-set-state": "off",
|
|
120
138
|
"react/void-dom-elements-no-children": "off",
|
|
121
|
-
...reactCompilerRules
|
|
122
|
-
"sort-keys": "off",
|
|
123
|
-
"no-plusplus": "off",
|
|
124
|
-
"no-inline-comments": "off",
|
|
125
|
-
"max-statements": "off",
|
|
126
|
-
"prefer-destructuring": "off",
|
|
127
|
-
"no-negated-condition": "off",
|
|
128
|
-
"no-use-before-define": "off",
|
|
129
|
-
"no-useless-return": "off",
|
|
130
|
-
"no-warning-comments": "off",
|
|
131
|
-
"no-unexpected-multiline": "off",
|
|
132
|
-
"max-classes-per-file": "off",
|
|
133
|
-
"class-methods-use-this": "off",
|
|
134
|
-
"no-unmodified-loop-condition": "off",
|
|
135
|
-
complexity: "off",
|
|
136
|
-
"func-style": "off",
|
|
137
|
-
"func-names": "off",
|
|
138
|
-
"default-case": "off"
|
|
139
|
+
...reactCompilerRules
|
|
139
140
|
};
|
|
140
141
|
const libraryOverrides = [{
|
|
141
142
|
files: [
|
|
@@ -149,28 +150,36 @@ const libraryOverrides = [{
|
|
|
149
150
|
"no-non-null-assertion": "off"
|
|
150
151
|
}
|
|
151
152
|
}];
|
|
152
|
-
const library = (options = {}) =>
|
|
153
|
-
options
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
153
|
+
const library = (options = {}) => {
|
|
154
|
+
const plugins = /* @__PURE__ */ new Set([...libraryPlugins, ...options.plugins ?? []]);
|
|
155
|
+
const presetOverrides = [...libraryOverrides, ...options.react === void 0 ? [] : [{
|
|
156
|
+
files: options.react.files,
|
|
157
|
+
plugins: [...plugins, "react"],
|
|
158
|
+
rules: reactRules
|
|
159
|
+
}]];
|
|
160
|
+
return defineConfig({
|
|
161
|
+
options: {
|
|
162
|
+
denyWarnings: true,
|
|
163
|
+
reportUnusedDisableDirectives: "error",
|
|
164
|
+
typeAware: true,
|
|
165
|
+
...options.options
|
|
166
|
+
},
|
|
167
|
+
plugins: Array.from(plugins),
|
|
168
|
+
jsPlugins: [
|
|
169
|
+
stellaLowercasePluginSpecifier,
|
|
170
|
+
noRawColorsPluginSpecifier,
|
|
171
|
+
...options.jsPlugins ?? []
|
|
172
|
+
],
|
|
173
|
+
ignorePatterns: [...libraryIgnorePatterns, ...options.ignorePatterns ?? []],
|
|
174
|
+
rules: {
|
|
175
|
+
...libraryRules,
|
|
176
|
+
...options.rules
|
|
177
|
+
},
|
|
178
|
+
overrides: [...presetOverrides.map((override) => Object.assign({}, override, { rules: Object.assign({}, override.rules, options.rules) })), ...options.overrides ?? []]
|
|
179
|
+
});
|
|
180
|
+
};
|
|
172
181
|
var src_default = library();
|
|
173
182
|
//#endregion
|
|
174
|
-
export { src_default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, reactCompilerRules, stellaLowercasePluginSpecifier };
|
|
183
|
+
export { src_default as default, library, libraryIgnorePatterns, libraryOverrides, libraryPlugins, libraryRules, noRawColorsPluginSpecifier, reactCompilerRules, reactRules, stellaLowercasePluginSpecifier };
|
|
175
184
|
|
|
176
185
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { defineConfig, type OxlintConfig, type OxlintOverride } from \"oxlint\";\n\ntype Rules = NonNullable<OxlintConfig[\"rules\"]>;\ntype JsPlugins = NonNullable<OxlintConfig[\"jsPlugins\"]>;\ntype Options = NonNullable<OxlintConfig[\"options\"]>;\ntype Plugins = NonNullable<OxlintConfig[\"plugins\"]>;\n\nexport type LibraryOptions = {\n jsPlugins?: JsPlugins;\n ignorePatterns?: string[];\n options?: Options;\n overrides?: OxlintOverride[];\n plugins?: Plugins;\n rules?: Rules;\n};\n\nexport const stellaLowercasePluginSpecifier = \"@stll/oxlint-config/plugin\";\nexport const noRawColorsPluginSpecifier = \"@stll/oxlint-config/no-raw-colors\";\n\nexport const libraryIgnorePatterns = [\"node_modules/\", \"dist/\", \"coverage/\"];\n\n// Setting oxlint's `plugins` config replaces its built-in default list rather\n// than appending to it. This must stay in sync with every plugin-prefixed\n// rule below: `import/*` and `promise/*` rules are configured further down,\n// but oxlint disables both plugins unless they are listed here, which left\n// `import/no-cycle` and every `promise/*` rule silently unenforced. `react`\n// is enabled for the React Compiler category rules; see the comment on that\n// ruleset for why every other `react/*` rule is explicitly turned back off.\nexport const libraryPlugins = [\n \"eslint\",\n \"typescript\",\n \"unicorn\",\n \"oxc\",\n \"import\",\n \"promise\",\n \"react\",\n] satisfies Plugins;\n\n// Oxlint 1.80 replaced react/react-compiler with category-specific rules.\n// Keep the actionable compiler diagnostics strict while excluding internal\n// invariant and unfinished-feature reports that do not identify source bugs.\nexport const reactCompilerRules = {\n \"react/capitalized-calls\": \"error\",\n \"react/error-boundaries\": \"error\",\n \"react/exhaustive-effect-dependencies\": \"error\",\n \"react/globals\": \"error\",\n \"react/hooks\": \"error\",\n \"react/immutability\": \"error\",\n \"react/incompatible-library\": \"error\",\n \"react/invariant\": \"off\",\n \"react/memo-dependencies\": \"error\",\n \"react/no-deriving-state-in-effects\": \"error\",\n \"react/preserve-manual-memoization\": \"error\",\n \"react/purity\": \"error\",\n \"react/refs\": \"error\",\n \"react/rule-suppression\": \"error\",\n \"react/set-state-in-effect\": \"error\",\n \"react/set-state-in-render\": \"error\",\n \"react/static-components\": \"error\",\n \"react/syntax\": \"error\",\n \"react/todo\": \"off\",\n \"react/unsupported-syntax\": \"error\",\n \"react/use-memo\": \"error\",\n \"react/void-use-memo\": \"error\",\n} satisfies Rules;\n\nexport const libraryRules = {\n \"no-console\": \"off\",\n \"no-shadow\": \"error\",\n \"require-await\": \"error\",\n \"no-useless-catch\": \"error\",\n \"no-non-null-assertion\": \"error\",\n \"no-useless-assignment\": \"error\",\n \"no-loop-func\": \"error\",\n \"no-nested-ternary\": \"error\",\n \"no-void\": [\"error\", { allowAsStatement: true }],\n // Callback expressions should stay lexically scoped; avoids accidental `this` rebinding.\n \"prefer-arrow-callback\": \"error\",\n \"stella-lowercase/stella-lowercase\": \"error\",\n \"no-raw-colors/no-raw-colors\": \"error\",\n\n // Spreading into an accumulator on every loop iteration is O(n^2); push/concat instead.\n \"oxc/no-accumulating-spread\": \"error\",\n // Spreading inside `.map()` allocates a new array per callback invocation; push instead.\n \"oxc/no-map-spread\": \"error\",\n // Flags `if`/`switch` branches with identical bodies: likely dead logic or a missed merge.\n \"oxc/branches-sharing-code\": \"error\",\n\n \"typescript/no-explicit-any\": \"error\",\n \"typescript/no-dynamic-delete\": \"error\",\n \"typescript/no-misused-promises\": [\n \"error\",\n { checksVoidReturn: { attributes: false } },\n ],\n \"typescript/consistent-type-definitions\": [\"error\", \"type\"],\n \"typescript/consistent-return\": \"error\",\n \"typescript/dot-notation\": \"error\",\n \"typescript/no-inferrable-types\": \"off\",\n \"typescript/no-unnecessary-type-conversion\": \"error\",\n \"typescript/no-unnecessary-condition\": [\n \"error\",\n { allowConstantLoopConditions: \"only-allowed-literals\" },\n ],\n \"typescript/no-unnecessary-type-arguments\": \"error\",\n \"typescript/switch-exhaustiveness-check\": [\n \"error\",\n { considerDefaultExhaustiveForUnions: true },\n ],\n \"typescript/strict-boolean-expressions\": [\n \"error\",\n { allowNullableString: true, allowNullableBoolean: true },\n ],\n \"typescript/no-confusing-void-expression\": [\n \"error\",\n { ignoreArrowShorthand: true, ignoreVoidReturningFunctions: true },\n ],\n \"typescript/prefer-nullish-coalescing\": [\n \"error\",\n { ignorePrimitives: { string: true, boolean: true } },\n ],\n \"typescript/only-throw-error\": \"error\",\n \"typescript/return-await\": [\"error\", \"error-handling-correctness-only\"],\n\n \"unicorn/no-useless-undefined\": \"off\",\n \"unicorn/prefer-array-find\": \"error\",\n \"unicorn/prefer-at\": \"error\",\n \"unicorn/prefer-set-has\": \"error\",\n \"unicorn/filename-case\": \"off\",\n \"unicorn/consistent-function-scoping\": \"off\",\n \"unicorn/prefer-ternary\": \"off\",\n \"unicorn/no-array-reduce\": \"error\",\n \"unicorn/no-nested-ternary\": \"off\",\n // `Array.from({ length }).fill(obj)` shares one reference across every slot.\n \"unicorn/no-array-fill-with-reference-type\": \"error\",\n\n \"import/no-cycle\": \"error\",\n \"import/consistent-type-specifier-style\": \"off\",\n // Keep a blank line after the import block so it stays visually separate from module body.\n \"import/newline-after-import\": \"error\",\n\n \"promise/always-return\": \"error\",\n \"promise/no-return-in-finally\": \"error\",\n \"promise/prefer-await-to-then\": \"off\",\n \"promise/prefer-await-to-callbacks\": \"off\",\n \"promise/avoid-new\": \"off\",\n\n // Enabling the `react` plugin (above) turns on its whole correctness-category\n // rule set at \"warn\" by default, not just the React Compiler categories.\n // Only the compiler categories are deliberate additions here, so the rest\n // are turned off to keep this package's blast radius scoped; lift any of\n // these independently if a future change wants them.\n \"react/exhaustive-deps\": \"off\",\n \"react/forward-ref-uses-ref\": \"off\",\n \"react/jsx-key\": \"off\",\n \"react/jsx-no-duplicate-props\": \"off\",\n \"react/jsx-no-undef\": \"off\",\n \"react/jsx-props-no-spread-multi\": \"off\",\n \"react/no-children-prop\": \"off\",\n \"react/no-danger-with-children\": \"off\",\n \"react/no-did-mount-set-state\": \"off\",\n \"react/no-did-update-set-state\": \"off\",\n \"react/no-direct-mutation-state\": \"off\",\n \"react/no-find-dom-node\": \"off\",\n \"react/no-is-mounted\": \"off\",\n \"react/no-render-return-value\": \"off\",\n \"react/no-string-refs\": \"off\",\n \"react/no-this-in-sfc\": \"off\",\n \"react/no-unsafe\": \"off\",\n \"react/no-will-update-set-state\": \"off\",\n \"react/void-dom-elements-no-children\": \"off\",\n ...reactCompilerRules,\n\n \"sort-keys\": \"off\",\n \"no-plusplus\": \"off\",\n \"no-inline-comments\": \"off\",\n \"max-statements\": \"off\",\n \"prefer-destructuring\": \"off\",\n \"no-negated-condition\": \"off\",\n \"no-use-before-define\": \"off\",\n \"no-useless-return\": \"off\",\n \"no-warning-comments\": \"off\",\n \"no-unexpected-multiline\": \"off\",\n \"max-classes-per-file\": \"off\",\n \"class-methods-use-this\": \"off\",\n \"no-unmodified-loop-condition\": \"off\",\n complexity: \"off\",\n \"func-style\": \"off\",\n \"func-names\": \"off\",\n \"default-case\": \"off\",\n} satisfies Rules;\n\nexport const libraryOverrides = [\n {\n files: [\"**/*.{test,spec}.{ts,tsx,js,jsx}\", \"__test__/**\", \"__tests__/**\"],\n rules: {\n \"no-console\": \"off\",\n \"require-await\": \"off\",\n \"no-non-null-assertion\": \"off\",\n },\n },\n] satisfies OxlintOverride[];\n\nexport const library = (options: LibraryOptions = {}): OxlintConfig =>\n defineConfig({\n options: {\n denyWarnings: true,\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n ...options.options,\n },\n plugins: Array.from(\n new Set([...libraryPlugins, ...(options.plugins ?? [])]),\n ),\n jsPlugins: [\n stellaLowercasePluginSpecifier,\n noRawColorsPluginSpecifier,\n ...(options.jsPlugins ?? []),\n ],\n ignorePatterns: [\n ...libraryIgnorePatterns,\n ...(options.ignorePatterns ?? []),\n ],\n rules: {\n ...libraryRules,\n ...options.rules,\n },\n overrides: [...libraryOverrides, ...(options.overrides ?? [])],\n });\n\nexport default library();\n"],"mappings":";;AAgBA,MAAa,iCAAiC;AAC9C,MAAa,6BAA6B;AAE1C,MAAa,wBAAwB;CAAC;C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;CAC5B;CACA,gBAAgB,CACd,GAAG,uBACH,GAAI,QAAQ,kBAAkB,CAAC,CACjC;CACA,OAAO;EACL,GAAG;EACH,GAAG,QAAQ;CACb;CACA,WAAW,CAAC,GAAG,kBAAkB,GAAI,QAAQ,aAAa,CAAC,CAAE;AAC/D,CAAC;AAEH,IAAA,cAAe,QAAQ"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { defineConfig, type OxlintConfig, type OxlintOverride } from \"oxlint\";\n\ntype Rules = NonNullable<OxlintConfig[\"rules\"]>;\ntype JsPlugins = NonNullable<OxlintConfig[\"jsPlugins\"]>;\ntype Options = NonNullable<OxlintConfig[\"options\"]>;\ntype Plugins = NonNullable<OxlintConfig[\"plugins\"]>;\n\nexport type LibraryOptions = {\n jsPlugins?: JsPlugins;\n ignorePatterns?: string[];\n options?: Options;\n overrides?: OxlintOverride[];\n plugins?: Plugins;\n rules?: Rules;\n react?: { files: [string, ...string[]] };\n};\n\nexport const stellaLowercasePluginSpecifier = \"@stll/oxlint-config/plugin\";\nexport const noRawColorsPluginSpecifier = \"@stll/oxlint-config/no-raw-colors\";\n\nexport const libraryIgnorePatterns = [\"node_modules/\", \"dist/\", \"coverage/\"];\n\n// Setting oxlint's `plugins` config replaces its built-in default list rather\n// than appending to it. This must stay in sync with every plugin-prefixed\n// rule below: `import/*` and `promise/*` rules are configured further down,\n// but oxlint disables both plugins unless they are listed here, which left\n// `import/no-cycle` and every `promise/*` rule silently unenforced.\nexport const libraryPlugins = [\n \"eslint\",\n \"typescript\",\n \"unicorn\",\n \"oxc\",\n \"import\",\n \"promise\",\n] satisfies Plugins;\n\n// Oxlint 1.80 replaced react/react-compiler with category-specific rules.\n// Keep the actionable compiler diagnostics strict while excluding internal\n// invariant and unfinished-feature reports that do not identify source bugs.\nexport const reactCompilerRules = {\n \"react/capitalized-calls\": \"error\",\n \"react/error-boundaries\": \"error\",\n \"react/exhaustive-effect-dependencies\": \"error\",\n \"react/globals\": \"error\",\n \"react/hooks\": \"error\",\n \"react/immutability\": \"error\",\n \"react/incompatible-library\": \"error\",\n \"react/invariant\": \"off\",\n \"react/memo-dependencies\": \"error\",\n \"react/no-deriving-state-in-effects\": \"error\",\n \"react/preserve-manual-memoization\": \"error\",\n \"react/purity\": \"error\",\n \"react/refs\": \"error\",\n \"react/rule-suppression\": \"error\",\n \"react/set-state-in-effect\": \"error\",\n \"react/set-state-in-render\": \"error\",\n \"react/static-components\": \"error\",\n \"react/syntax\": \"error\",\n \"react/todo\": \"off\",\n \"react/unsupported-syntax\": \"error\",\n \"react/use-memo\": \"error\",\n \"react/void-use-memo\": \"error\",\n} satisfies Rules;\n\nexport const libraryRules = {\n \"no-console\": \"off\",\n \"no-shadow\": \"error\",\n \"require-await\": \"error\",\n \"no-useless-catch\": \"error\",\n \"no-non-null-assertion\": \"error\",\n \"no-useless-assignment\": \"error\",\n \"no-loop-func\": \"error\",\n \"no-nested-ternary\": \"error\",\n \"no-void\": [\"error\", { allowAsStatement: true }],\n // Callback expressions should stay lexically scoped; avoids accidental `this` rebinding.\n \"prefer-arrow-callback\": \"error\",\n \"stella-lowercase/stella-lowercase\": \"error\",\n \"no-raw-colors/no-raw-colors\": \"error\",\n\n // Spreading into an accumulator on every loop iteration is O(n^2); push/concat instead.\n \"oxc/no-accumulating-spread\": \"error\",\n // Spreading inside `.map()` allocates a new array per callback invocation; push instead.\n \"oxc/no-map-spread\": \"error\",\n // Flags `if`/`switch` branches with identical bodies: likely dead logic or a missed merge.\n \"oxc/branches-sharing-code\": \"error\",\n\n \"typescript/no-explicit-any\": \"error\",\n \"typescript/no-dynamic-delete\": \"error\",\n \"typescript/no-misused-promises\": [\n \"error\",\n { checksVoidReturn: { attributes: false } },\n ],\n \"typescript/consistent-type-definitions\": [\"error\", \"type\"],\n \"typescript/consistent-return\": \"error\",\n \"typescript/dot-notation\": \"error\",\n \"typescript/no-inferrable-types\": \"off\",\n \"typescript/no-unnecessary-type-conversion\": \"error\",\n \"typescript/no-unnecessary-condition\": [\n \"error\",\n { allowConstantLoopConditions: \"only-allowed-literals\" },\n ],\n \"typescript/no-unnecessary-type-arguments\": \"error\",\n \"typescript/switch-exhaustiveness-check\": [\n \"error\",\n { considerDefaultExhaustiveForUnions: true },\n ],\n \"typescript/strict-boolean-expressions\": [\n \"error\",\n { allowNullableString: true, allowNullableBoolean: true },\n ],\n \"typescript/no-confusing-void-expression\": [\n \"error\",\n { ignoreArrowShorthand: true, ignoreVoidReturningFunctions: true },\n ],\n \"typescript/prefer-nullish-coalescing\": [\n \"error\",\n { ignorePrimitives: { string: true, boolean: true } },\n ],\n \"typescript/only-throw-error\": \"error\",\n \"typescript/return-await\": [\"error\", \"error-handling-correctness-only\"],\n\n \"unicorn/no-useless-undefined\": \"off\",\n \"unicorn/prefer-array-find\": \"error\",\n \"unicorn/prefer-at\": \"error\",\n \"unicorn/prefer-set-has\": \"error\",\n \"unicorn/filename-case\": \"off\",\n \"unicorn/consistent-function-scoping\": \"off\",\n \"unicorn/prefer-ternary\": \"off\",\n \"unicorn/no-array-reduce\": \"error\",\n \"unicorn/no-nested-ternary\": \"off\",\n // `Array.from({ length }).fill(obj)` shares one reference across every slot.\n \"unicorn/no-array-fill-with-reference-type\": \"error\",\n\n \"import/no-cycle\": \"error\",\n \"import/consistent-type-specifier-style\": \"off\",\n // Keep a blank line after the import block so it stays visually separate from module body.\n \"import/newline-after-import\": \"error\",\n\n \"promise/always-return\": \"error\",\n \"promise/no-return-in-finally\": \"error\",\n \"promise/prefer-await-to-then\": \"off\",\n \"promise/prefer-await-to-callbacks\": \"off\",\n \"promise/avoid-new\": \"off\",\n\n \"sort-keys\": \"off\",\n \"no-plusplus\": \"off\",\n \"no-inline-comments\": \"off\",\n \"max-statements\": \"off\",\n \"prefer-destructuring\": \"off\",\n \"no-negated-condition\": \"off\",\n \"no-use-before-define\": \"off\",\n \"no-useless-return\": \"off\",\n \"no-warning-comments\": \"off\",\n \"no-unexpected-multiline\": \"off\",\n \"max-classes-per-file\": \"off\",\n \"class-methods-use-this\": \"off\",\n \"no-unmodified-loop-condition\": \"off\",\n complexity: \"off\",\n \"func-style\": \"off\",\n \"func-names\": \"off\",\n \"default-case\": \"off\",\n} satisfies Rules;\n\n// Applied only to the consumer-selected React files.\nexport const reactRules = {\n // Enabling the `react` plugin turns on its whole correctness-category\n // rule set at \"warn\" by default, not just the React Compiler categories.\n // Only the compiler categories are deliberate additions here, so the rest\n // are turned off to keep this package's blast radius scoped; lift any of\n // these independently if a future change wants them.\n \"react/exhaustive-deps\": \"off\",\n \"react/forward-ref-uses-ref\": \"off\",\n \"react/jsx-key\": \"off\",\n \"react/jsx-no-duplicate-props\": \"off\",\n \"react/jsx-no-undef\": \"off\",\n \"react/jsx-props-no-spread-multi\": \"off\",\n \"react/no-children-prop\": \"off\",\n \"react/no-danger-with-children\": \"off\",\n \"react/no-did-mount-set-state\": \"off\",\n \"react/no-did-update-set-state\": \"off\",\n \"react/no-direct-mutation-state\": \"off\",\n \"react/no-find-dom-node\": \"off\",\n \"react/no-is-mounted\": \"off\",\n \"react/no-render-return-value\": \"off\",\n \"react/no-string-refs\": \"off\",\n \"react/no-this-in-sfc\": \"off\",\n \"react/no-unsafe\": \"off\",\n \"react/no-will-update-set-state\": \"off\",\n \"react/void-dom-elements-no-children\": \"off\",\n ...reactCompilerRules,\n} satisfies Rules;\n\nexport const libraryOverrides = [\n {\n files: [\"**/*.{test,spec}.{ts,tsx,js,jsx}\", \"__test__/**\", \"__tests__/**\"],\n rules: {\n \"no-console\": \"off\",\n \"require-await\": \"off\",\n \"no-non-null-assertion\": \"off\",\n },\n },\n] satisfies OxlintOverride[];\n\nexport const library = (options: LibraryOptions = {}): OxlintConfig => {\n const plugins = new Set([...libraryPlugins, ...(options.plugins ?? [])]);\n const presetOverrides = [\n ...libraryOverrides,\n ...(options.react === undefined\n ? []\n : [\n {\n files: options.react.files,\n plugins: [...plugins, \"react\"],\n rules: reactRules,\n } satisfies OxlintOverride,\n ]),\n ];\n return defineConfig({\n options: {\n denyWarnings: true,\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n ...options.options,\n },\n plugins: Array.from(plugins),\n jsPlugins: [\n stellaLowercasePluginSpecifier,\n noRawColorsPluginSpecifier,\n ...(options.jsPlugins ?? []),\n ],\n ignorePatterns: [\n ...libraryIgnorePatterns,\n ...(options.ignorePatterns ?? []),\n ],\n rules: {\n ...libraryRules,\n ...options.rules,\n },\n overrides: [\n // Consumer rules take precedence over every preset, including scoped ones.\n ...presetOverrides.map((override) =>\n Object.assign({}, override, {\n rules: Object.assign({}, override.rules, options.rules),\n }),\n ),\n ...(options.overrides ?? []),\n ],\n });\n};\n\nexport default library();\n"],"mappings":";;AAiBA,MAAa,iCAAiC;AAC9C,MAAa,6BAA6B;AAE1C,MAAa,wBAAwB;CAAC;CAAiB;CAAS;AAAW;AAO3E,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;AACF;AAKA,MAAa,qBAAqB;CAChC,2BAA2B;CAC3B,0BAA0B;CAC1B,wCAAwC;CACxC,iBAAiB;CACjB,eAAe;CACf,sBAAsB;CACtB,8BAA8B;CAC9B,mBAAmB;CACnB,2BAA2B;CAC3B,sCAAsC;CACtC,qCAAqC;CACrC,gBAAgB;CAChB,cAAc;CACd,0BAA0B;CAC1B,6BAA6B;CAC7B,6BAA6B;CAC7B,2BAA2B;CAC3B,gBAAgB;CAChB,cAAc;CACd,4BAA4B;CAC5B,kBAAkB;CAClB,uBAAuB;AACzB;AAEA,MAAa,eAAe;CAC1B,cAAc;CACd,aAAa;CACb,iBAAiB;CACjB,oBAAoB;CACpB,yBAAyB;CACzB,yBAAyB;CACzB,gBAAgB;CAChB,qBAAqB;CACrB,WAAW,CAAC,SAAS,EAAE,kBAAkB,KAAK,CAAC;CAE/C,yBAAyB;CACzB,qCAAqC;CACrC,+BAA+B;CAG/B,8BAA8B;CAE9B,qBAAqB;CAErB,6BAA6B;CAE7B,8BAA8B;CAC9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CACjC,kCAAkC;CAClC,0BAA0B;CAC1B,uBAAuB;CACvB,gCAAgC;CAChC,wBAAwB;CACxB,wBAAwB;CACxB,mBAAmB;CACnB,kCAAkC;CAClC,uCAAuC;CACvC,GAAG;AACL;AAEA,MAAa,mBAAmB,CAC9B;CACE,OAAO;EAAC;EAAoC;EAAe;CAAc;CACzE,OAAO;EACL,cAAc;EACd,iBAAiB;EACjB,yBAAyB;CAC3B;AACF,CACF;AAEA,MAAa,WAAW,UAA0B,CAAC,MAAoB;CACrE,MAAM,0BAAU,IAAI,IAAI,CAAC,GAAG,gBAAgB,GAAI,QAAQ,WAAW,CAAC,CAAE,CAAC;CACvE,MAAM,kBAAkB,CACtB,GAAG,kBACH,GAAI,QAAQ,UAAU,KAAA,IAClB,CAAC,IACD,CACE;EACE,OAAO,QAAQ,MAAM;EACrB,SAAS,CAAC,GAAG,SAAS,OAAO;EAC7B,OAAO;CACT,CACF,CACN;CACA,OAAO,aAAa;EAClB,SAAS;GACP,cAAc;GACd,+BAA+B;GAC/B,WAAW;GACX,GAAG,QAAQ;EACb;EACA,SAAS,MAAM,KAAK,OAAO;EAC3B,WAAW;GACT;GACA;GACA,GAAI,QAAQ,aAAa,CAAC;EAC5B;EACA,gBAAgB,CACd,GAAG,uBACH,GAAI,QAAQ,kBAAkB,CAAC,CACjC;EACA,OAAO;GACL,GAAG;GACH,GAAG,QAAQ;EACb;EACA,WAAW,CAET,GAAG,gBAAgB,KAAK,aACtB,OAAO,OAAO,CAAC,GAAG,UAAU,EAC1B,OAAO,OAAO,OAAO,CAAC,GAAG,SAAS,OAAO,QAAQ,KAAK,EACxD,CAAC,CACH,GACA,GAAI,QAAQ,aAAa,CAAC,CAC5B;CACF,CAAC;AACH;AAEA,IAAA,cAAe,QAAQ"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/publish-build-target-nuxt-helper.ts
|
|
3
|
+
const record = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
const targetHookBrand = Symbol.for("@stll/oxlint-config.build-target.nuxt");
|
|
5
|
+
const targetHookVersion = 1;
|
|
6
|
+
/** Configure both module and runtime JavaScript without replacing Nuxt entries. */
|
|
7
|
+
const nuxtModuleTarget = (target) => {
|
|
8
|
+
const targets = typeof target === "string" ? [target] : [...target];
|
|
9
|
+
if (targets.length === 0 || targets.some((item) => item.length === 0)) throw new Error("Nuxt module target must contain a JavaScript target");
|
|
10
|
+
const before = (context) => {
|
|
11
|
+
if (!record(context) || !record(context["options"])) throw new Error("Invalid Nuxt build context");
|
|
12
|
+
const options = context["options"];
|
|
13
|
+
if (!record(options["rollup"]) || !Array.isArray(options["entries"]) || options["entries"].length === 0) throw new Error("Invalid resolved Nuxt build options");
|
|
14
|
+
for (const entry of options["entries"]) {
|
|
15
|
+
if (!record(entry) || entry["builder"] !== "rollup" && entry["builder"] !== "mkdist") throw new Error("Unsupported Nuxt JavaScript entry builder");
|
|
16
|
+
if (entry["builder"] === "mkdist") {
|
|
17
|
+
const esbuild = entry["esbuild"];
|
|
18
|
+
if (esbuild !== void 0 && !record(esbuild)) throw new Error("Invalid Nuxt runtime transform options");
|
|
19
|
+
entry["esbuild"] = {
|
|
20
|
+
...esbuild,
|
|
21
|
+
target: [...targets]
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const esbuild = options["rollup"]["esbuild"];
|
|
26
|
+
if (esbuild !== void 0 && !record(esbuild)) throw new Error("Invalid Nuxt module transform options");
|
|
27
|
+
options["rollup"]["esbuild"] = {
|
|
28
|
+
...esbuild,
|
|
29
|
+
target: [...targets]
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(before, targetHookBrand, { value: Object.freeze({
|
|
33
|
+
version: targetHookVersion,
|
|
34
|
+
targets: Object.freeze([...targets])
|
|
35
|
+
}) });
|
|
36
|
+
return before;
|
|
37
|
+
};
|
|
38
|
+
/** Read immutable target data across ESM and CommonJS without executing the callback. */
|
|
39
|
+
const nuxtModuleTargetTargets = (value) => {
|
|
40
|
+
if (typeof value !== "function") return void 0;
|
|
41
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, targetHookBrand);
|
|
42
|
+
if (descriptor === void 0 || descriptor.enumerable !== false || descriptor.writable !== false || descriptor.configurable !== false) return void 0;
|
|
43
|
+
const marker = descriptor.value;
|
|
44
|
+
if (!record(marker) || !Object.isFrozen(marker)) return void 0;
|
|
45
|
+
const keys = Reflect.ownKeys(marker);
|
|
46
|
+
if (keys.length !== 2 || !keys.includes("version") || !keys.includes("targets")) return void 0;
|
|
47
|
+
const version = Object.getOwnPropertyDescriptor(marker, "version");
|
|
48
|
+
const targetData = Object.getOwnPropertyDescriptor(marker, "targets");
|
|
49
|
+
if (!version || !("value" in version) || !targetData || !("value" in targetData)) return void 0;
|
|
50
|
+
if (version.value !== targetHookVersion) return void 0;
|
|
51
|
+
const targets = targetData.value;
|
|
52
|
+
if (!Array.isArray(targets) || !Object.isFrozen(targets) || targets.length === 0) return void 0;
|
|
53
|
+
if (Reflect.ownKeys(targets).length !== targets.length + 1) return void 0;
|
|
54
|
+
const result = [];
|
|
55
|
+
for (let index = 0; index < targets.length; index++) {
|
|
56
|
+
const entry = Object.getOwnPropertyDescriptor(targets, String(index));
|
|
57
|
+
if (!entry || !("value" in entry)) return void 0;
|
|
58
|
+
const target = entry.value;
|
|
59
|
+
if (typeof target !== "string" || target.length === 0) return void 0;
|
|
60
|
+
result.push(target);
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
};
|
|
64
|
+
/** Recognize the same declared target data across ESM and CommonJS modules. */
|
|
65
|
+
const isNuxtModuleTargetHook = (value) => nuxtModuleTargetTargets(value) !== void 0;
|
|
66
|
+
//#endregion
|
|
67
|
+
exports.isNuxtModuleTargetHook = isNuxtModuleTargetHook;
|
|
68
|
+
exports.nuxtModuleTarget = nuxtModuleTarget;
|
|
69
|
+
exports.nuxtModuleTargetTargets = nuxtModuleTargetTargets;
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=publish-build-target-nuxt-helper.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-build-target-nuxt-helper.cjs","names":[],"sources":["../src/publish-build-target-nuxt-helper.ts"],"sourcesContent":["const record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst targetHookBrand = Symbol.for(\"@stll/oxlint-config.build-target.nuxt\");\nconst targetHookVersion = 1;\n\n/** Configure both module and runtime JavaScript without replacing Nuxt entries. */\nexport const nuxtModuleTarget = (target: string | string[]) => {\n const targets = typeof target === \"string\" ? [target] : [...target];\n if (targets.length === 0 || targets.some((item) => item.length === 0))\n throw new Error(\"Nuxt module target must contain a JavaScript target\");\n const before = (context: unknown) => {\n if (!record(context) || !record(context[\"options\"]))\n throw new Error(\"Invalid Nuxt build context\");\n const options = context[\"options\"];\n if (\n !record(options[\"rollup\"]) ||\n !Array.isArray(options[\"entries\"]) ||\n options[\"entries\"].length === 0\n )\n throw new Error(\"Invalid resolved Nuxt build options\");\n for (const entry of options[\"entries\"]) {\n if (\n !record(entry) ||\n (entry[\"builder\"] !== \"rollup\" && entry[\"builder\"] !== \"mkdist\")\n )\n throw new Error(\"Unsupported Nuxt JavaScript entry builder\");\n if (entry[\"builder\"] === \"mkdist\") {\n const esbuild = entry[\"esbuild\"];\n if (esbuild !== undefined && !record(esbuild))\n throw new Error(\"Invalid Nuxt runtime transform options\");\n entry[\"esbuild\"] = { ...esbuild, target: [...targets] };\n }\n }\n const esbuild = options[\"rollup\"][\"esbuild\"];\n if (esbuild !== undefined && !record(esbuild))\n throw new Error(\"Invalid Nuxt module transform options\");\n options[\"rollup\"][\"esbuild\"] = { ...esbuild, target: [...targets] };\n };\n Object.defineProperty(before, targetHookBrand, {\n value: Object.freeze({\n version: targetHookVersion,\n targets: Object.freeze([...targets]),\n }),\n });\n return before;\n};\n\n/** Read immutable target data across ESM and CommonJS without executing the callback. */\nexport const nuxtModuleTargetTargets = (value: unknown) => {\n if (typeof value !== \"function\") return undefined;\n const descriptor = Object.getOwnPropertyDescriptor(value, targetHookBrand);\n if (\n descriptor === undefined ||\n descriptor.enumerable !== false ||\n descriptor.writable !== false ||\n descriptor.configurable !== false\n )\n return undefined;\n const marker: unknown = descriptor.value;\n if (!record(marker) || !Object.isFrozen(marker)) return undefined;\n const keys = Reflect.ownKeys(marker);\n if (\n keys.length !== 2 ||\n !keys.includes(\"version\") ||\n !keys.includes(\"targets\")\n )\n return undefined;\n const version = Object.getOwnPropertyDescriptor(marker, \"version\");\n const targetData = Object.getOwnPropertyDescriptor(marker, \"targets\");\n if (\n !version ||\n !(\"value\" in version) ||\n !targetData ||\n !(\"value\" in targetData)\n )\n return undefined;\n const markerVersion: unknown = version.value;\n if (markerVersion !== targetHookVersion) return undefined;\n const targets: unknown = targetData.value;\n if (\n !Array.isArray(targets) ||\n !Object.isFrozen(targets) ||\n targets.length === 0\n )\n return undefined;\n if (Reflect.ownKeys(targets).length !== targets.length + 1) return undefined;\n const result: string[] = [];\n for (let index = 0; index < targets.length; index++) {\n const entry = Object.getOwnPropertyDescriptor(targets, String(index));\n if (!entry || !(\"value\" in entry)) return undefined;\n const target: unknown = entry.value;\n if (typeof target !== \"string\" || target.length === 0) return undefined;\n result.push(target);\n }\n return result;\n};\n\n/** Recognize the same declared target data across ESM and CommonJS modules. */\nexport const isNuxtModuleTargetHook = (value: unknown) =>\n nuxtModuleTargetTargets(value) !== undefined;\n"],"mappings":";;AAAA,MAAM,UAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,kBAAkB,OAAO,IAAI,uCAAuC;AAC1E,MAAM,oBAAoB;;AAG1B,MAAa,oBAAoB,WAA8B;CAC7D,MAAM,UAAU,OAAO,WAAW,WAAW,CAAC,MAAM,IAAI,CAAC,GAAG,MAAM;CAClE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ript without replacing Nuxt entries. */
|
|
3
|
+
declare const nuxtModuleTarget: (target: string | string[]) => (context: unknown) => void;
|
|
4
|
+
/** Read immutable target data across ESM and CommonJS without executing the callback. */
|
|
5
|
+
declare const nuxtModuleTargetTargets: (value: unknown) => string[] | undefined;
|
|
6
|
+
/** Recognize the same declared target data across ESM and CommonJS modules. */
|
|
7
|
+
declare const isNuxtModuleTargetHook: (value: unknown) => boolean;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { isNuxtModuleTargetHook, nuxtModuleTarget, nuxtModuleTargetTargets };
|
|
10
|
+
//# sourceMappingURL=publish-build-target-nuxt-helper.d.cts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/publish-build-target-nuxt-helper.d.ts
|
|
2
|
+
/** Configure both module and runtime JavaScript without replacing Nuxt entries. */
|
|
3
|
+
declare const nuxtModuleTarget: (target: string | string[]) => (context: unknown) => void;
|
|
4
|
+
/** Read immutable target data across ESM and CommonJS without executing the callback. */
|
|
5
|
+
declare const nuxtModuleTargetTargets: (value: unknown) => string[] | undefined;
|
|
6
|
+
/** Recognize the same declared target data across ESM and CommonJS modules. */
|
|
7
|
+
declare const isNuxtModuleTargetHook: (value: unknown) => boolean;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { isNuxtModuleTargetHook, nuxtModuleTarget, nuxtModuleTargetTargets };
|
|
10
|
+
//# sourceMappingURL=publish-build-target-nuxt-helper.d.mts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region src/publish-build-target-nuxt-helper.ts
|
|
2
|
+
const record = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
|
+
const targetHookBrand = Symbol.for("@stll/oxlint-config.build-target.nuxt");
|
|
4
|
+
const targetHookVersion = 1;
|
|
5
|
+
/** Configure both module and runtime JavaScript without replacing Nuxt entries. */
|
|
6
|
+
const nuxtModuleTarget = (target) => {
|
|
7
|
+
const targets = typeof target === "string" ? [target] : [...target];
|
|
8
|
+
if (targets.length === 0 || targets.some((item) => item.length === 0)) throw new Error("Nuxt module target must contain a JavaScript target");
|
|
9
|
+
const before = (context) => {
|
|
10
|
+
if (!record(context) || !record(context["options"])) throw new Error("Invalid Nuxt build context");
|
|
11
|
+
const options = context["options"];
|
|
12
|
+
if (!record(options["rollup"]) || !Array.isArray(options["entries"]) || options["entries"].length === 0) throw new Error("Invalid resolved Nuxt build options");
|
|
13
|
+
for (const entry of options["entries"]) {
|
|
14
|
+
if (!record(entry) || entry["builder"] !== "rollup" && entry["builder"] !== "mkdist") throw new Error("Unsupported Nuxt JavaScript entry builder");
|
|
15
|
+
if (entry["builder"] === "mkdist") {
|
|
16
|
+
const esbuild = entry["esbuild"];
|
|
17
|
+
if (esbuild !== void 0 && !record(esbuild)) throw new Error("Invalid Nuxt runtime transform options");
|
|
18
|
+
entry["esbuild"] = {
|
|
19
|
+
...esbuild,
|
|
20
|
+
target: [...targets]
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const esbuild = options["rollup"]["esbuild"];
|
|
25
|
+
if (esbuild !== void 0 && !record(esbuild)) throw new Error("Invalid Nuxt module transform options");
|
|
26
|
+
options["rollup"]["esbuild"] = {
|
|
27
|
+
...esbuild,
|
|
28
|
+
target: [...targets]
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(before, targetHookBrand, { value: Object.freeze({
|
|
32
|
+
version: targetHookVersion,
|
|
33
|
+
targets: Object.freeze([...targets])
|
|
34
|
+
}) });
|
|
35
|
+
return before;
|
|
36
|
+
};
|
|
37
|
+
/** Read immutable target data across ESM and CommonJS without executing the callback. */
|
|
38
|
+
const nuxtModuleTargetTargets = (value) => {
|
|
39
|
+
if (typeof value !== "function") return void 0;
|
|
40
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, targetHookBrand);
|
|
41
|
+
if (descriptor === void 0 || descriptor.enumerable !== false || descriptor.writable !== false || descriptor.configurable !== false) return void 0;
|
|
42
|
+
const marker = descriptor.value;
|
|
43
|
+
if (!record(marker) || !Object.isFrozen(marker)) return void 0;
|
|
44
|
+
const keys = Reflect.ownKeys(marker);
|
|
45
|
+
if (keys.length !== 2 || !keys.includes("version") || !keys.includes("targets")) return void 0;
|
|
46
|
+
const version = Object.getOwnPropertyDescriptor(marker, "version");
|
|
47
|
+
const targetData = Object.getOwnPropertyDescriptor(marker, "targets");
|
|
48
|
+
if (!version || !("value" in version) || !targetData || !("value" in targetData)) return void 0;
|
|
49
|
+
if (version.value !== targetHookVersion) return void 0;
|
|
50
|
+
const targets = targetData.value;
|
|
51
|
+
if (!Array.isArray(targets) || !Object.isFrozen(targets) || targets.length === 0) return void 0;
|
|
52
|
+
if (Reflect.ownKeys(targets).length !== targets.length + 1) return void 0;
|
|
53
|
+
const result = [];
|
|
54
|
+
for (let index = 0; index < targets.length; index++) {
|
|
55
|
+
const entry = Object.getOwnPropertyDescriptor(targets, String(index));
|
|
56
|
+
if (!entry || !("value" in entry)) return void 0;
|
|
57
|
+
const target = entry.value;
|
|
58
|
+
if (typeof target !== "string" || target.length === 0) return void 0;
|
|
59
|
+
result.push(target);
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
};
|
|
63
|
+
/** Recognize the same declared target data across ESM and CommonJS modules. */
|
|
64
|
+
const isNuxtModuleTargetHook = (value) => nuxtModuleTargetTargets(value) !== void 0;
|
|
65
|
+
//#endregion
|
|
66
|
+
export { isNuxtModuleTargetHook, nuxtModuleTarget, nuxtModuleTargetTargets };
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=publish-build-target-nuxt-helper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-build-target-nuxt-helper.mjs","names":[],"sources":["../src/publish-build-target-nuxt-helper.ts"],"sourcesContent":["const record = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst targetHookBrand = Symbol.for(\"@stll/oxlint-config.build-target.nuxt\");\nconst targetHookVersion = 1;\n\n/** Configure both module and runtime JavaScript without replacing Nuxt entries. */\nexport const nuxtModuleTarget = (target: string | string[]) => {\n const targets = typeof target === \"string\" ? [target] : [...target];\n if (targets.length === 0 || targets.some((item) => item.length === 0))\n throw new Error(\"Nuxt module target must contain a JavaScript target\");\n const before = (context: unknown) => {\n if (!record(context) || !record(context[\"options\"]))\n throw new Error(\"Invalid Nuxt build context\");\n const options = context[\"options\"];\n if (\n !record(options[\"rollup\"]) ||\n !Array.isArray(options[\"entries\"]) ||\n options[\"entries\"].length === 0\n )\n throw new Error(\"Invalid resolved Nuxt build options\");\n for (const entry of options[\"entries\"]) {\n if (\n !record(entry) ||\n (entry[\"builder\"] !== \"rollup\" && entry[\"builder\"] !== \"mkdist\")\n )\n throw new Error(\"Unsupported Nuxt JavaScript entry builder\");\n if (entry[\"builder\"] === \"mkdist\") {\n const esbuild = entry[\"esbuild\"];\n if (esbuild !== undefined && !record(esbuild))\n throw new Error(\"Invalid Nuxt runtime transform options\");\n entry[\"esbuild\"] = { ...esbuild, target: [...targets] };\n }\n }\n const esbuild = options[\"rollup\"][\"esbuild\"];\n if (esbuild !== undefined && !record(esbuild))\n throw new Error(\"Invalid Nuxt module transform options\");\n options[\"rollup\"][\"esbuild\"] = { ...esbuild, target: [...targets] };\n };\n Object.defineProperty(before, targetHookBrand, {\n value: Object.freeze({\n version: targetHookVersion,\n targets: Object.freeze([...targets]),\n }),\n });\n return before;\n};\n\n/** Read immutable target data across ESM and CommonJS without executing the callback. */\nexport const nuxtModuleTargetTargets = (value: unknown) => {\n if (typeof value !== \"function\") return undefined;\n const descriptor = Object.getOwnPropertyDescriptor(value, targetHookBrand);\n if (\n descriptor === undefined ||\n descriptor.enumerable !== false ||\n descriptor.writable !== false ||\n descriptor.configurable !== false\n )\n return undefined;\n const marker: unknown = descriptor.value;\n if (!record(marker) || !Object.isFrozen(marker)) return undefined;\n const keys = Reflect.ownKeys(marker);\n if (\n keys.length !== 2 ||\n !keys.includes(\"version\") ||\n !keys.includes(\"targets\")\n )\n return undefined;\n const version = Object.getOwnPropertyDescriptor(marker, \"version\");\n const targetData = Object.getOwnPropertyDescriptor(marker, \"targets\");\n if (\n !version ||\n !(\"value\" in version) ||\n !targetData ||\n !(\"value\" in targetData)\n )\n return undefined;\n const markerVersion: unknown = version.value;\n if (markerVersion !== targetHookVersion) return undefined;\n const targets: unknown = targetData.value;\n if (\n !Array.isArray(targets) ||\n !Object.isFrozen(targets) ||\n targets.length === 0\n )\n return undefined;\n if (Reflect.ownKeys(targets).length !== targets.length + 1) return undefined;\n const result: string[] = [];\n for (let index = 0; index < targets.length; index++) {\n const entry = Object.getOwnPropertyDescriptor(targets, String(index));\n if (!entry || !(\"value\" in entry)) return undefined;\n const target: unknown = entry.value;\n if (typeof target !== \"string\" || target.length === 0) return undefined;\n result.push(target);\n }\n return result;\n};\n\n/** Recognize the same declared target data across ESM and CommonJS modules. */\nexport const isNuxtModuleTargetHook = (value: unknown) =>\n nuxtModuleTargetTargets(value) !== undefined;\n"],"mappings":";AAAA,MAAM,UAAU,UACd,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,kBAAkB,OAAO,IAAI,uCAAuC;AAC1E,MAAM,oBAAoB;;AAG1B,MAAa,oBAAoB,WAA8B;CAC7D,MAAM,UAAU,OAAO,WAAW,WAAW,CAAC,MAAM,IAAI,CAAC,GAAG,MAAM;CAClE,IAAI,QAAQ,WAAW,KAAK,QAAQ,MAAM,SAAS,KAAK,WAAW,CAAC,GAClE,MAAM,IAAI,MAAM,qDAAqD;CACvE,MAAM,UAAU,YAAqB;EACnC,IAAI,CAAC,OAAO,OAAO,KAAK,CAAC,OAAO,QAAQ,UAAU,GAChD,MAAM,IAAI,MAAM,4BAA4B;EAC9C,MAAM,UAAU,QAAQ;EACxB,IACE,CAAC,OAAO,QAAQ,SAAS,KACzB,CAAC,MAAM,QAAQ,QAAQ,UAAU,KACjC,QAAQ,UAAU,CAA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,yBAAyB,QAAQ,SAAS;CACjE,MAAM,aAAa,OAAO,yBAAyB,QAAQ,SAAS;CACpE,IACE,CAAC,WACD,EAAE,WAAW,YACb,CAAC,cACD,EAAE,WAAW,aAEb,OAAO,KAAA;CAET,IAD+B,QAAQ,UACjB,mBAAmB,OAAO,KAAA;CAChD,MAAM,UAAmB,WAAW;CACpC,IACE,CAAC,MAAM,QAAQ,OAAO,KACtB,CAAC,OAAO,SAAS,OAAO,KACxB,QAAQ,WAAW,GAEnB,OAAO,KAAA;CACT,IAAI,QAAQ,QAAQ,OAAO,CAAC,CAAC,WAAW,QAAQ,SAAS,GAAG,OAAO,KAAA;CACnE,MAAM,SAAmB,CAAC;CAC1B,KAAK,IAAI,QAAQ,GAAG,QAAQ,QAAQ,QAAQ,SAAS;EACnD,MAAM,QAAQ,OAAO,yBAAyB,SAAS,OAAO,KAAK,CAAC;EACpE,IAAI,CAAC,SAAS,EAAE,WAAW,QAAQ,OAAO,KAAA;EAC1C,MAAM,SAAkB,MAAM;EAC9B,IAAI,OAAO,WAAW,YAAY,OAAO,WAAW,GAAG,OAAO,KAAA;EAC9D,OAAO,KAAK,MAAM;CACpB;CACA,OAAO;AACT;;AAGA,MAAa,0BAA0B,UACrC,wBAAwB,KAAK,MAAM,KAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_publish_build_target_vite_dts_helper = require("./publish-build-target-vite-dts-helper2.cjs");
|
|
3
|
+
exports.declarationOnlyDts = require_publish_build_target_vite_dts_helper.declarationOnlyDts;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
//#region src/publish-build-target-vite-dts.d.ts
|
|
3
|
+
/** Closed factory options; callbacks, custom compilers and output relocation are unsupported. */
|
|
4
|
+
type ReviewedViteDtsOptions = {
|
|
5
|
+
include?: string | readonly string[];
|
|
6
|
+
exclude?: string | readonly string[];
|
|
7
|
+
entryRoot?: string;
|
|
8
|
+
pathsToAliases?: boolean;
|
|
9
|
+
compilerOptions?: Readonly<{
|
|
10
|
+
declarationMap: false;
|
|
11
|
+
}>;
|
|
12
|
+
strictOutput?: true;
|
|
13
|
+
declarationOnly?: false;
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/publish-build-target-vite-dts-helper.d.ts
|
|
17
|
+
type DeclarationOnlyDtsOptions = {
|
|
18
|
+
directory: string;
|
|
19
|
+
} & ReviewedViteDtsOptions;
|
|
20
|
+
/** The actual build uses this closed factory and its guarded declaration hooks. */
|
|
21
|
+
declare const declarationOnlyDts: ({ directory, ...options }: DeclarationOnlyDtsOptions) => Plugin;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { declarationOnlyDts };
|
|
24
|
+
//# sourceMappingURL=publish-build-target-vite-dts-helper.d.cts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
//#region src/publish-build-target-vite-dts.d.ts
|
|
3
|
+
/** Closed factory options; callbacks, custom compilers and output relocation are unsupported. */
|
|
4
|
+
type ReviewedViteDtsOptions = {
|
|
5
|
+
include?: string | readonly string[];
|
|
6
|
+
exclude?: string | readonly string[];
|
|
7
|
+
entryRoot?: string;
|
|
8
|
+
pathsToAliases?: boolean;
|
|
9
|
+
compilerOptions?: Readonly<{
|
|
10
|
+
declarationMap: false;
|
|
11
|
+
}>;
|
|
12
|
+
strictOutput?: true;
|
|
13
|
+
declarationOnly?: false;
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/publish-build-target-vite-dts-helper.d.ts
|
|
17
|
+
type DeclarationOnlyDtsOptions = {
|
|
18
|
+
directory: string;
|
|
19
|
+
} & ReviewedViteDtsOptions;
|
|
20
|
+
/** The actual build uses this closed factory and its guarded declaration hooks. */
|
|
21
|
+
declare const declarationOnlyDts: ({ directory, ...options }: DeclarationOnlyDtsOptions) => Plugin;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { declarationOnlyDts };
|
|
24
|
+
//# sourceMappingURL=publish-build-target-vite-dts-helper.d.mts.map
|