@next-vibe/checker 1.0.14 → 1.0.16

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.
@@ -1,4 +1,409 @@
1
- (function() {
2
- "use strict";
3
- })();
4
- //# sourceMappingURL=restricted-syntax.js.map
1
+ import { createRequire } from "node:module";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __moduleCache = /* @__PURE__ */ new WeakMap;
7
+ var __toCommonJS = (from) => {
8
+ var entry = __moduleCache.get(from), desc;
9
+ if (entry)
10
+ return entry;
11
+ entry = __defProp({}, "__esModule", { value: true });
12
+ if (from && typeof from === "object" || typeof from === "function")
13
+ __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ }));
17
+ __moduleCache.set(from, entry);
18
+ return entry;
19
+ };
20
+ var __export = (target, all) => {
21
+ for (var name in all)
22
+ __defProp(target, name, {
23
+ get: all[name],
24
+ enumerable: true,
25
+ configurable: true,
26
+ set: (newValue) => all[name] = () => newValue
27
+ });
28
+ };
29
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
30
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
31
+
32
+ // src/app/api/[locale]/system/check/oxlint/plugins/shared/config-loader.ts
33
+ var exports_config_loader = {};
34
+ __export(exports_config_loader, {
35
+ loadPluginConfig: () => loadPluginConfig,
36
+ getCheckConfig: () => getCheckConfig,
37
+ createPluginMessages: () => createPluginMessages,
38
+ clearConfigCache: () => clearConfigCache
39
+ });
40
+ import { existsSync } from "node:fs";
41
+ import { dirname, resolve } from "node:path";
42
+ function findProjectRoot() {
43
+ const cwd = process.cwd();
44
+ let currentDir = cwd;
45
+ const root = resolve("/");
46
+ while (currentDir !== root) {
47
+ const configPath = resolve(currentDir, "check.config.ts");
48
+ if (existsSync(configPath)) {
49
+ return currentDir;
50
+ }
51
+ const jsConfigPath = resolve(currentDir, "check.config.js");
52
+ if (existsSync(jsConfigPath)) {
53
+ return currentDir;
54
+ }
55
+ currentDir = dirname(currentDir);
56
+ }
57
+ return cwd;
58
+ }
59
+ function getConfigPaths() {
60
+ const projectRoot = findProjectRoot();
61
+ return [
62
+ resolve(projectRoot, "check.config.ts"),
63
+ resolve(projectRoot, "check.config.js"),
64
+ resolve(projectRoot, "node_modules", "next-vibe", "check.config.js"),
65
+ resolve(projectRoot, "node_modules", "next-vibe", "dist", "check.config.js")
66
+ ];
67
+ }
68
+ function loadCheckConfigSync() {
69
+ if (configLoadAttempted) {
70
+ return cachedCheckConfig;
71
+ }
72
+ configLoadAttempted = true;
73
+ const configPaths = getConfigPaths();
74
+ for (const configPath of configPaths) {
75
+ if (!existsSync(configPath)) {
76
+ continue;
77
+ }
78
+ try {
79
+ const configModule = __require(configPath);
80
+ const exportedValue = configModule.default ?? configModule.config;
81
+ if (!exportedValue) {
82
+ continue;
83
+ }
84
+ const config = typeof exportedValue === "function" ? exportedValue() : exportedValue;
85
+ cachedCheckConfig = config;
86
+ return config;
87
+ } catch {
88
+ continue;
89
+ }
90
+ }
91
+ return null;
92
+ }
93
+ function extractPluginOptions(checkConfig, pluginName) {
94
+ if (!checkConfig.oxlint.enabled) {
95
+ return null;
96
+ }
97
+ const rules = checkConfig.oxlint.rules;
98
+ if (!rules) {
99
+ return null;
100
+ }
101
+ const ruleConfig = rules[pluginName];
102
+ if (Array.isArray(ruleConfig) && ruleConfig.length >= 2) {
103
+ return ruleConfig[1];
104
+ }
105
+ return null;
106
+ }
107
+ function loadPluginConfig(pluginName, defaultConfig) {
108
+ const cached = pluginConfigCache.get(pluginName);
109
+ if (cached) {
110
+ return cached;
111
+ }
112
+ const checkConfig = loadCheckConfigSync();
113
+ if (checkConfig) {
114
+ const pluginOptions = extractPluginOptions(checkConfig, pluginName);
115
+ if (pluginOptions) {
116
+ const result2 = {
117
+ success: true,
118
+ config: pluginOptions,
119
+ source: "rule-config"
120
+ };
121
+ pluginConfigCache.set(pluginName, result2);
122
+ return result2;
123
+ }
124
+ }
125
+ if (defaultConfig) {
126
+ const result2 = {
127
+ success: true,
128
+ config: defaultConfig,
129
+ source: "default"
130
+ };
131
+ pluginConfigCache.set(pluginName, result2);
132
+ return result2;
133
+ }
134
+ const result = {
135
+ success: false,
136
+ config: null,
137
+ source: "error",
138
+ error: `No configuration found for ${pluginName}`
139
+ };
140
+ pluginConfigCache.set(pluginName, result);
141
+ return result;
142
+ }
143
+ function getCheckConfig() {
144
+ return loadCheckConfigSync();
145
+ }
146
+ function clearConfigCache() {
147
+ cachedCheckConfig = null;
148
+ configLoadAttempted = false;
149
+ pluginConfigCache.clear();
150
+ }
151
+ function createPluginMessages(defaults, overrides) {
152
+ return { ...defaults, ...overrides };
153
+ }
154
+ var cachedCheckConfig = null, configLoadAttempted = false, pluginConfigCache;
155
+ var init_config_loader = __esm(() => {
156
+ pluginConfigCache = new Map;
157
+ });
158
+
159
+ // src/app/api/[locale]/system/check/oxlint/plugins/restricted-syntax/src/index.ts
160
+ var DEFAULT_CONFIG = {
161
+ jsxAllowedProperties: [
162
+ "content",
163
+ "icon",
164
+ "title",
165
+ "label",
166
+ "description",
167
+ "children",
168
+ "render",
169
+ "fallback",
170
+ "error",
171
+ "loading",
172
+ "empty",
173
+ "header",
174
+ "footer",
175
+ "trigger",
176
+ "component"
177
+ ]
178
+ };
179
+ var DEFAULT_MESSAGES = {
180
+ unknownType: "Usage of the 'unknown' type isn't allowed. Consider using the inferred types from the unified interface system based on definition.ts",
181
+ objectType: "Usage of the 'object' type isn't allowed. Consider using the inferred types from the unified interface system based on definition.ts",
182
+ throwStatement: "Usage of 'throw' statements is not allowed. Use proper ResponseType<T> patterns instead.",
183
+ jsxInObjectLiteral: "JSX elements inside object literals are not allowed. Extract JSX to a separate function to ensure i18n rules work properly."
184
+ };
185
+ var configLoader = null;
186
+ var cachedConfig = null;
187
+ var cachedMessages = null;
188
+ function getConfigLoader() {
189
+ if (configLoader) {
190
+ return configLoader;
191
+ }
192
+ try {
193
+ configLoader = (init_config_loader(), __toCommonJS(exports_config_loader));
194
+ return configLoader;
195
+ } catch {
196
+ return null;
197
+ }
198
+ }
199
+ function loadRestrictedSyntaxConfig() {
200
+ if (cachedConfig !== null) {
201
+ return cachedConfig;
202
+ }
203
+ const loader = getConfigLoader();
204
+ if (loader) {
205
+ const result = loader.loadPluginConfig("oxlint-plugin-restricted/restricted-syntax", DEFAULT_CONFIG);
206
+ cachedConfig = result.config ?? DEFAULT_CONFIG;
207
+ } else {
208
+ cachedConfig = loadConfigFallback();
209
+ }
210
+ return cachedConfig;
211
+ }
212
+ function loadConfigFallback() {
213
+ try {
214
+ const config = __require(`${process.cwd()}/check.config.ts`);
215
+ const checkConfig = config.default ?? config;
216
+ const exported = typeof checkConfig === "function" ? checkConfig() : checkConfig;
217
+ const ruleConfig = exported?.oxlint?.rules?.["oxlint-plugin-restricted/restricted-syntax"];
218
+ if (Array.isArray(ruleConfig) && ruleConfig[1]) {
219
+ return ruleConfig[1];
220
+ }
221
+ } catch {}
222
+ return DEFAULT_CONFIG;
223
+ }
224
+ function getMessages() {
225
+ if (cachedMessages !== null) {
226
+ return cachedMessages;
227
+ }
228
+ cachedMessages = DEFAULT_MESSAGES;
229
+ return cachedMessages;
230
+ }
231
+ function isProperty(node) {
232
+ return node.type === "Property" && typeof node.method === "boolean";
233
+ }
234
+ function isAllowedPath(context) {
235
+ let filename = "";
236
+ if (typeof context.getFilename === "function") {
237
+ filename = context.getFilename();
238
+ } else if (typeof context.filename === "string") {
239
+ filename = context.filename;
240
+ }
241
+ if (!filename) {
242
+ return false;
243
+ }
244
+ return false;
245
+ }
246
+ function hasDisableComment(context, node) {
247
+ const getComments = context.getCommentsBefore ?? context.sourceCode?.getCommentsBefore;
248
+ if (typeof getComments !== "function") {
249
+ return false;
250
+ }
251
+ try {
252
+ const comments = getComments(node);
253
+ if (!comments || !Array.isArray(comments)) {
254
+ return false;
255
+ }
256
+ for (const comment of comments) {
257
+ if (!comment || typeof comment.value !== "string") {
258
+ continue;
259
+ }
260
+ const commentText = comment.value.trim();
261
+ if ((commentText.includes("eslint-disable-next-line") || commentText.includes("oxlint-disable-next-line")) && (commentText.includes("restricted-syntax") || commentText.includes("no-restricted-syntax"))) {
262
+ return true;
263
+ }
264
+ }
265
+ } catch {
266
+ return false;
267
+ }
268
+ return false;
269
+ }
270
+ function isObjectProperty(prop) {
271
+ return isProperty(prop);
272
+ }
273
+ function getJsxAllowedProperties(context) {
274
+ const ruleOptions = context.options?.[0];
275
+ if (ruleOptions?.jsxAllowedProperties) {
276
+ return new Set(ruleOptions.jsxAllowedProperties);
277
+ }
278
+ const config = loadRestrictedSyntaxConfig();
279
+ if (config.jsxAllowedProperties) {
280
+ return new Set(config.jsxAllowedProperties);
281
+ }
282
+ return new Set;
283
+ }
284
+ function isJSXAllowedKey(prop, jsxAllowedProperties) {
285
+ const property = prop;
286
+ if (property.computed) {
287
+ return false;
288
+ }
289
+ const key = property.key;
290
+ if (!key) {
291
+ return false;
292
+ }
293
+ let keyName = null;
294
+ if (key.type === "Identifier") {
295
+ keyName = key.name;
296
+ } else if (key.type === "Literal" && typeof key.value === "string") {
297
+ keyName = key.value;
298
+ }
299
+ return keyName !== null && jsxAllowedProperties.has(keyName);
300
+ }
301
+ function isJSX(n) {
302
+ return n && (n.type === "JSXElement" || n.type === "JSXFragment");
303
+ }
304
+ function unwrapParen(n) {
305
+ let cur = n;
306
+ while (cur?.type === "ParenthesizedExpression") {
307
+ const expr = cur.expression;
308
+ if (!expr) {
309
+ break;
310
+ }
311
+ cur = expr;
312
+ }
313
+ return cur;
314
+ }
315
+ var restrictedSyntaxRule = {
316
+ meta: {
317
+ type: "problem",
318
+ docs: {
319
+ description: "Enforces restricted syntax patterns (no unknown, object, throw, JSX in non-React-node properties)",
320
+ category: "Best Practices",
321
+ recommended: true
322
+ },
323
+ schema: [
324
+ {
325
+ type: "object",
326
+ properties: {
327
+ jsxAllowedProperties: { type: "array", items: { type: "string" } }
328
+ }
329
+ }
330
+ ]
331
+ },
332
+ create(context) {
333
+ const isAllowed = isAllowedPath(context);
334
+ const jsxAllowedProperties = getJsxAllowedProperties(context);
335
+ const messages = getMessages();
336
+ return {
337
+ TSUnknownKeyword(node) {
338
+ if (isAllowed || hasDisableComment(context, node)) {
339
+ return;
340
+ }
341
+ context.report({
342
+ node,
343
+ message: messages.unknownType
344
+ });
345
+ },
346
+ TSObjectKeyword(node) {
347
+ if (isAllowed || hasDisableComment(context, node)) {
348
+ return;
349
+ }
350
+ context.report({
351
+ node,
352
+ message: messages.objectType
353
+ });
354
+ },
355
+ ThrowStatement(node) {
356
+ if (isAllowed || hasDisableComment(context, node)) {
357
+ return;
358
+ }
359
+ context.report({
360
+ node,
361
+ message: messages.throwStatement
362
+ });
363
+ },
364
+ Property(node) {
365
+ if (!isObjectProperty(node)) {
366
+ return;
367
+ }
368
+ if (isJSXAllowedKey(node, jsxAllowedProperties)) {
369
+ return;
370
+ }
371
+ const property = node;
372
+ const value = property.value;
373
+ if (!value || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null) {
374
+ return;
375
+ }
376
+ if (isJSX(value)) {
377
+ context.report({
378
+ node: value,
379
+ message: messages.jsxInObjectLiteral
380
+ });
381
+ return;
382
+ }
383
+ if (value.type === "ParenthesizedExpression") {
384
+ const inner = unwrapParen(value);
385
+ if (isJSX(inner)) {
386
+ context.report({
387
+ node: inner,
388
+ message: messages.jsxInObjectLiteral
389
+ });
390
+ }
391
+ }
392
+ }
393
+ };
394
+ }
395
+ };
396
+ var src_default = {
397
+ meta: {
398
+ name: "oxlint-plugin-restricted",
399
+ version: "1.0.0"
400
+ },
401
+ rules: {
402
+ "restricted-syntax": restrictedSyntaxRule
403
+ }
404
+ };
405
+ export {
406
+ DEFAULT_MESSAGES as defaultMessages,
407
+ DEFAULT_CONFIG as defaultConfig,
408
+ src_default as default
409
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-vibe/checker",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "main": "./.dist/bin/vibe-runtime.js",
5
5
  "author": "Max Brandstätter",
6
6
  "description": "TypeScript code quality checker with CLI and MCP support",
@@ -1834,7 +1834,7 @@ export function isViteBuildType(type: BuildType): type is ViteBuildType {
1834
1834
 
1835
1835
  /** Type guard for Bun builds */
1836
1836
  export function isBunBuildType(type: BuildType): type is BunBuildType {
1837
- return type === BunBuildTypeEnum.EXECUTABLE;
1837
+ return Object.values(BunBuildTypeEnum).includes(type as BunBuildTypeEnum);
1838
1838
  }
1839
1839
 
1840
1840
  // ============================================================================
@@ -176,7 +176,7 @@ export class BunCompiler implements IBunCompiler {
176
176
  : (profileSettings.sourcemap as "external" | "inline" | "none"));
177
177
 
178
178
  // Build with Bun
179
- const result = await Bun.build({
179
+ const buildOptions = {
180
180
  entrypoints: [entrypointPath],
181
181
  outdir: outDir,
182
182
  target: bunOptions?.target || "bun",
@@ -195,7 +195,9 @@ export class BunCompiler implements IBunCompiler {
195
195
  banner: bunOptions?.banner,
196
196
  footer: bunOptions?.footer,
197
197
  bytecode: bunOptions?.bytecode,
198
- });
198
+ };
199
+
200
+ const result = await Bun.build(buildOptions);
199
201
 
200
202
  if (!result.success) {
201
203
  const errorMessages = result.logs
@@ -114,6 +114,7 @@ export class ConfigRepositoryImpl implements ConfigRepositoryInterface {
114
114
  "node_modules",
115
115
  "@next-vibe",
116
116
  "checker",
117
+ ".dist",
117
118
  "oxlint-plugins",
118
119
  fileName,
119
120
  );
@@ -143,6 +144,7 @@ export class ConfigRepositoryImpl implements ConfigRepositoryInterface {
143
144
  "node_modules",
144
145
  "@next-vibe",
145
146
  "checker",
147
+ ".dist",
146
148
  "oxlint-plugins",
147
149
  fileName,
148
150
  );
@@ -4,7 +4,7 @@
4
4
  "": {
5
5
  "name": "check-test-project",
6
6
  "dependencies": {
7
- "@next-vibe/checker": "^1.0.13",
7
+ "@next-vibe/checker": "^1.0.15",
8
8
  },
9
9
  },
10
10
  },
@@ -183,7 +183,7 @@
183
183
 
184
184
  "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
185
185
 
186
- "@next-vibe/checker": ["@next-vibe/checker@1.0.13", "", { "dependencies": { "@inquirer/prompts": "8.1.0", "argon2": "0.44.0", "chalk": "5.6.2", "commander": "14.0.2", "date-fns": "4.1.0", "dotenv": "17.2.3", "eslint-plugin-i18next": "6.1.3", "eslint-plugin-react-compiler": "19.1.0-rc.2", "fs-extra": "^11.3.3", "glob": "13.0.0", "gradient-string": "3.0.0", "jose": "6.1.3", "jsonc-parser": "3.3.1", "server-only": "0.0.1", "typescript": "5.9.3", "vite": "7.3.0", "zod": "4.2.1" }, "bin": { "vibe": ".dist/bin/vibe-runtime.js" } }, "sha512-63FjSA5f73D+X+KVwSHZRhXYBjwue9PEKFdk1wQry21x1DCey3V9MbCyTFGvHTCayHe3fbry7yDk1W6/LePKoA=="],
186
+ "@next-vibe/checker": ["@next-vibe/checker@1.0.15", "", { "dependencies": { "@inquirer/prompts": "8.1.0", "argon2": "0.44.0", "chalk": "5.6.2", "commander": "14.0.2", "date-fns": "4.1.0", "dotenv": "17.2.3", "eslint-plugin-i18next": "6.1.3", "eslint-plugin-react-compiler": "19.1.0-rc.2", "fs-extra": "^11.3.3", "glob": "13.0.0", "gradient-string": "3.0.0", "jose": "6.1.3", "jsonc-parser": "3.3.1", "server-only": "0.0.1", "typescript": "5.9.3", "vite": "7.3.0", "zod": "4.2.1" }, "bin": { "vibe": ".dist/bin/vibe-runtime.js" } }, "sha512-DrpOWq8mQc/+oK59q2VJq0+wmyVF4dCh/UJnHJs3PaDjKHwNdDn8xKu0CCBuQCafSgciUNmpcOFMfn7S8BpfYQ=="],
187
187
 
188
188
  "@phc/format": ["@phc/format@1.0.0", "", {}, "sha512-m7X9U6BG2+J+R1lSOdCiITLLrxm+cWlNI3HUFA92oLO77ObGNzaKdh8pMLqdZcshtkKuV84olNNXDfMc4FezBQ=="],
189
189
 
@@ -7,6 +7,6 @@
7
7
  "check-r": "vibe check"
8
8
  },
9
9
  "dependencies": {
10
- "@next-vibe/checker": "^1.0.13"
10
+ "@next-vibe/checker": "^1.0.15"
11
11
  }
12
12
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"i18n.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsx-capitalization.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"restricted-syntax.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}