@tsrx/content-mapper 0.1.1 → 0.1.2
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.md +83 -51
- package/dist/{mapper-DATqGboo.js → mapper-B4f--1ac.js} +309 -41
- package/dist/mapper-B4f--1ac.js.map +1 -0
- package/dist/mapper.js +2 -2
- package/dist/protocol.js +22 -12
- package/dist/protocol.js.map +1 -1
- package/dist/rpc.js +11 -2
- package/dist/rpc.js.map +1 -1
- package/dist/server.js +1 -1
- package/package.json +7 -7
- package/src/diagnostic-directives.js +199 -0
- package/src/export-stub.js +94 -7
- package/src/mapper.js +43 -40
- package/src/protocol.js +23 -13
- package/src/rpc.js +11 -2
- package/dist/mapper-DATqGboo.js.map +0 -1
package/dist/mapper.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as validate_options, n as require, r as to_diagnostic, t as create_tsrx_content_mapper } from "./mapper-B4f--1ac.js";
|
|
2
2
|
|
|
3
|
-
export { create_tsrx_content_mapper,
|
|
3
|
+
export { create_tsrx_content_mapper, require, to_diagnostic, validate_options };
|
package/dist/protocol.js
CHANGED
|
@@ -37,21 +37,15 @@ const SpanMapFeature = {
|
|
|
37
37
|
None: 0,
|
|
38
38
|
All: (1 << 20) - 1
|
|
39
39
|
};
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Diagnostic-directive policies: `Ignore` hides TypeScript's errors in a
|
|
42
|
+
* generated range; `Expect` also reports a diagnostic of the mapper's when
|
|
43
|
+
* there are none there.
|
|
44
|
+
*/
|
|
41
45
|
const DiagnosticDirectivePolicy = {
|
|
42
46
|
Ignore: 0,
|
|
43
47
|
Expect: 1
|
|
44
48
|
};
|
|
45
|
-
/** Prefix for mapper-authored diagnostics: `error tsrx(1000): ...`. */
|
|
46
|
-
const DIAGNOSTIC_SOURCE = "tsrx";
|
|
47
|
-
/** Numeric code for a fatal compile error (the file could not be transformed). */
|
|
48
|
-
const DIAGNOSTIC_CODE_COMPILE_ERROR = 1e3;
|
|
49
|
-
/** Numeric code for a usage error that carries no string code. */
|
|
50
|
-
const DIAGNOSTIC_CODE_USAGE_ERROR = 1001;
|
|
51
|
-
/** Numeric code when no TSRX compiler can be resolved for a file. */
|
|
52
|
-
const DIAGNOSTIC_CODE_NO_COMPILER = 1002;
|
|
53
|
-
/** Numeric code when the project's TSRX configuration is invalid. */
|
|
54
|
-
const DIAGNOSTIC_CODE_INVALID_CONFIG = 1003;
|
|
55
49
|
/**
|
|
56
50
|
* @typedef {[
|
|
57
51
|
* generatedStart: number,
|
|
@@ -76,8 +70,24 @@ const DIAGNOSTIC_CODE_INVALID_CONFIG = 1003;
|
|
|
76
70
|
* @property {SpanMapping[]} mappings
|
|
77
71
|
*/
|
|
78
72
|
/**
|
|
73
|
+
* @typedef {[
|
|
74
|
+
* originalStart: number,
|
|
75
|
+
* originalLength: number,
|
|
76
|
+
* generatedStart: number,
|
|
77
|
+
* generatedEnd: number,
|
|
78
|
+
* policy: 0 | 1,
|
|
79
|
+
* unusedExpectDirectiveIndex?: number,
|
|
80
|
+
* ]} DiagnosticDirective
|
|
81
|
+
*/
|
|
82
|
+
/**
|
|
83
|
+
* @typedef {object} DiagnosticDirectives
|
|
84
|
+
* @property {Array<{ code: number, messageText: string }>} unusedExpectDirectiveDiagnostics What an `Expect` directive reports when TypeScript has no error in its range.
|
|
85
|
+
* @property {DiagnosticDirective[]} directives
|
|
86
|
+
*/
|
|
87
|
+
/**
|
|
79
88
|
* @typedef {MappedOutput & {
|
|
80
89
|
* diagnostics?: MapperDiagnostic[],
|
|
90
|
+
* diagnosticDirectives?: DiagnosticDirectives,
|
|
81
91
|
* supplemental?: MappedOutput[],
|
|
82
92
|
* }} TransformResult
|
|
83
93
|
*/
|
|
@@ -112,5 +122,5 @@ const DIAGNOSTIC_CODE_INVALID_CONFIG = 1003;
|
|
|
112
122
|
*/
|
|
113
123
|
|
|
114
124
|
//#endregion
|
|
115
|
-
export {
|
|
125
|
+
export { DiagnosticDirectivePolicy, SpanMapFeature, SpanMapKind };
|
|
116
126
|
//# sourceMappingURL=protocol.js.map
|
package/dist/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","names":[],"sources":["../src/protocol.js"],"sourcesContent":["/**\n * Constants of the TypeScript 7 content-mapper protocol, kept in sync with\n * `tsc/internal/contentmapper` and `tsc/internal/spanmap` in microsoft/TypeScript.\n */\n\n/** Span kinds. */\nexport const SpanMapKind = /** @type {const} */ ({\n\t/** Same length and identical text; the only kind that supports text edits. */\n\tVerbatim: 0,\n\t/** Same entity, different text or length. */\n\tAtom: 1,\n\t/** Different text; diagnostics covering the whole span exactly show the original text. */\n\tAlias: 2,\n});\n\n/** Feature bits a span opts into. Diagnostics ignore them. */\nexport const SpanMapFeature = /** @type {const} */ ({\n\tHover: 1 << 0,\n\tSignatureHelp: 1 << 1,\n\tCompletion: 1 << 2,\n\tDefinition: 1 << 3,\n\tTypeDefinition: 1 << 4,\n\tImplementation: 1 << 5,\n\tReferences: 1 << 6,\n\tDocumentHighlights: 1 << 7,\n\tRename: 1 << 8,\n\tCallHierarchy: 1 << 9,\n\tCodeActions: 1 << 10,\n\tFormatting: 1 << 11,\n\tInlayHints: 1 << 12,\n\tSemanticTokens: 1 << 13,\n\tFoldingRanges: 1 << 14,\n\tSelectionRanges: 1 << 15,\n\tLinkedEditing: 1 << 16,\n\tAutoInsert: 1 << 17,\n\tDocumentSymbols: 1 << 18,\n\tCodeLens: 1 << 19,\n\tNone: 0,\n\tAll: (1 << 20) - 1,\n});\n\n
|
|
1
|
+
{"version":3,"file":"protocol.js","names":[],"sources":["../src/protocol.js"],"sourcesContent":["/**\n * Constants of the TypeScript 7 content-mapper protocol, kept in sync with\n * `tsc/internal/contentmapper` and `tsc/internal/spanmap` in microsoft/TypeScript.\n */\n\n/** Span kinds. */\nexport const SpanMapKind = /** @type {const} */ ({\n\t/** Same length and identical text; the only kind that supports text edits. */\n\tVerbatim: 0,\n\t/** Same entity, different text or length. */\n\tAtom: 1,\n\t/** Different text; diagnostics covering the whole span exactly show the original text. */\n\tAlias: 2,\n});\n\n/** Feature bits a span opts into. Diagnostics ignore them. */\nexport const SpanMapFeature = /** @type {const} */ ({\n\tHover: 1 << 0,\n\tSignatureHelp: 1 << 1,\n\tCompletion: 1 << 2,\n\tDefinition: 1 << 3,\n\tTypeDefinition: 1 << 4,\n\tImplementation: 1 << 5,\n\tReferences: 1 << 6,\n\tDocumentHighlights: 1 << 7,\n\tRename: 1 << 8,\n\tCallHierarchy: 1 << 9,\n\tCodeActions: 1 << 10,\n\tFormatting: 1 << 11,\n\tInlayHints: 1 << 12,\n\tSemanticTokens: 1 << 13,\n\tFoldingRanges: 1 << 14,\n\tSelectionRanges: 1 << 15,\n\tLinkedEditing: 1 << 16,\n\tAutoInsert: 1 << 17,\n\tDocumentSymbols: 1 << 18,\n\tCodeLens: 1 << 19,\n\tNone: 0,\n\tAll: (1 << 20) - 1,\n});\n\n/**\n * Diagnostic-directive policies: `Ignore` hides TypeScript's errors in a\n * generated range; `Expect` also reports a diagnostic of the mapper's when\n * there are none there.\n */\nexport const DiagnosticDirectivePolicy = /** @type {const} */ ({ Ignore: 0, Expect: 1 });\n\n/**\n * @typedef {[\n * \tgeneratedStart: number,\n * \tgeneratedLength: number,\n * \toriginalStart: number,\n * \toriginalLength: number,\n * \tkind: 0 | 1 | 2,\n * \tfeatures: number,\n * ]} SpanMapping\n */\n\n/**\n * @typedef {object} MapperDiagnostic\n * @property {number} start Offset into the original text (UTF-16 code units).\n * @property {number} length\n * @property {number} code\n * @property {string} messageText\n */\n\n/**\n * @typedef {object} MappedOutput\n * @property {string} text\n * @property {'.js' | '.jsx' | '.mjs' | '.cjs' | '.ts' | '.tsx' | '.mts' | '.cts' | '.json'} extension\n * @property {SpanMapping[]} mappings\n */\n\n/**\n * @typedef {[\n * \toriginalStart: number,\n * \toriginalLength: number,\n * \tgeneratedStart: number,\n * \tgeneratedEnd: number,\n * \tpolicy: 0 | 1,\n * \tunusedExpectDirectiveIndex?: number,\n * ]} DiagnosticDirective\n */\n\n/**\n * @typedef {object} DiagnosticDirectives\n * @property {Array<{ code: number, messageText: string }>} unusedExpectDirectiveDiagnostics What an `Expect` directive reports when TypeScript has no error in its range.\n * @property {DiagnosticDirective[]} directives\n */\n\n/**\n * @typedef {MappedOutput & {\n * \tdiagnostics?: MapperDiagnostic[],\n * \tdiagnosticDirectives?: DiagnosticDirectives,\n * \tsupplemental?: MappedOutput[],\n * }} TransformResult\n */\n\n/**\n * @typedef {object} InitializeParams\n * @property {string} [locale]\n * @property {Array<'utf-8' | 'utf-16'>} positionEncodings\n */\n\n/**\n * @typedef {object} InitializeResult\n * @property {'utf-8' | 'utf-16'} positionEncoding\n * @property {string} diagnosticSource\n */\n\n/**\n * @typedef {object} OpenProjectParams\n * @property {string} configFileName Empty for inferred projects.\n * @property {string} projectHandle\n * @property {Record<string, unknown>} [options] The mapper entry's `options` object.\n * @property {Record<string, unknown>} compilerOptions Effective compiler options (wire format).\n */\n\n/**\n * @typedef {object} OpenProjectResult\n * @property {string} configIdentity\n * @property {string[]} [watchedFiles]\n * @property {Array<{ path: Array<string | number>, messageText: string, code: number }>} [optionDiagnostics]\n */\n\n/**\n * @typedef {object} TransformParams\n * @property {string} fileName\n * @property {string} content\n * @property {string} [projectHandle]\n */\n"],"mappings":";;;;;;AAMA,MAAa,cAAoC;;CAEhD,UAAU;;CAEV,MAAM;;CAEN,OAAO;AACR;;AAGA,MAAa,iBAAuC;CACnD,OAAO;CACP,eAAe;CACf,YAAY;CACZ,YAAY;CACZ,gBAAgB;CAChB,gBAAgB;CAChB,YAAY;CACZ,oBAAoB;CACpB,QAAQ;CACR,eAAe;CACf,aAAa;CACb,YAAY;CACZ,YAAY;CACZ,gBAAgB;CAChB,eAAe;CACf,iBAAiB;CACjB,eAAe;CACf,YAAY,KAAK;CACjB,iBAAiB,KAAK;CACtB,UAAU,KAAK;CACf,MAAM;CACN,MAAM,KAAK,MAAM;AAClB;;;;;;AAOA,MAAa,4BAAkD;CAAE,QAAQ;CAAG,QAAQ;AAAE"}
|
package/dist/rpc.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Console } from "node:console";
|
|
2
|
+
|
|
1
3
|
//#region src/rpc.js
|
|
2
4
|
/**
|
|
3
5
|
* Content-mapper transport: `Content-Length`-framed JSON-RPC 2.0 over stdio.
|
|
@@ -117,10 +119,17 @@ function run_mapper_server(mapper, streams = {}) {
|
|
|
117
119
|
}
|
|
118
120
|
/**
|
|
119
121
|
* Route every console method to stderr so stray logging (from a target
|
|
120
|
-
* compiler, for example) can never corrupt the protocol stream on stdout
|
|
122
|
+
* compiler, for example) can never corrupt the protocol stream on stdout: not
|
|
123
|
+
* only `log` but `dir`, `table`, `trace`, `group` and the rest write there, so
|
|
124
|
+
* each takes the method of a console whose stdout is stderr.
|
|
121
125
|
*/
|
|
122
126
|
function redirect_console_to_stderr() {
|
|
123
|
-
|
|
127
|
+
const to_stderr = new Console({
|
|
128
|
+
stdout: process.stderr,
|
|
129
|
+
stderr: process.stderr
|
|
130
|
+
});
|
|
131
|
+
for (const [name, method] of Object.entries(to_stderr)) if (typeof method === "function")
|
|
132
|
+
/** @type {Record<string, unknown>} */ console[name] = method;
|
|
124
133
|
}
|
|
125
134
|
|
|
126
135
|
//#endregion
|
package/dist/rpc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.js","names":[],"sources":["../src/rpc.js"],"sourcesContent":["/**\n * Content-mapper transport: `Content-Length`-framed JSON-RPC 2.0 over stdio.\n * TypeScript is the only requester; the mapper never sends requests or\n * notifications. stdout is reserved for protocol messages, so everything\n * else (including `console.log`) goes to stderr.\n *\n * Kept separate from the executable entry (`server.js`) so hosts that bundle\n * the mapper (the VS Code extension ships it for inferred projects) can start\n * it from their own entry file.\n */\n\n/**\n * @typedef {{ jsonrpc: '2.0', id?: number | string | null, method: string, params?: unknown }} RequestMessage\n */\n\n/**\n * Run the mapper server on the given streams. Installs the stream handlers\n * and returns; the process exits (with `process.exitCode`) once the input\n * stream ends, which is how TypeScript shuts a mapper down.\n * @param {import('./mapper.js').ContentMapper} mapper\n * @param {{ input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream }} [streams]\n */\nexport function run_mapper_server(mapper, streams = {}) {\n\tconst input = streams.input ?? process.stdin;\n\tconst output = streams.output ?? process.stdout;\n\tlet buffered = Buffer.alloc(0);\n\n\tinput.on('data', (chunk) => {\n\t\tbuffered = Buffer.concat([buffered, typeof chunk === 'string' ? Buffer.from(chunk) : chunk]);\n\t\tread_messages();\n\t});\n\tinput.on('error', (error) => {\n\t\tconsole.error(error);\n\t\tprocess.exitCode = 1;\n\t});\n\tinput.on('end', () => {\n\t\tprocess.exit(process.exitCode ?? 0);\n\t});\n\n\tfunction read_messages() {\n\t\twhile (true) {\n\t\t\tconst header_end = buffered.indexOf('\\r\\n\\r\\n');\n\t\t\tif (header_end < 0) return;\n\t\t\tconst header = buffered.subarray(0, header_end).toString('ascii');\n\t\t\tconst length_match = /^Content-Length:\\s*(\\d+)\\s*$/im.exec(header);\n\t\t\tif (!length_match) {\n\t\t\t\tconsole.error('@tsrx/content-mapper: missing Content-Length header');\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tconst content_length = Number(length_match[1]);\n\t\t\tconst message_start = header_end + 4;\n\t\t\tconst message_end = message_start + content_length;\n\t\t\tif (buffered.length < message_end) return;\n\t\t\tconst body = buffered.subarray(message_start, message_end).toString('utf8');\n\t\t\tbuffered = buffered.subarray(message_end);\n\t\t\t/** @type {RequestMessage} */\n\t\t\tlet message;\n\t\t\ttry {\n\t\t\t\tmessage = JSON.parse(body);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('@tsrx/content-mapper: invalid JSON-RPC message', error);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\thandle_message(message);\n\t\t}\n\t}\n\n\t/** @param {RequestMessage} message */\n\tfunction handle_message(message) {\n\t\tif (message.id === undefined || message.id === null) {\n\t\t\t// Notifications need no response.\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\t/** @type {unknown} */\n\t\t\tlet result;\n\t\t\tswitch (message.method) {\n\t\t\t\tcase 'initialize':\n\t\t\t\t\tresult = mapper.initialize(/** @type {any} */ (message.params));\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'openProject':\n\t\t\t\t\tresult = mapper.openProject(/** @type {any} */ (message.params));\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'closeProject':\n\t\t\t\t\tmapper.closeProject(/** @type {any} */ (message.params));\n\t\t\t\t\tresult = null;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'transform':\n\t\t\t\t\tresult = mapper.transform(/** @type {any} */ (message.params));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\twrite({\n\t\t\t\t\t\tjsonrpc: '2.0',\n\t\t\t\t\t\tid: message.id,\n\t\t\t\t\t\terror: { code: -32601, message: `Unknown method ${message.method}` },\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t}\n\t\t\twrite({ jsonrpc: '2.0', id: message.id, result });\n\t\t} catch (error) {\n\t\t\twrite({\n\t\t\t\tjsonrpc: '2.0',\n\t\t\t\tid: message.id,\n\t\t\t\terror: {\n\t\t\t\t\tcode: -32603,\n\t\t\t\t\tmessage: error instanceof Error ? (error.stack ?? error.message) : String(error),\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\n\t/** @param {unknown} message */\n\tfunction write(message) {\n\t\tconst body = Buffer.from(JSON.stringify(message), 'utf8');\n\t\toutput.write(`Content-Length: ${body.length}\\r\\n\\r\\n`);\n\t\toutput.write(body);\n\t}\n}\n\n/**\n * Route every console method to stderr so stray logging (from a target\n * compiler, for example) can never corrupt the protocol stream on stdout.\n */\nexport function redirect_console_to_stderr() {\n\
|
|
1
|
+
{"version":3,"file":"rpc.js","names":[],"sources":["../src/rpc.js"],"sourcesContent":["/**\n * Content-mapper transport: `Content-Length`-framed JSON-RPC 2.0 over stdio.\n * TypeScript is the only requester; the mapper never sends requests or\n * notifications. stdout is reserved for protocol messages, so everything\n * else (including `console.log`) goes to stderr.\n *\n * Kept separate from the executable entry (`server.js`) so hosts that bundle\n * the mapper (the VS Code extension ships it for inferred projects) can start\n * it from their own entry file.\n */\n\nimport { Console } from 'node:console';\n\n/**\n * @typedef {{ jsonrpc: '2.0', id?: number | string | null, method: string, params?: unknown }} RequestMessage\n */\n\n/**\n * Run the mapper server on the given streams. Installs the stream handlers\n * and returns; the process exits (with `process.exitCode`) once the input\n * stream ends, which is how TypeScript shuts a mapper down.\n * @param {import('./mapper.js').ContentMapper} mapper\n * @param {{ input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream }} [streams]\n */\nexport function run_mapper_server(mapper, streams = {}) {\n\tconst input = streams.input ?? process.stdin;\n\tconst output = streams.output ?? process.stdout;\n\tlet buffered = Buffer.alloc(0);\n\n\tinput.on('data', (chunk) => {\n\t\tbuffered = Buffer.concat([buffered, typeof chunk === 'string' ? Buffer.from(chunk) : chunk]);\n\t\tread_messages();\n\t});\n\tinput.on('error', (error) => {\n\t\tconsole.error(error);\n\t\tprocess.exitCode = 1;\n\t});\n\tinput.on('end', () => {\n\t\tprocess.exit(process.exitCode ?? 0);\n\t});\n\n\tfunction read_messages() {\n\t\twhile (true) {\n\t\t\tconst header_end = buffered.indexOf('\\r\\n\\r\\n');\n\t\t\tif (header_end < 0) return;\n\t\t\tconst header = buffered.subarray(0, header_end).toString('ascii');\n\t\t\tconst length_match = /^Content-Length:\\s*(\\d+)\\s*$/im.exec(header);\n\t\t\tif (!length_match) {\n\t\t\t\tconsole.error('@tsrx/content-mapper: missing Content-Length header');\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tconst content_length = Number(length_match[1]);\n\t\t\tconst message_start = header_end + 4;\n\t\t\tconst message_end = message_start + content_length;\n\t\t\tif (buffered.length < message_end) return;\n\t\t\tconst body = buffered.subarray(message_start, message_end).toString('utf8');\n\t\t\tbuffered = buffered.subarray(message_end);\n\t\t\t/** @type {RequestMessage} */\n\t\t\tlet message;\n\t\t\ttry {\n\t\t\t\tmessage = JSON.parse(body);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('@tsrx/content-mapper: invalid JSON-RPC message', error);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\thandle_message(message);\n\t\t}\n\t}\n\n\t/** @param {RequestMessage} message */\n\tfunction handle_message(message) {\n\t\tif (message.id === undefined || message.id === null) {\n\t\t\t// Notifications need no response.\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\t/** @type {unknown} */\n\t\t\tlet result;\n\t\t\tswitch (message.method) {\n\t\t\t\tcase 'initialize':\n\t\t\t\t\tresult = mapper.initialize(/** @type {any} */ (message.params));\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'openProject':\n\t\t\t\t\tresult = mapper.openProject(/** @type {any} */ (message.params));\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'closeProject':\n\t\t\t\t\tmapper.closeProject(/** @type {any} */ (message.params));\n\t\t\t\t\tresult = null;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'transform':\n\t\t\t\t\tresult = mapper.transform(/** @type {any} */ (message.params));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\twrite({\n\t\t\t\t\t\tjsonrpc: '2.0',\n\t\t\t\t\t\tid: message.id,\n\t\t\t\t\t\terror: { code: -32601, message: `Unknown method ${message.method}` },\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t}\n\t\t\twrite({ jsonrpc: '2.0', id: message.id, result });\n\t\t} catch (error) {\n\t\t\twrite({\n\t\t\t\tjsonrpc: '2.0',\n\t\t\t\tid: message.id,\n\t\t\t\terror: {\n\t\t\t\t\tcode: -32603,\n\t\t\t\t\tmessage: error instanceof Error ? (error.stack ?? error.message) : String(error),\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\n\t/** @param {unknown} message */\n\tfunction write(message) {\n\t\tconst body = Buffer.from(JSON.stringify(message), 'utf8');\n\t\toutput.write(`Content-Length: ${body.length}\\r\\n\\r\\n`);\n\t\toutput.write(body);\n\t}\n}\n\n/**\n * Route every console method to stderr so stray logging (from a target\n * compiler, for example) can never corrupt the protocol stream on stdout: not\n * only `log` but `dir`, `table`, `trace`, `group` and the rest write there, so\n * each takes the method of a console whose stdout is stderr.\n */\nexport function redirect_console_to_stderr() {\n\tconst to_stderr = new Console({ stdout: process.stderr, stderr: process.stderr });\n\tfor (const [name, method] of Object.entries(to_stderr)) {\n\t\tif (typeof method === 'function') {\n\t\t\t/** @type {Record<string, unknown>} */ (/** @type {unknown} */ (console))[name] = method;\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,kBAAkB,QAAQ,UAAU,CAAC,GAAG;CACvD,MAAM,QAAQ,QAAQ,SAAS,QAAQ;CACvC,MAAM,SAAS,QAAQ,UAAU,QAAQ;CACzC,IAAI,WAAW,OAAO,MAAM,CAAC;CAE7B,MAAM,GAAG,SAAS,UAAU;EAC3B,WAAW,OAAO,OAAO,CAAC,UAAU,OAAO,UAAU,WAAW,OAAO,KAAK,KAAK,IAAI,KAAK,CAAC;EAC3F,cAAc;CACf,CAAC;CACD,MAAM,GAAG,UAAU,UAAU;EAC5B,QAAQ,MAAM,KAAK;EACnB,QAAQ,WAAW;CACpB,CAAC;CACD,MAAM,GAAG,aAAa;EACrB,QAAQ,KAAK,QAAQ,YAAY,CAAC;CACnC,CAAC;CAED,SAAS,gBAAgB;EACxB,OAAO,MAAM;GACZ,MAAM,aAAa,SAAS,QAAQ,UAAU;GAC9C,IAAI,aAAa,GAAG;GACpB,MAAM,SAAS,SAAS,SAAS,GAAG,UAAU,CAAC,CAAC,SAAS,OAAO;GAChE,MAAM,eAAe,iCAAiC,KAAK,MAAM;GACjE,IAAI,CAAC,cAAc;IAClB,QAAQ,MAAM,qDAAqD;IACnE,QAAQ,KAAK,CAAC;GACf;GACA,MAAM,iBAAiB,OAAO,aAAa,EAAE;GAC7C,MAAM,gBAAgB,aAAa;GACnC,MAAM,cAAc,gBAAgB;GACpC,IAAI,SAAS,SAAS,aAAa;GACnC,MAAM,OAAO,SAAS,SAAS,eAAe,WAAW,CAAC,CAAC,SAAS,MAAM;GAC1E,WAAW,SAAS,SAAS,WAAW;;GAExC,IAAI;GACJ,IAAI;IACH,UAAU,KAAK,MAAM,IAAI;GAC1B,SAAS,OAAO;IACf,QAAQ,MAAM,kDAAkD,KAAK;IACrE;GACD;GACA,eAAe,OAAO;EACvB;CACD;;CAGA,SAAS,eAAe,SAAS;EAChC,IAAI,QAAQ,OAAO,UAAa,QAAQ,OAAO,MAE9C;EAED,IAAI;;GAEH,IAAI;GACJ,QAAQ,QAAQ,QAAhB;IACC,KAAK;KACJ,SAAS,OAAO,WAA+B,QAAQ,MAAO;KAC9D;IACD,KAAK;KACJ,SAAS,OAAO,YAAgC,QAAQ,MAAO;KAC/D;IACD,KAAK;KACJ,OAAO,aAAiC,QAAQ,MAAO;KACvD,SAAS;KACT;IACD,KAAK;KACJ,SAAS,OAAO,UAA8B,QAAQ,MAAO;KAC7D;IACD;KACC,MAAM;MACL,SAAS;MACT,IAAI,QAAQ;MACZ,OAAO;OAAE,MAAM;OAAQ,SAAS,kBAAkB,QAAQ;MAAS;KACpE,CAAC;KACD;GACF;GACA,MAAM;IAAE,SAAS;IAAO,IAAI,QAAQ;IAAI;GAAO,CAAC;EACjD,SAAS,OAAO;GACf,MAAM;IACL,SAAS;IACT,IAAI,QAAQ;IACZ,OAAO;KACN,MAAM;KACN,SAAS,iBAAiB,QAAS,MAAM,SAAS,MAAM,UAAW,OAAO,KAAK;IAChF;GACD,CAAC;EACF;CACD;;CAGA,SAAS,MAAM,SAAS;EACvB,MAAM,OAAO,OAAO,KAAK,KAAK,UAAU,OAAO,GAAG,MAAM;EACxD,OAAO,MAAM,mBAAmB,KAAK,OAAO,SAAS;EACrD,OAAO,MAAM,IAAI;CAClB;AACD;;;;;;;AAQA,SAAgB,6BAA6B;CAC5C,MAAM,YAAY,IAAI,QAAQ;EAAE,QAAQ,QAAQ;EAAQ,QAAQ,QAAQ;CAAO,CAAC;CAChF,KAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,SAAS,GACpD,IAAI,OAAO,WAAW;wCACkB,AAAyB,QAAU,QAAQ;AAGrF"}
|
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as create_tsrx_content_mapper } from "./mapper-
|
|
2
|
+
import { t as create_tsrx_content_mapper } from "./mapper-B4f--1ac.js";
|
|
3
3
|
import { redirect_console_to_stderr, run_mapper_server } from "./rpc.js";
|
|
4
4
|
|
|
5
5
|
//#region src/server.js
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsrx/content-mapper",
|
|
3
3
|
"description": "TypeScript 7 content mapper for .tsrx files",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Dominic Gannaway",
|
|
7
7
|
"type": "module",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"tsdown": "^0.23.0",
|
|
50
50
|
"typescript": "^5.9.3",
|
|
51
51
|
"vue": "3.6.0-beta.12",
|
|
52
|
-
"@tsrx/core": "0.
|
|
53
|
-
"@tsrx/
|
|
54
|
-
"@tsrx/react": "0.3
|
|
55
|
-
"@tsrx/
|
|
56
|
-
"@tsrx/
|
|
57
|
-
"@tsrx/
|
|
52
|
+
"@tsrx/core": "0.5.3",
|
|
53
|
+
"@tsrx/preact": "0.3.3",
|
|
54
|
+
"@tsrx/react": "0.4.3",
|
|
55
|
+
"@tsrx/typescript-plugin": "0.6.0",
|
|
56
|
+
"@tsrx/solid": "0.3.3",
|
|
57
|
+
"@tsrx/vue": "0.3.3"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/** @import * as AST from 'estree' */
|
|
2
|
+
/** @import {CodeMapping, CompileError} from '@tsrx/core/types' */
|
|
3
|
+
/** @import {DiagnosticDirectives} from './protocol.js' */
|
|
4
|
+
|
|
5
|
+
import { DiagnosticDirectivePolicy } from './protocol.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The nodes whose generated code an error's directive covers: the innermost
|
|
9
|
+
* statement, declaration, class or type member, or element that holds the
|
|
10
|
+
* error.
|
|
11
|
+
*/
|
|
12
|
+
const HOLDER_TYPE =
|
|
13
|
+
/(?:Statement|Declaration|Definition|Signature)$|^(?:StaticBlock|AccessorProperty|JSXElement|JSXFragment|JSXStyleElement)$/;
|
|
14
|
+
|
|
15
|
+
/** Keys of a tree node that hold no child nodes, or nodes that aren't its children. */
|
|
16
|
+
const NOT_CHILDREN = new Set([
|
|
17
|
+
'metadata',
|
|
18
|
+
'loc',
|
|
19
|
+
'range',
|
|
20
|
+
'parent',
|
|
21
|
+
'comments',
|
|
22
|
+
'leadingComments',
|
|
23
|
+
'trailingComments',
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* An `ignore` directive for each error the mapper reports, so that a mistake
|
|
28
|
+
* shows once. TypeScript reports some mistakes itself from the generated code,
|
|
29
|
+
* with a code of its own, and would show them next to the mapper's error. The
|
|
30
|
+
* directive hides TypeScript's errors in the generated code of the statement,
|
|
31
|
+
* class or type member, or element that holds the error, until the error is
|
|
32
|
+
* fixed and the mapper stops sending it. The mapper's own errors are not
|
|
33
|
+
* TypeScript's, so they stay.
|
|
34
|
+
*
|
|
35
|
+
* The ranges come from what every TSRX compiler returns, whatever its target:
|
|
36
|
+
* the source tree (`sourceAst`) finds the node that holds an error, and the
|
|
37
|
+
* mappings give that node's generated code. Without a source tree the error's
|
|
38
|
+
* own span stands in. A node without mappings gets no directive.
|
|
39
|
+
* @param {readonly CompileError[]} errors
|
|
40
|
+
* @param {AST.Program | null} source_ast
|
|
41
|
+
* @param {readonly CodeMapping[]} mappings
|
|
42
|
+
* @param {number} original_length
|
|
43
|
+
* @param {number} generated_length
|
|
44
|
+
* @returns {DiagnosticDirectives | null}
|
|
45
|
+
*/
|
|
46
|
+
export function ignore_directives(errors, source_ast, mappings, original_length, generated_length) {
|
|
47
|
+
/** @type {Array<[original_start: number, original_end: number, generated_start: number, generated_end: number]>} */
|
|
48
|
+
const ranges = [];
|
|
49
|
+
for (const error of errors) {
|
|
50
|
+
if (typeof error.pos !== 'number') {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const holder = source_ast ? holder_at(source_ast, error.pos) : null;
|
|
54
|
+
const start = holder ? /** @type {number} */ (holder.start) : error.pos;
|
|
55
|
+
const end = holder
|
|
56
|
+
? /** @type {number} */ (holder.end)
|
|
57
|
+
: typeof error.end === 'number' && error.end > error.pos
|
|
58
|
+
? error.end
|
|
59
|
+
: error.pos + 1;
|
|
60
|
+
for (const generated of generated_ranges(mappings, start, end)) {
|
|
61
|
+
ranges.push([
|
|
62
|
+
Math.min(start, original_length),
|
|
63
|
+
Math.min(end, original_length),
|
|
64
|
+
Math.min(generated[0], generated_length),
|
|
65
|
+
Math.min(generated[1], generated_length),
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (ranges.length === 0) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// TypeScript rejects directives whose generated ranges overlap.
|
|
74
|
+
ranges.sort((a, b) => a[2] - b[2]);
|
|
75
|
+
/** @type {typeof ranges} */
|
|
76
|
+
const merged = [];
|
|
77
|
+
for (const range of ranges) {
|
|
78
|
+
const last = merged.at(-1);
|
|
79
|
+
if (last && range[2] < last[3]) {
|
|
80
|
+
last[0] = Math.min(last[0], range[0]);
|
|
81
|
+
last[1] = Math.max(last[1], range[1]);
|
|
82
|
+
last[3] = Math.max(last[3], range[3]);
|
|
83
|
+
} else {
|
|
84
|
+
merged.push([...range]);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
unusedExpectDirectiveDiagnostics: [],
|
|
89
|
+
directives: merged.map(([original_start, original_end, generated_start, generated_end]) => [
|
|
90
|
+
original_start,
|
|
91
|
+
original_end - original_start,
|
|
92
|
+
generated_start,
|
|
93
|
+
generated_end,
|
|
94
|
+
DiagnosticDirectivePolicy.Ignore,
|
|
95
|
+
]),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The innermost holder node (see {@link HOLDER_TYPE}) that contains `position`,
|
|
101
|
+
* found by descending from the root through the child that contains it.
|
|
102
|
+
* @param {AST.Node} root
|
|
103
|
+
* @param {number} position
|
|
104
|
+
* @returns {AST.Node | null}
|
|
105
|
+
*/
|
|
106
|
+
function holder_at(root, position) {
|
|
107
|
+
/** @type {AST.Node | null} */
|
|
108
|
+
let holder = null;
|
|
109
|
+
/** @type {AST.Node | null} */
|
|
110
|
+
let node = root;
|
|
111
|
+
while (node) {
|
|
112
|
+
if (HOLDER_TYPE.test(node.type)) {
|
|
113
|
+
holder = node;
|
|
114
|
+
}
|
|
115
|
+
node = child_at(node, position);
|
|
116
|
+
}
|
|
117
|
+
return holder;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @param {AST.Node} node
|
|
122
|
+
* @param {number} position
|
|
123
|
+
* @returns {AST.Node | null}
|
|
124
|
+
*/
|
|
125
|
+
function child_at(node, position) {
|
|
126
|
+
for (const [key, value] of Object.entries(node)) {
|
|
127
|
+
if (NOT_CHILDREN.has(key) || !value || typeof value !== 'object') {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
for (const child of Array.isArray(value) ? value : [value]) {
|
|
131
|
+
if (
|
|
132
|
+
child &&
|
|
133
|
+
typeof child.type === 'string' &&
|
|
134
|
+
typeof child.start === 'number' &&
|
|
135
|
+
typeof child.end === 'number' &&
|
|
136
|
+
child.start <= position &&
|
|
137
|
+
position < child.end
|
|
138
|
+
) {
|
|
139
|
+
return child;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The generated ranges of the mapped code between `start` and `end` in the
|
|
148
|
+
* original. A node's generated code need not be in one piece: a compiler can
|
|
149
|
+
* hoist part of it (a static element above the component), and a `<script>`
|
|
150
|
+
* body is checked as a block at the end of the file. So each range runs from
|
|
151
|
+
* the first to the last generated offset of the node's segments until code
|
|
152
|
+
* mapped from outside the node follows, and the next of its segments starts a
|
|
153
|
+
* new range; a range never covers another component's code. A segment of the
|
|
154
|
+
* same length on both sides that encloses the original range, as a verbatim
|
|
155
|
+
* `<script>` body does, gives the matching part of its generated text.
|
|
156
|
+
* @param {readonly CodeMapping[]} mappings
|
|
157
|
+
* @param {number} start
|
|
158
|
+
* @param {number} end
|
|
159
|
+
* @returns {Array<[number, number]>}
|
|
160
|
+
*/
|
|
161
|
+
function generated_ranges(mappings, start, end) {
|
|
162
|
+
/** @type {Array<[generated_start: number, generated_end: number, inside: boolean]>} */
|
|
163
|
+
const segments = [];
|
|
164
|
+
for (const mapping of mappings) {
|
|
165
|
+
for (let i = 0; i < mapping.sourceOffsets.length; i++) {
|
|
166
|
+
const source = mapping.sourceOffsets[i];
|
|
167
|
+
const length = mapping.lengths[i];
|
|
168
|
+
const generated = mapping.generatedOffsets[i];
|
|
169
|
+
const generated_length = mapping.generatedLengths?.[i] ?? length;
|
|
170
|
+
if (source >= start && source + length <= end) {
|
|
171
|
+
segments.push([generated, generated + generated_length, true]);
|
|
172
|
+
} else if (source <= start && end <= source + length && generated_length === length) {
|
|
173
|
+
segments.push([generated + start - source, generated + end - source, true]);
|
|
174
|
+
} else {
|
|
175
|
+
segments.push([generated, generated + generated_length, false]);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
segments.sort((a, b) => a[0] - b[0] || a[1] - b[1]);
|
|
180
|
+
/** @type {Array<[number, number]>} */
|
|
181
|
+
const ranges = [];
|
|
182
|
+
/** @type {[number, number] | null} */
|
|
183
|
+
let range = null;
|
|
184
|
+
for (const [segment_start, segment_end, inside] of segments) {
|
|
185
|
+
if (inside) {
|
|
186
|
+
if (range) {
|
|
187
|
+
range[1] = Math.max(range[1], segment_end);
|
|
188
|
+
} else {
|
|
189
|
+
range = [segment_start, segment_end];
|
|
190
|
+
}
|
|
191
|
+
} else if (range && segment_start >= range[1]) {
|
|
192
|
+
// Code from elsewhere follows: the node's next segment starts a new range.
|
|
193
|
+
if (range[1] > range[0]) ranges.push(range);
|
|
194
|
+
range = null;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (range && range[1] > range[0]) ranges.push(range);
|
|
198
|
+
return ranges;
|
|
199
|
+
}
|
package/src/export-stub.js
CHANGED
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
* Build a TypeScript stub that preserves a module's export surface while the
|
|
5
5
|
* file cannot be compiled.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* type errors of its own) to the checker would produce noise. Instead every
|
|
7
|
+
* Raw TSRX, or the last good TSX (which may carry type errors of its own),
|
|
8
|
+
* would give the checker noise to report. Instead every
|
|
10
9
|
* export from the last successful transform's source AST is re-declared as
|
|
11
10
|
* `any` (both as a value and as a type, so `new X()`, `X.y` and `let v: X` all
|
|
12
11
|
* keep resolving), re-exports from other modules are kept as written (including
|
|
@@ -69,10 +68,21 @@ export function build_export_stub(program) {
|
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
70
|
|
|
71
|
+
// A name no declaration can have (`null`, `if`, `string` for a type, an
|
|
72
|
+
// arbitrary module namespace name such as `"foo-bar"`) is exported from a
|
|
73
|
+
// local binding of another name.
|
|
74
|
+
let next_local = 0;
|
|
72
75
|
for (const name of names) {
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
if (identifier_pattern.test(name) && !UNDECLARABLE_NAMES.has(name)) {
|
|
77
|
+
lines.push(`export declare const ${name}: any;`);
|
|
78
|
+
lines.push(`export type ${name} = any;`);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
let local = `_$_export_${next_local++}`;
|
|
82
|
+
while (names.has(local)) local = `_$_export_${next_local++}`;
|
|
83
|
+
lines.push(`declare const ${local}: any;`);
|
|
84
|
+
lines.push(`type ${local} = any;`);
|
|
85
|
+
lines.push(`export { ${local} as ${module_export_name(name)} };`);
|
|
76
86
|
}
|
|
77
87
|
if (has_default) {
|
|
78
88
|
lines.push('declare const _default: any;');
|
|
@@ -96,6 +106,74 @@ function type_modifier(node) {
|
|
|
96
106
|
|
|
97
107
|
const identifier_pattern = /^[\p{ID_Start}_$][\p{ID_Continue}$]*$/u;
|
|
98
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Identifier names that `export declare const x: any; export type x = any;`
|
|
111
|
+
* can't declare in a module: reserved words (TS1389), words reserved in strict
|
|
112
|
+
* mode (TS1214), `await`, `let`, `arguments` and `eval`, the names of
|
|
113
|
+
* TypeScript's own types (TS2457), and `as`, which `export type as` misreads.
|
|
114
|
+
*/
|
|
115
|
+
const UNDECLARABLE_NAMES = new Set([
|
|
116
|
+
'break',
|
|
117
|
+
'case',
|
|
118
|
+
'catch',
|
|
119
|
+
'class',
|
|
120
|
+
'const',
|
|
121
|
+
'continue',
|
|
122
|
+
'debugger',
|
|
123
|
+
'default',
|
|
124
|
+
'delete',
|
|
125
|
+
'do',
|
|
126
|
+
'else',
|
|
127
|
+
'enum',
|
|
128
|
+
'export',
|
|
129
|
+
'extends',
|
|
130
|
+
'false',
|
|
131
|
+
'finally',
|
|
132
|
+
'for',
|
|
133
|
+
'function',
|
|
134
|
+
'if',
|
|
135
|
+
'import',
|
|
136
|
+
'in',
|
|
137
|
+
'instanceof',
|
|
138
|
+
'new',
|
|
139
|
+
'null',
|
|
140
|
+
'return',
|
|
141
|
+
'super',
|
|
142
|
+
'switch',
|
|
143
|
+
'this',
|
|
144
|
+
'throw',
|
|
145
|
+
'true',
|
|
146
|
+
'try',
|
|
147
|
+
'typeof',
|
|
148
|
+
'var',
|
|
149
|
+
'void',
|
|
150
|
+
'while',
|
|
151
|
+
'with',
|
|
152
|
+
'implements',
|
|
153
|
+
'interface',
|
|
154
|
+
'package',
|
|
155
|
+
'private',
|
|
156
|
+
'protected',
|
|
157
|
+
'public',
|
|
158
|
+
'static',
|
|
159
|
+
'yield',
|
|
160
|
+
'await',
|
|
161
|
+
'let',
|
|
162
|
+
'arguments',
|
|
163
|
+
'eval',
|
|
164
|
+
'any',
|
|
165
|
+
'bigint',
|
|
166
|
+
'boolean',
|
|
167
|
+
'never',
|
|
168
|
+
'number',
|
|
169
|
+
'object',
|
|
170
|
+
'string',
|
|
171
|
+
'symbol',
|
|
172
|
+
'undefined',
|
|
173
|
+
'unknown',
|
|
174
|
+
'as',
|
|
175
|
+
]);
|
|
176
|
+
|
|
99
177
|
/**
|
|
100
178
|
* The name an export binds, as a plain string: `a` for `export { a }` and
|
|
101
179
|
* `foo-bar` for `export { "foo-bar" as a } from`.
|
|
@@ -116,7 +194,16 @@ function export_name(node) {
|
|
|
116
194
|
* @returns {string}
|
|
117
195
|
*/
|
|
118
196
|
function print_name(node) {
|
|
119
|
-
|
|
197
|
+
return module_export_name(export_name(node));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* A name as an export specifier takes it: any identifier name, reserved words
|
|
202
|
+
* too, as is, and anything else quoted.
|
|
203
|
+
* @param {string} name
|
|
204
|
+
* @returns {string}
|
|
205
|
+
*/
|
|
206
|
+
function module_export_name(name) {
|
|
120
207
|
return identifier_pattern.test(name) ? name : JSON.stringify(name);
|
|
121
208
|
}
|
|
122
209
|
|