@visulima/error 3.2.8 → 3.2.10

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/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ ## @visulima/error [3.2.10](https://github.com/visulima/visulima/compare/@visulima/error@3.2.9...@visulima/error@3.2.10) (2024-06-05)
2
+
3
+
4
+ ### Miscellaneous Chores
5
+
6
+ * updated dev dependencies ([a2e0504](https://github.com/visulima/visulima/commit/a2e0504dc239049434c2482756ff15bdbaac9b54))
7
+
8
+
9
+
10
+ ### Dependencies
11
+
12
+ * **@visulima/nextra-theme-docs:** upgraded to 4.0.25
13
+
14
+ ## @visulima/error [3.2.9](https://github.com/visulima/visulima/compare/@visulima/error@3.2.8...@visulima/error@3.2.9) (2024-05-24)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * changed pathe to @visulima/path ([#410](https://github.com/visulima/visulima/issues/410)) ([bfe1287](https://github.com/visulima/visulima/commit/bfe1287aff6d28d5dca302fd4d58c1f6234ce0bb))
20
+
21
+
22
+ ### Miscellaneous Chores
23
+
24
+ * changed semantic-release-npm to pnpm ([b6d100a](https://github.com/visulima/visulima/commit/b6d100a2bf3fd026577be48726a37754947f0973))
25
+
26
+
27
+
28
+ ### Dependencies
29
+
30
+ * **@visulima/path:** upgraded to 1.0.1
31
+
1
32
  ## @visulima/error [3.2.8](https://github.com/visulima/visulima/compare/@visulima/error@3.2.7...@visulima/error@3.2.8) (2024-05-15)
2
33
 
3
34
 
package/README.md CHANGED
File without changes
@@ -1,7 +1,7 @@
1
1
  import { readFileSync } from 'node:fs';
2
- import { dirname, resolve } from 'node:path';
3
2
  import { AnyMap } from '@jridgewell/trace-mapping';
4
3
  export { generatedPositionFor as b, originalPositionFor as c, sourceContentFor as d, traceSegment as e } from '@jridgewell/trace-mapping';
4
+ import { dirname, resolve } from '@visulima/path';
5
5
 
6
6
  var l=/^data:application\/json[^,]+base64,/,f=/\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+)[ \t]*$|\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*\*\/[ \t]*$/,c=e=>l.test(e),m=(e,n)=>{let o=e.split(/\r?\n/),t=null;for(let r=o.length-1;r>=0&&!t;r--)t=f.exec(o[r]);if(t)return c(t[1])?t[1]:resolve(n,t[1])},M=e=>{let n=e.slice(e.indexOf(",")+1);return Buffer.from(n,"base64").toString()},y=e=>{let n;try{n=readFileSync(e,{encoding:"utf8"});}catch(r){throw r.message=`Error reading sourcemap for file "${e}":
7
7
  ${r.message}`,r}let o=m(n,dirname(e));if(!o)return;let t;if(c(o))t=M(o);else try{t=readFileSync(o,{encoding:"utf8"});}catch(r){throw r.message=`Error reading sourcemap for file "${e}":
@@ -10,4 +10,4 @@ ${r.message}`,r}},p=y;
10
10
 
11
11
  export { p as a };
12
12
  //# sourceMappingURL=out.js.map
13
- //# sourceMappingURL=chunk-7G4U7I4C.js.map
13
+ //# sourceMappingURL=chunk-D22N6ARA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sourcemap/load-source-map.ts","../src/sourcemap/sourcemap.ts"],"names":["readFileSync","AnyMap","dirname","resolve","INLINE_SOURCEMAP_REGEX","SOURCEMAP_REGEX","isInlineMap","url","resolveSourceMapUrl","sourceFile","sourcePath","lines","sourceMapUrl","index","decodeInlineMap","data","rawData","loadSourceMap","filename","sourceMapContent","error","traceMapContent","load_source_map_default","generatedPositionFor","originalPositionFor","sourceContentFor","traceSegment"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,UAG7B,OAAS,UAAAC,MAAc,4BACvB,OAAS,WAAAC,EAAS,WAAAC,MAAe,iBAEjC,IAAMC,EAAyB,sCAEzBC,EAAkB,4GAElBC,EAAeC,GAAyBH,EAAuB,KAAKG,CAAG,EAEvEC,EAAsB,CAACC,EAAoBC,IAA2C,CACxF,IAAMC,EAAQF,EAAW,MAAM,OAAO,EAElCG,EAAe,KAGnB,QAASC,EAAQ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ace-mapping\";\nimport { dirname, resolve } from \"@visulima/path\";\n\nconst INLINE_SOURCEMAP_REGEX = /^data:application\\/json[^,]+base64,/;\n// eslint-disable-next-line regexp/no-unused-capturing-group,regexp/no-super-linear-backtracking\nconst SOURCEMAP_REGEX = /\\/\\/[@#][ \\t]+sourceMappingURL=([^\\s'\"]+)[ \\t]*$|\\/\\*[@#][ \\t]+sourceMappingURL=([^*]+?)[ \\t]*\\*\\/[ \\t]*$/;\n\nconst isInlineMap = (url: string): boolean => INLINE_SOURCEMAP_REGEX.test(url);\n\nconst resolveSourceMapUrl = (sourceFile: string, sourcePath: string): string | undefined => {\n const lines = sourceFile.split(/\\r?\\n/);\n\n let sourceMapUrl = null;\n\n // eslint-disable-next-line no-loops/no-loops,no-plusplus\n for (let index = lines.length - 1; index >= 0 && !sourceMapUrl; index--) {\n // eslint-disable-next-line security/detect-object-injection\n sourceMapUrl = SOURCEMAP_REGEX.exec(lines[index] as string);\n }\n\n if (!sourceMapUrl) {\n return undefined;\n }\n\n return isInlineMap(sourceMapUrl[1] as string) ? (sourceMapUrl[1] as string) : (resolve(sourcePath, sourceMapUrl[1] as string) as string);\n};\n\nconst decodeInlineMap = (data: string) => {\n const rawData = data.slice(data.indexOf(\",\") + 1);\n\n return Buffer.from(rawData, \"base64\").toString();\n};\n\nconst loadSourceMap = (filename: string): TraceMap | undefined => {\n let sourceMapContent: string | undefined;\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n sourceMapContent = readFileSync(filename, { encoding: \"utf8\" });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n error.message = `Error reading sourcemap for file \"${filename}\":\\n${error.message}`;\n\n throw error;\n }\n\n const sourceMapUrl = resolveSourceMapUrl(sourceMapContent, dirname(filename));\n\n if (!sourceMapUrl) {\n return undefined;\n }\n\n let traceMapContent: string | undefined;\n\n // If it's an inline map, decode it and pass it through the same consumer factory\n if (isInlineMap(sourceMapUrl)) {\n traceMapContent = decodeInlineMap(sourceMapUrl);\n } else {\n try {\n // Load actual source map from given path\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n traceMapContent = readFileSync(sourceMapUrl, { encoding: \"utf8\" });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n error.message = `Error reading sourcemap for file \"${filename}\":\\n${error.message}`;\n\n throw error;\n }\n }\n\n try {\n return new AnyMap(traceMapContent, sourceMapUrl);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n error.message = `Error parsing sourcemap for file \"${filename}\":\\n${error.message}`;\n\n throw error;\n }\n};\n\nexport default loadSourceMap;\n","export { default as loadSourceMap } from \"./load-source-map\";\nexport type { TraceMap } from \"@jridgewell/trace-mapping\";\nexport { generatedPositionFor, originalPositionFor, sourceContentFor, traceSegment } from \"@jridgewell/trace-mapping\";\n"]}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { a as CODE_FRAME_POINTER, b as codeFrame } from './chunk-BKLPSU5H.js';
2
2
  export { c as VisulimaError, a as getErrorCauses, b as isVisulimaError } from './chunk-HAVTTG7L.js';
3
- export { b as generatedPositionFor, a as loadSourceMap, c as originalPositionFor, d as sourceContentFor, e as traceSegment } from './chunk-7G4U7I4C.js';
3
+ export { b as generatedPositionFor, a as loadSourceMap, c as originalPositionFor, d as sourceContentFor, e as traceSegment } from './chunk-D22N6ARA.js';
4
4
  export { a as parseStacktrace } from './chunk-ZMWUTAJM.js';
5
5
 
6
6
  var m=(r,e)=>{let o=0,t=e.length-2;for(;o<t;){let n=o+(t-o>>1);if(r<e[n])t=n-1;else if(r>=e[n+1])o=n+1;else {o=n;break}}return o},E=r=>r.split(/\n|\r(?!\n)/).reduce((e,o)=>(e.push(e.at(-1)+o.length+1),e),[0]),x=(r,e,o)=>{let t=o?.skipChecks??!1;if(!t&&(!Array.isArray(r)&&typeof r!="string"||(typeof r=="string"||Array.isArray(r))&&r.length===0))return {column:0,line:0};if(!t&&(typeof e!="number"||typeof r=="string"&&e>=r.length||Array.isArray(r)&&e+1>=r.at(-1)))return {column:0,line:0};if(typeof r=="string"){let s=E(r),a=m(e,s);return {column:e-s[a]+1,line:a+1}}let n=m(e,r);return {column:e-r[n]+1,line:n+1}},F=x;
@@ -1,3 +1,3 @@
1
- export { b as generatedPositionFor, a as loadSourceMap, c as originalPositionFor, d as sourceContentFor, e as traceSegment } from '../chunk-7G4U7I4C.js';
1
+ export { b as generatedPositionFor, a as loadSourceMap, c as originalPositionFor, d as sourceContentFor, e as traceSegment } from '../chunk-D22N6ARA.js';
2
2
  //# sourceMappingURL=out.js.map
3
3
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,177 +1,178 @@
1
1
  {
2
- "name": "@visulima/error",
3
- "version": "3.2.8",
4
- "description": "Error with more than just a message, stacktrace parsing and sourcemap loading.",
5
- "keywords": [
6
- "anolilab",
7
- "character",
8
- "code-frame",
9
- "codeframe",
10
- "column number",
11
- "column",
12
- "coordinate",
13
- "error",
14
- "exception",
15
- "index",
16
- "line number",
17
- "line",
18
- "location",
19
- "parser",
20
- "position",
21
- "source-map",
22
- "stack",
23
- "stack-trace",
24
- "stacktrace",
25
- "string",
26
- "text",
27
- "trace",
28
- "v8",
29
- "visulima"
30
- ],
31
- "homepage": "https://www.visulima.com/docs/package/error",
32
- "repository": {
33
- "type": "git",
34
- "url": "https://github.com/visulima/visulima.git",
35
- "directory": "packages/error"
2
+ "name": "@visulima/error",
3
+ "version": "3.2.10",
4
+ "description": "Error with more than just a message, stacktrace parsing and sourcemap loading.",
5
+ "keywords": [
6
+ "anolilab",
7
+ "character",
8
+ "code-frame",
9
+ "codeframe",
10
+ "column number",
11
+ "column",
12
+ "coordinate",
13
+ "error",
14
+ "exception",
15
+ "index",
16
+ "line number",
17
+ "line",
18
+ "location",
19
+ "parser",
20
+ "position",
21
+ "source-map",
22
+ "stack",
23
+ "stack-trace",
24
+ "stacktrace",
25
+ "string",
26
+ "text",
27
+ "trace",
28
+ "v8",
29
+ "visulima"
30
+ ],
31
+ "homepage": "https://www.visulima.com/docs/package/error",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/visulima/visulima.git",
35
+ "directory": "packages/error"
36
+ },
37
+ "funding": [
38
+ {
39
+ "type": "github",
40
+ "url": "https://github.com/sponsors/prisis"
36
41
  },
37
- "funding": [
38
- {
39
- "type": "github",
40
- "url": "https://github.com/sponsors/prisis"
41
- },
42
- {
43
- "type": "consulting",
44
- "url": "https://anolilab.com/support"
45
- }
46
- ],
47
- "license": "MIT",
48
- "author": {
49
- "name": "Daniel Bannert",
50
- "email": "d.bannert@anolilab.de"
42
+ {
43
+ "type": "consulting",
44
+ "url": "https://anolilab.com/support"
45
+ }
46
+ ],
47
+ "license": "MIT",
48
+ "author": {
49
+ "name": "Daniel Bannert",
50
+ "email": "d.bannert@anolilab.de"
51
+ },
52
+ "sideEffects": false,
53
+ "type": "module",
54
+ "exports": {
55
+ ".": {
56
+ "import": {
57
+ "types": "./dist/index.d.ts",
58
+ "default": "./dist/index.js"
59
+ }
51
60
  },
52
- "sideEffects": false,
53
- "type": "module",
54
- "exports": {
55
- ".": {
56
- "import": {
57
- "types": "./dist/index.d.ts",
58
- "default": "./dist/index.js"
59
- }
60
- },
61
- "./code-frame": {
62
- "import": {
63
- "types": "./dist/code-frame/index.d.ts",
64
- "default": "./dist/code-frame/index.js"
65
- }
66
- },
67
- "./error": {
68
- "import": {
69
- "types": "./dist/error/index.d.ts",
70
- "default": "./dist/error/index.js"
71
- }
72
- },
73
- "./sourcemap": {
74
- "import": {
75
- "types": "./dist/sourcemap/index.d.ts",
76
- "default": "./dist/sourcemap/index.js"
77
- }
78
- },
79
- "./stacktrace": {
80
- "import": {
81
- "types": "./dist/stacktrace/index.d.ts",
82
- "default": "./dist/stacktrace/index.js"
83
- }
84
- },
85
- "./package.json": "./package.json"
61
+ "./code-frame": {
62
+ "import": {
63
+ "types": "./dist/code-frame/index.d.ts",
64
+ "default": "./dist/code-frame/index.js"
65
+ }
86
66
  },
87
- "types": "dist/index.d.ts",
88
- "files": [
89
- "dist",
90
- "README.md",
91
- "CHANGELOG.md",
92
- "LICENSE.md"
93
- ],
94
- "scripts": {
95
- "build": "cross-env NODE_ENV=development tsup",
96
- "build:prod": "cross-env NODE_ENV=production tsup",
97
- "clean": "rimraf node_modules dist .eslintcache",
98
- "dev": "pnpm run build --watch",
99
- "lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
100
- "lint:eslint:fix": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs --fix",
101
- "lint:packagejson": "publint --strict",
102
- "lint:prettier": "prettier --config=.prettierrc.cjs --check .",
103
- "lint:prettier:fix": "prettier --config=.prettierrc.cjs --write .",
104
- "lint:types": "tsc --noEmit --project tsconfig.json",
105
- "test": "vitest run",
106
- "test:coverage": "vitest run --coverage",
107
- "test:ui": "vitest --ui --coverage.enabled=true",
108
- "test:watch": "vitest"
67
+ "./error": {
68
+ "import": {
69
+ "types": "./dist/error/index.d.ts",
70
+ "default": "./dist/error/index.js"
71
+ }
109
72
  },
110
- "dependencies": {
111
- "@jridgewell/trace-mapping": "^0.3.25"
73
+ "./sourcemap": {
74
+ "import": {
75
+ "types": "./dist/sourcemap/index.d.ts",
76
+ "default": "./dist/sourcemap/index.js"
77
+ }
112
78
  },
113
- "devDependencies": {
114
- "@anolilab/eslint-config": "^15.0.3",
115
- "@anolilab/prettier-config": "^5.0.14",
116
- "@anolilab/semantic-release-preset": "^8.0.3",
117
- "@babel/core": "^7.24.5",
118
- "@eslint-types/deprecation": "^2.0.0",
119
- "@eslint-types/import": "^2.29.1",
120
- "@eslint-types/jsdoc": "^48.2.2",
121
- "@eslint-types/typescript-eslint": "^7.5.0",
122
- "@eslint-types/unicorn": "^52.0.0",
123
- "@rushstack/eslint-plugin-security": "^0.8.1",
124
- "@total-typescript/ts-reset": "^0.5.1",
125
- "@types/command-line-args": "^5.2.3",
126
- "@types/node": "18.18.14",
127
- "@visulima/nextra-theme-docs": "4.0.24",
128
- "@vitest/coverage-v8": "^1.6.0",
129
- "@vitest/ui": "^1.6.0",
130
- "cross-env": "^7.0.3",
131
- "eslint": "^8.57.0",
132
- "eslint-plugin-deprecation": "^2.0.0",
133
- "eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
134
- "eslint-plugin-mdx": "^3.1.5",
135
- "eslint-plugin-vitest": "^0.4.1",
136
- "eslint-plugin-vitest-globals": "^1.5.0",
137
- "prettier": "^3.2.5",
138
- "rimraf": "^5.0.7",
139
- "semantic-release": "^23.1.1",
140
- "sort-package-json": "^2.10.0",
141
- "tsup": "^8.0.2",
142
- "typescript": "^5.4.5",
143
- "vitest": "^1.6.0"
79
+ "./stacktrace": {
80
+ "import": {
81
+ "types": "./dist/stacktrace/index.d.ts",
82
+ "default": "./dist/stacktrace/index.js"
83
+ }
144
84
  },
145
- "engines": {
146
- "node": ">=18.* <=21.*"
147
- },
148
- "os": [
149
- "darwin",
150
- "linux",
151
- "win32"
152
- ],
153
- "publishConfig": {
154
- "access": "public",
155
- "provenance": true
156
- },
157
- "anolilab": {
158
- "eslint-config": {
159
- "plugin": {
160
- "tsdoc": false,
161
- "etc": false
162
- },
163
- "warn_on_unsupported_typescript_version": false,
164
- "info_on_disabling_jsx_react_rule": false,
165
- "info_on_disabling_prettier_conflict_rule": false,
166
- "info_on_disabling_jsonc_sort_keys_rule": false,
167
- "info_on_disabling_etc_no_deprecated": false
168
- }
169
- },
170
- "sources": [
171
- "src/index.ts",
172
- "src/code-frame/index.ts",
173
- "src/error/index.ts",
174
- "src/sourcemap/index.ts",
175
- "src/stacktrace/index.ts"
176
- ]
177
- }
85
+ "./package.json": "./package.json"
86
+ },
87
+ "types": "dist/index.d.ts",
88
+ "files": [
89
+ "dist",
90
+ "README.md",
91
+ "CHANGELOG.md",
92
+ "LICENSE.md"
93
+ ],
94
+ "dependencies": {
95
+ "@jridgewell/trace-mapping": "^0.3.25",
96
+ "@visulima/path": "1.0.1"
97
+ },
98
+ "devDependencies": {
99
+ "@anolilab/eslint-config": "^15.0.3",
100
+ "@anolilab/prettier-config": "^5.0.14",
101
+ "@anolilab/semantic-release-pnpm": "^1.1.0",
102
+ "@anolilab/semantic-release-preset": "^8.1.0",
103
+ "@babel/core": "^7.24.6",
104
+ "@eslint-types/deprecation": "^2.0.0",
105
+ "@eslint-types/import": "^2.29.1",
106
+ "@eslint-types/jsdoc": "^48.2.2",
107
+ "@eslint-types/typescript-eslint": "^7.5.0",
108
+ "@eslint-types/unicorn": "^52.0.0",
109
+ "@rushstack/eslint-plugin-security": "^0.8.1",
110
+ "@total-typescript/ts-reset": "^0.5.1",
111
+ "@types/command-line-args": "^5.2.3",
112
+ "@types/node": "18.18.14",
113
+ "@visulima/nextra-theme-docs": "4.0.25",
114
+ "@vitest/coverage-v8": "^1.6.0",
115
+ "@vitest/ui": "^1.6.0",
116
+ "cross-env": "^7.0.3",
117
+ "eslint": "^8.57.0",
118
+ "eslint-plugin-deprecation": "^3.0.0",
119
+ "eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
120
+ "eslint-plugin-mdx": "^3.1.5",
121
+ "eslint-plugin-vitest": "^0.4.1",
122
+ "eslint-plugin-vitest-globals": "^1.5.0",
123
+ "prettier": "^3.3.0",
124
+ "rimraf": "^5.0.7",
125
+ "semantic-release": "23.1.1",
126
+ "tsup": "^8.1.0",
127
+ "typescript": "^5.4.5",
128
+ "vitest": "^1.6.0"
129
+ },
130
+ "engines": {
131
+ "node": ">=18.* <=21.*"
132
+ },
133
+ "os": [
134
+ "darwin",
135
+ "linux",
136
+ "win32"
137
+ ],
138
+ "publishConfig": {
139
+ "access": "public",
140
+ "provenance": true
141
+ },
142
+ "anolilab": {
143
+ "eslint-config": {
144
+ "plugin": {
145
+ "tsdoc": false,
146
+ "etc": false
147
+ },
148
+ "warn_on_unsupported_typescript_version": false,
149
+ "info_on_disabling_jsx_react_rule": false,
150
+ "info_on_disabling_prettier_conflict_rule": false,
151
+ "info_on_disabling_jsonc_sort_keys_rule": false,
152
+ "info_on_disabling_etc_no_deprecated": false
153
+ }
154
+ },
155
+ "sources": [
156
+ "src/index.ts",
157
+ "src/code-frame/index.ts",
158
+ "src/error/index.ts",
159
+ "src/sourcemap/index.ts",
160
+ "src/stacktrace/index.ts"
161
+ ],
162
+ "scripts": {
163
+ "build": "cross-env NODE_ENV=development tsup",
164
+ "build:prod": "cross-env NODE_ENV=production tsup",
165
+ "clean": "rimraf node_modules dist .eslintcache",
166
+ "dev": "pnpm run build --watch",
167
+ "lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
168
+ "lint:eslint:fix": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs --fix",
169
+ "lint:package-json": "publint --strict",
170
+ "lint:prettier": "prettier --config=.prettierrc.cjs --check .",
171
+ "lint:prettier:fix": "prettier --config=.prettierrc.cjs --write .",
172
+ "lint:types": "tsc --noEmit --project tsconfig.json",
173
+ "test": "vitest run",
174
+ "test:coverage": "vitest run --coverage",
175
+ "test:ui": "vitest --ui --coverage.enabled=true",
176
+ "test:watch": "vitest"
177
+ }
178
+ }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/sourcemap/load-source-map.ts","../src/sourcemap/sourcemap.ts"],"names":["readFileSync","dirname","resolve","AnyMap","INLINE_SOURCEMAP_REGEX","SOURCEMAP_REGEX","isInlineMap","url","resolveSourceMapUrl","sourceFile","sourcePath","lines","sourceMapUrl","index","decodeInlineMap","data","rawData","loadSourceMap","filename","sourceMapContent","error","traceMapContent","load_source_map_default","generatedPositionFor","originalPositionFor","sourceContentFor","traceSegment"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,UAC7B,OAAS,WAAAC,EAAS,WAAAC,MAAe,YAG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EAAM,OAAO,GAE3EA,CACV,CACJ,EAEOE,EAAQL,ECjFf,OAAS,wBAAAM,EAAsB,uBAAAC,EAAqB,oBAAAC,EAAkB,gBAAAC,MAAoB","sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\n\nimport type { TraceMap } from \"@jridgewell/trace-mapping\";\nimport { AnyMap } from \"@jridgewell/trace-mapping\";\n\nconst INLINE_SOURCEMAP_REGEX = /^data:application\\/json[^,]+base64,/;\n// eslint-disable-next-line regexp/no-unused-capturing-group,regexp/no-super-linear-backtracking\nconst SOURCEMAP_REGEX = /\\/\\/[@#][ \\t]+sourceMappingURL=([^\\s'\"]+)[ \\t]*$|\\/\\*[@#][ \\t]+sourceMappingURL=([^*]+?)[ \\t]*\\*\\/[ \\t]*$/;\n\nconst isInlineMap = (url: string): boolean => INLINE_SOURCEMAP_REGEX.test(url);\n\nconst resolveSourceMapUrl = (sourceFile: string, sourcePath: string): string | undefined => {\n const lines = sourceFile.split(/\\r?\\n/);\n\n let sourceMapUrl = null;\n\n // eslint-disable-next-line no-loops/no-loops,no-plusplus\n for (let index = lines.length - 1; index >= 0 && !sourceMapUrl; index--) {\n // eslint-disable-next-line security/detect-object-injection\n sourceMapUrl = SOURCEMAP_REGEX.exec(lines[index] as string);\n }\n\n if (!sourceMapUrl) {\n return undefined;\n }\n\n return isInlineMap(sourceMapUrl[1] as string) ? (sourceMapUrl[1] as string) : (resolve(sourcePath, sourceMapUrl[1] as string) as string);\n};\n\nconst decodeInlineMap = (data: string) => {\n const rawData = data.slice(data.indexOf(\",\") + 1);\n\n return Buffer.from(rawData, \"base64\").toString();\n};\n\nconst loadSourceMap = (filename: string): TraceMap | undefined => {\n let sourceMapContent: string | undefined;\n\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n sourceMapContent = readFileSync(filename, { encoding: \"utf8\" });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n error.message = `Error reading sourcemap for file \"${filename}\":\\n${error.message}`;\n\n throw error;\n }\n\n const sourceMapUrl = resolveSourceMapUrl(sourceMapContent, dirname(filename));\n\n if (!sourceMapUrl) {\n return undefined;\n }\n\n let traceMapContent: string | undefined;\n\n // If it's an inline map, decode it and pass it through the same consumer factory\n if (isInlineMap(sourceMapUrl)) {\n traceMapContent = decodeInlineMap(sourceMapUrl);\n } else {\n try {\n // Load actual source map from given path\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n traceMapContent = readFileSync(sourceMapUrl, { encoding: \"utf8\" });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n error.message = `Error reading sourcemap for file \"${filename}\":\\n${error.message}`;\n\n throw error;\n }\n }\n\n try {\n return new AnyMap(traceMapContent, sourceMapUrl);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n error.message = `Error parsing sourcemap for file \"${filename}\":\\n${error.message}`;\n\n throw error;\n }\n};\n\nexport default loadSourceMap;\n","export { default as loadSourceMap } from \"./load-source-map\";\nexport type { TraceMap } from \"@jridgewell/trace-mapping\";\nexport { generatedPositionFor, originalPositionFor, sourceContentFor, traceSegment } from \"@jridgewell/trace-mapping\";\n"]}