@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.
Files changed (46) hide show
  1. package/README.cn.md +245 -14
  2. package/README.md +293 -14
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.cts +777 -23
  5. package/dist/index.d.ts +777 -23
  6. package/dist/index.js +1 -1
  7. package/docs/README.md +293 -14
  8. package/docs/_media/README.cn.md +245 -14
  9. package/docs/classes/RepairParser.md +71 -5
  10. package/docs/classes/SchemaWalker.md +126 -6
  11. package/docs/functions/compareScores.md +32 -0
  12. package/docs/functions/discardedText.md +42 -0
  13. package/docs/functions/expectsArrayRoot.md +23 -0
  14. package/docs/functions/findImplicitRecordRegion.md +32 -0
  15. package/docs/functions/jsonRepair.md +4 -3
  16. package/docs/functions/jsonRepairResult.md +50 -0
  17. package/docs/functions/locateJsonCandidates.md +33 -0
  18. package/docs/functions/looksLikeSchemaEcho.md +29 -0
  19. package/docs/functions/renderValidatorErrors.md +32 -0
  20. package/docs/functions/scoreCandidate.md +45 -0
  21. package/docs/functions/validateValue.md +38 -0
  22. package/docs/globals.md +19 -0
  23. package/docs/interfaces/CandidateScore.md +63 -0
  24. package/docs/interfaces/JsonCandidate.md +71 -0
  25. package/docs/interfaces/LocatedJson.md +48 -0
  26. package/docs/interfaces/RepairOptions.md +257 -19
  27. package/docs/interfaces/RepairResult.md +58 -0
  28. package/docs/interfaces/ValidationError.md +27 -0
  29. package/docs/type-aliases/CommentStyle.md +13 -0
  30. package/docs/type-aliases/EscapeMode.md +13 -0
  31. package/docs/type-aliases/JSONPath.md +1 -1
  32. package/docs/type-aliases/LiteralDialect.md +13 -0
  33. package/docs/type-aliases/RepairFlag.md +11 -0
  34. package/package.json +38 -12
  35. package/.prettierignore +0 -4
  36. package/.prettierrc +0 -8
  37. package/.versionrc +0 -36
  38. package/CHANGELOG.md +0 -18
  39. package/TODO +0 -0
  40. package/eslint.config.mjs +0 -31
  41. package/setupVitest.mjs +0 -15
  42. package/tsconfig.json +0 -19
  43. package/tsconfig.spec.json +0 -19
  44. package/tsup.config.ts +0 -34
  45. package/typedoc.config.cjs +0 -7
  46. 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
- }
@@ -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
- })
@@ -1,7 +0,0 @@
1
- /** @type {import('typedoc').TypeDocOptions} */
2
- module.exports = {
3
- entryPoints: ['./src/index.ts'],
4
- externalSymbolLinkMappings: {
5
- "events-ex": { "EventEmitter": "#" }
6
- },
7
- }
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
- })