oxlint-react-compiler-experimental 0.0.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.
@@ -0,0 +1,23 @@
1
+ import { a as loadPlugin, l as setOptions, n as lintFile } from "./lint.js";
2
+ import { t as getErrorMessage } from "./utils.js";
3
+ //#region src-js/plugins/config.ts
4
+ /**
5
+ * Populates Rust-resolved configuration options on the JS side.
6
+ * Called from Rust side after all configuration options have been resolved.
7
+ *
8
+ * Note: the name `setupRuleConfigs` is currently incorrect, as we only populate rule options.
9
+ * The intention is for this function to transfer all configurations in a multi-config workspace.
10
+ * The configuration relevant to each file would then be resolved on the JS side.
11
+ *
12
+ * @param optionsJSON - Array of all rule options across all configurations, serialized as JSON
13
+ * @returns `null` if success, or error message string
14
+ */
15
+ function setupRuleConfigs(optionsJSON) {
16
+ try {
17
+ return setOptions(optionsJSON), null;
18
+ } catch (err) {
19
+ return getErrorMessage(err);
20
+ }
21
+ }
22
+ //#endregion
23
+ export { lintFile, loadPlugin, setupRuleConfigs };
package/dist/utils.js ADDED
@@ -0,0 +1,44 @@
1
+ //#region src-js/utils/globals.ts
2
+ /**
3
+ * Properties of global objects exported as variables.
4
+ *
5
+ * TSDown will replace e.g. `Object.keys` with import of `ObjectKeys` from this file.
6
+ *
7
+ * If you use any globals in code in `src-js` directory, you should add them to this file.
8
+ *
9
+ * See TSDown config file for more details.
10
+ */
11
+ const { prototype: ObjectPrototype, hasOwn: ObjectHasOwn, keys: ObjectKeys, values: ObjectValues, freeze: ObjectFreeze, defineProperty: ObjectDefineProperty, defineProperties: ObjectDefineProperties, create: ObjectCreate, assign: ObjectAssign, getPrototypeOf: ObjectGetPrototypeOf, setPrototypeOf: ObjectSetPrototypeOf, entries: ObjectEntries } = Object, { prototype: ArrayPrototype, isArray: ArrayIsArray, from: ArrayFrom } = Array, { min: MathMin, max: MathMax, floor: MathFloor } = Math, { parse: JSONParse, stringify: JSONStringify } = JSON, { ownKeys: ReflectOwnKeys } = Reflect, { iterator: SymbolIterator } = Symbol, { fromCodePoint: StringFromCodePoint } = String, { now: DateNow } = Date;
12
+ //#endregion
13
+ //#region src-js/utils/utils.ts
14
+ /**
15
+ * Get error message from an error.
16
+ *
17
+ * `err` is expected to be an `Error` object, but can be anything.
18
+ *
19
+ * * If it's an `Error`, the error message and stack trace is returned.
20
+ * * If it's another object with a string `message` property, `message` is returned.
21
+ * * Otherwise, a generic "Unknown error" message is returned.
22
+ *
23
+ * This function will never throw, and always returns a non-empty string, even if:
24
+ *
25
+ * * `err` is `null` or `undefined`.
26
+ * * `err` is an object with a getter for `message` property which throws.
27
+ * * `err` has a getter for `stack` or `message` property which returns a different value each time it's accessed.
28
+ *
29
+ * @param err - Error
30
+ * @returns Error message
31
+ */
32
+ function getErrorMessage(err) {
33
+ try {
34
+ if (err instanceof Error) {
35
+ let { stack } = err;
36
+ if (typeof stack == "string" && stack !== "") return stack;
37
+ }
38
+ let { message } = err;
39
+ if (typeof message == "string" && message !== "") return message;
40
+ } catch {}
41
+ return "Unknown error";
42
+ }
43
+ //#endregion
44
+ export { StringFromCodePoint as _, JSONParse as a, MathMin as c, ObjectDefineProperty as d, ObjectEntries as f, ObjectValues as g, ObjectKeys as h, DateNow as i, ObjectAssign as l, ObjectHasOwn as m, ArrayFrom as n, JSONStringify as o, ObjectFreeze as p, ArrayIsArray as r, MathMax as s, getErrorMessage as t, ObjectCreate as u, SymbolIterator as v };
@@ -0,0 +1,2 @@
1
+ import { a as setCurrentWorkspace, i as destroyWorkspace, n as currentWorkspace, o as workspaces, r as currentWorkspaceUri, t as createWorkspace } from "./workspace2.js";
2
+ export { createWorkspace, currentWorkspace, currentWorkspaceUri, destroyWorkspace, setCurrentWorkspace, workspaces };
@@ -0,0 +1,35 @@
1
+ //#region src-js/workspace/index.ts
2
+ /**
3
+ * Active workspaces.
4
+ * Keyed by workspace URI.
5
+ */
6
+ const workspaces = /* @__PURE__ */ new Map();
7
+ /**
8
+ * Most recent workspace that was used.
9
+ */
10
+ let currentWorkspace = null, currentWorkspaceUri = null;
11
+ /**
12
+ * Create a new workspace.
13
+ */
14
+ function createWorkspace(workspaceUri) {
15
+ workspaces.set(workspaceUri, {
16
+ cwd: "",
17
+ allOptions: [],
18
+ rules: []
19
+ }), currentWorkspace = null, currentWorkspaceUri = null;
20
+ }
21
+ /**
22
+ * Destroy a workspace.
23
+ * Unloads all plugin data associated with this workspace.
24
+ */
25
+ function destroyWorkspace(workspaceUri) {}
26
+ /**
27
+ * Set the current workspace.
28
+ * @param workspace - Workspace object
29
+ * @param workspaceUri - Workspace URI
30
+ */
31
+ function setCurrentWorkspace(workspace, workspaceUri) {
32
+ currentWorkspace = workspace, currentWorkspaceUri = workspaceUri;
33
+ }
34
+ //#endregion
35
+ export { setCurrentWorkspace as a, destroyWorkspace as i, currentWorkspace as n, workspaces as o, currentWorkspaceUri as r, createWorkspace as t };
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "oxlint-react-compiler-experimental",
3
+ "version": "0.0.0",
4
+ "description": "Linter for the JavaScript Oxidation Compiler",
5
+ "keywords": [
6
+ "eslint",
7
+ "javascript",
8
+ "linter",
9
+ "oxc",
10
+ "oxlint",
11
+ "typescript"
12
+ ],
13
+ "homepage": "https://oxc.rs/docs/guide/usage/linter",
14
+ "bugs": "https://github.com/oxc-project/oxc/issues",
15
+ "license": "MIT",
16
+ "author": "Boshen and oxc contributors",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/oxc-project/oxc",
20
+ "directory": "npm/oxlint"
21
+ },
22
+ "funding": {
23
+ "url": "https://github.com/sponsors/Boshen"
24
+ },
25
+ "bin": {
26
+ "oxlint": "bin/oxlint"
27
+ },
28
+ "files": [
29
+ "configuration_schema.json",
30
+ "dist",
31
+ "README.md",
32
+ "bin/oxlint"
33
+ ],
34
+ "type": "module",
35
+ "main": "dist/index.js",
36
+ "types": "dist/index.d.ts",
37
+ "exports": {
38
+ ".": {
39
+ "types": "./dist/index.d.ts",
40
+ "default": "./dist/index.js"
41
+ },
42
+ "./plugins-dev": {
43
+ "types": "./dist/plugins-dev.d.ts",
44
+ "default": "./dist/plugins-dev.js"
45
+ }
46
+ },
47
+ "peerDependencies": {
48
+ "oxlint-tsgolint": ">=0.15.0"
49
+ },
50
+ "peerDependenciesMeta": {
51
+ "oxlint-tsgolint": {
52
+ "optional": true
53
+ }
54
+ },
55
+ "napi": {
56
+ "binaryName": "oxlint",
57
+ "packageName": "@oxlint/binding",
58
+ "targets": [
59
+ "aarch64-apple-darwin"
60
+ ]
61
+ },
62
+ "engines": {
63
+ "node": "^20.19.0 || >=22.12.0"
64
+ },
65
+ "preferUnplugged": true
66
+ }