@isdk/json-repair 0.1.2 → 0.2.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.cn.md +245 -14
- package/README.md +293 -14
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +777 -23
- package/dist/index.d.ts +777 -23
- package/dist/index.js +1 -1
- package/docs/README.md +293 -14
- package/docs/_media/README.cn.md +245 -14
- package/docs/classes/RepairParser.md +71 -5
- package/docs/classes/SchemaWalker.md +126 -6
- package/docs/functions/compareScores.md +32 -0
- package/docs/functions/discardedText.md +42 -0
- package/docs/functions/expectsArrayRoot.md +23 -0
- package/docs/functions/findImplicitRecordRegion.md +32 -0
- package/docs/functions/jsonRepair.md +4 -3
- package/docs/functions/jsonRepairResult.md +50 -0
- package/docs/functions/locateJsonCandidates.md +33 -0
- package/docs/functions/looksLikeSchemaEcho.md +29 -0
- package/docs/functions/renderValidatorErrors.md +32 -0
- package/docs/functions/scoreCandidate.md +45 -0
- package/docs/functions/validateValue.md +38 -0
- package/docs/globals.md +19 -0
- package/docs/interfaces/CandidateScore.md +63 -0
- package/docs/interfaces/JsonCandidate.md +71 -0
- package/docs/interfaces/LocatedJson.md +48 -0
- package/docs/interfaces/RepairOptions.md +257 -19
- package/docs/interfaces/RepairResult.md +58 -0
- package/docs/interfaces/ValidationError.md +27 -0
- package/docs/type-aliases/CommentStyle.md +13 -0
- package/docs/type-aliases/EscapeMode.md +13 -0
- package/docs/type-aliases/JSONPath.md +1 -1
- package/docs/type-aliases/LiteralDialect.md +13 -0
- package/docs/type-aliases/RepairFlag.md +11 -0
- package/package.json +38 -12
- package/.prettierignore +0 -4
- package/.prettierrc +0 -8
- package/.versionrc +0 -36
- package/CHANGELOG.md +0 -18
- package/TODO +0 -0
- package/eslint.config.mjs +0 -31
- package/setupVitest.mjs +0 -15
- package/tsconfig.json +0 -19
- package/tsconfig.spec.json +0 -19
- package/tsup.config.ts +0 -34
- package/typedoc.config.cjs +0 -7
- package/vite.config.mjs +0 -16
package/eslint.config.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { defineConfig, globalIgnores } from "eslint/config";
|
|
2
|
-
import tsdoc from "eslint-plugin-tsdoc";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import js from "@eslint/js";
|
|
6
|
-
import { FlatCompat } from "@eslint/eslintrc";
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = path.dirname(__filename);
|
|
10
|
-
const compat = new FlatCompat({
|
|
11
|
-
baseDirectory: __dirname,
|
|
12
|
-
recommendedConfig: js.configs.recommended,
|
|
13
|
-
allConfig: js.configs.all
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export default defineConfig([globalIgnores(["web/**/*", "docs/**/*"]), {
|
|
17
|
-
extends: compat.extends("prettier"),
|
|
18
|
-
|
|
19
|
-
plugins: {
|
|
20
|
-
tsdoc,
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
rules: {
|
|
24
|
-
"tsdoc/syntax": "off",
|
|
25
|
-
"no-cond-assign": "off",
|
|
26
|
-
"yml/plain-scalar": "off",
|
|
27
|
-
"yml/quotes": "off",
|
|
28
|
-
"unicorn/prefer-number-properties": "off",
|
|
29
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
30
|
-
},
|
|
31
|
-
}]);
|
package/setupVitest.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// 这个 fetchMock 没有传递abort 中的 reason!
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
import createFetchMock from 'vitest-fetch-mock';
|
|
5
|
-
import { vi } from 'vitest';
|
|
6
|
-
// import './fetch-polyfill.mjs';
|
|
7
|
-
|
|
8
|
-
const fetchMocker = createFetchMock(vi);
|
|
9
|
-
|
|
10
|
-
// sets globalThis.fetch and globalThis.fetchMock to our mocked version
|
|
11
|
-
fetchMocker.enableMocks();
|
|
12
|
-
|
|
13
|
-
// changes default behavior of fetchMock to use the real 'fetch' implementation and not mock responses
|
|
14
|
-
fetchMocker.dontMock();
|
|
15
|
-
*/
|
package/tsconfig.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"outDir": "./dist",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true
|
|
12
|
-
},
|
|
13
|
-
"exclude": [
|
|
14
|
-
"node_modules",
|
|
15
|
-
"**/*.spec.ts",
|
|
16
|
-
"**/*.test.ts"
|
|
17
|
-
],
|
|
18
|
-
"include": ["src/**/*"]
|
|
19
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"types": ["jest", "node"],
|
|
4
|
-
"target": "es2020",
|
|
5
|
-
"module": "esnext",
|
|
6
|
-
"moduleResolution": "node",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"typeRoots": ["./node_modules/@types", "./types"],
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"noUnusedLocals": true,
|
|
12
|
-
"noImplicitAny": true,
|
|
13
|
-
"resolveJsonModule": true
|
|
14
|
-
},
|
|
15
|
-
"exclude": [
|
|
16
|
-
"node_modules",
|
|
17
|
-
"**/*.spec.ts"
|
|
18
|
-
]
|
|
19
|
-
}
|
package/tsup.config.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'tsup'
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
entry: ['src/index.ts'],
|
|
5
|
-
format: ['cjs', 'esm'],
|
|
6
|
-
// Inject cjs and esm shims:https://tsup.egoist.dev/#inject-cjs-and-esm-shims
|
|
7
|
-
shims: true,
|
|
8
|
-
// splitting: true,
|
|
9
|
-
// sourcemap: true,
|
|
10
|
-
// clean: true,
|
|
11
|
-
minify: 'terser',
|
|
12
|
-
terserOptions: {
|
|
13
|
-
// compress: {
|
|
14
|
-
// drop_console: true,
|
|
15
|
-
// drop_debugger: true,
|
|
16
|
-
// },
|
|
17
|
-
// https://terser.org/docs/options/#mangle-options
|
|
18
|
-
"mangle": {
|
|
19
|
-
"properties": {
|
|
20
|
-
"regex": /^_[$]/,
|
|
21
|
-
// "undeclared": true, // Mangle those names when they are accessed as properties of known top level variables but their declarations are never found in input code.
|
|
22
|
-
},
|
|
23
|
-
"toplevel": true,
|
|
24
|
-
"reserved": [
|
|
25
|
-
// # expected names in web-extension content
|
|
26
|
-
"WeakSet", "Set",
|
|
27
|
-
// # expected names in 3rd-party extensions' contents
|
|
28
|
-
"requestIdleCallback",
|
|
29
|
-
// # content global names:
|
|
30
|
-
"browser",
|
|
31
|
-
],
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
})
|
package/typedoc.config.cjs
DELETED
package/vite.config.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite'
|
|
2
|
-
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
plugins: [tsconfigPaths({
|
|
6
|
-
projects: ['./tsconfig.spec.json'],
|
|
7
|
-
})],
|
|
8
|
-
test: {
|
|
9
|
-
include: ['src/**/*.spec.ts', 'src/**/*.test.ts', 'test/*.spec.ts', 'test/*.test.ts'],
|
|
10
|
-
testTimeout: 80000,
|
|
11
|
-
globals: true,
|
|
12
|
-
"setupFiles": [
|
|
13
|
-
"./setupVitest.mjs"
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
})
|