@openge/forge-text-integrity 0.1.0-rc.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/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +40 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +11 -0
- package/dist/cli.js.map +1 -0
- package/dist/contracts.d.ts +13 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +2 -0
- package/dist/contracts.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/inspection.d.ts +3 -0
- package/dist/inspection.d.ts.map +1 -0
- package/dist/inspection.js +99 -0
- package/dist/inspection.js.map +1 -0
- package/dist/node/cli.d.ts +3 -0
- package/dist/node/cli.d.ts.map +1 -0
- package/dist/node/cli.js +26 -0
- package/dist/node/cli.js.map +1 -0
- package/dist/node/configuration.d.ts +11 -0
- package/dist/node/configuration.d.ts.map +1 -0
- package/dist/node/configuration.js +70 -0
- package/dist/node/configuration.js.map +1 -0
- package/dist/node/contracts.d.ts +16 -0
- package/dist/node/contracts.d.ts.map +1 -0
- package/dist/node/contracts.js +2 -0
- package/dist/node/contracts.js.map +1 -0
- package/dist/node/git.d.ts +4 -0
- package/dist/node/git.d.ts.map +1 -0
- package/dist/node/git.js +110 -0
- package/dist/node/git.js.map +1 -0
- package/dist/node/paths.d.ts +7 -0
- package/dist/node/paths.d.ts.map +1 -0
- package/dist/node/paths.js +44 -0
- package/dist/node/paths.js.map +1 -0
- package/dist/node/scan.d.ts +5 -0
- package/dist/node/scan.d.ts.map +1 -0
- package/dist/node/scan.js +67 -0
- package/dist/node/scan.js.map +1 -0
- package/dist/node.d.ts +4 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +3 -0
- package/dist/node.js.map +1 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @openge/forge-text-integrity
|
|
2
|
+
|
|
3
|
+
Runtime-neutral text corruption inspection with explicit Node.js filesystem,
|
|
4
|
+
Git, and CLI adapters. The package has no third-party runtime dependencies.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
pnpm add -D @openge/forge-text-integrity
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Use the root entry when you already have text in memory:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { inspectTextIntegrity } from '@openge/forge-text-integrity';
|
|
14
|
+
|
|
15
|
+
const issues = inspectTextIntegrity(source, { filePath: 'src/example.ts' });
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Use the Node.js entry to scan paths or the current Git change set:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import {
|
|
22
|
+
scanChangedTextIntegrityFiles,
|
|
23
|
+
scanTextIntegrityPaths,
|
|
24
|
+
} from '@openge/forge-text-integrity/node';
|
|
25
|
+
|
|
26
|
+
const repositoryIssues = await scanTextIntegrityPaths(['src', 'docs']);
|
|
27
|
+
const changedIssues = await scanChangedTextIntegrityFiles();
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The CLI accepts either explicit paths or `--changed`, but never both:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
forge-text-integrity src docs
|
|
34
|
+
forge-text-integrity --changed
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The default line marker `check-mojibake-ignore-line` suppresses an intentional
|
|
38
|
+
match on that line. Markdown inline code spans are ignored by default.
|
|
39
|
+
|
|
40
|
+
Licensed under the Apache License 2.0.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runTextIntegrityCli } from './node.js';
|
|
3
|
+
runTextIntegrityCli()
|
|
4
|
+
.then((exitCode) => {
|
|
5
|
+
process.exitCode = exitCode;
|
|
6
|
+
})
|
|
7
|
+
.catch((error) => {
|
|
8
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
9
|
+
process.exitCode = 1;
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,mBAAmB,EAAE;KAClB,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;IACjB,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC9B,CAAC,CAAC;KACD,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxB,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type TextIntegrityIssueCode = 'question-placeholder' | 'replacement-character' | 'private-use-character' | 'mojibake-token-cluster' | 'latin1-mojibake-cluster';
|
|
2
|
+
export interface TextIntegrityIssue {
|
|
3
|
+
readonly file: string;
|
|
4
|
+
readonly line: number;
|
|
5
|
+
readonly code: TextIntegrityIssueCode;
|
|
6
|
+
readonly preview: string;
|
|
7
|
+
}
|
|
8
|
+
export interface InspectTextIntegrityOptions {
|
|
9
|
+
readonly filePath?: string;
|
|
10
|
+
readonly ignoreLineMarker?: string;
|
|
11
|
+
readonly ignoreMarkdownCodeSpans?: boolean;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAC9B,sBAAsB,GACtB,uBAAuB,GACvB,uBAAuB,GACvB,wBAAwB,GACxB,yBAAyB,CAAC;AAE9B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CAC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspection.d.ts","sourceRoot":"","sources":["../src/inspection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,kBAAkB,EAEnB,MAAM,gBAAgB,CAAC;AAkDxB,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,EACZ,UAAS,2BAAgC,KACxC,SAAS,kBAAkB,EAmC7B,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const defaultIgnoreLineMarker = 'check-mojibake-ignore-line';
|
|
2
|
+
const mojibakeCodePoints = new Set([
|
|
3
|
+
0x20ac,
|
|
4
|
+
0x52d4,
|
|
5
|
+
0x589d,
|
|
6
|
+
0x579a,
|
|
7
|
+
0x5bee,
|
|
8
|
+
0x5d87,
|
|
9
|
+
0x641e,
|
|
10
|
+
0x6471,
|
|
11
|
+
0x6d63,
|
|
12
|
+
0x6d93,
|
|
13
|
+
0x6fc2,
|
|
14
|
+
0x6fa7,
|
|
15
|
+
0x71b8,
|
|
16
|
+
0x72b2,
|
|
17
|
+
0x7487,
|
|
18
|
+
0x74a7,
|
|
19
|
+
0x7586,
|
|
20
|
+
0x7e0b,
|
|
21
|
+
0x8930,
|
|
22
|
+
0x8de8,
|
|
23
|
+
0x92b0,
|
|
24
|
+
0x9365,
|
|
25
|
+
0x9422,
|
|
26
|
+
0x95b0,
|
|
27
|
+
]);
|
|
28
|
+
const mojibakeFragments = [
|
|
29
|
+
[0x9422, 0x71b8, 0x579a],
|
|
30
|
+
[0x6d93, 0x20ac],
|
|
31
|
+
[0x5bee, 0x72b2, 0x6d58],
|
|
32
|
+
[0x7ec2, 0x4f79, 0x6471],
|
|
33
|
+
[0x93c2, 0x677f, 0x589d],
|
|
34
|
+
[0x7e5a, 0x9423],
|
|
35
|
+
[0x93c3, 0x5d87],
|
|
36
|
+
[0x9359, 0x5b2b],
|
|
37
|
+
].map((codePoints) => codePoints
|
|
38
|
+
.map((codePoint) => String.fromCodePoint(codePoint))
|
|
39
|
+
.join(''));
|
|
40
|
+
const mojibakeCharacters = [...mojibakeCodePoints]
|
|
41
|
+
.map((codePoint) => String.fromCodePoint(codePoint))
|
|
42
|
+
.join('');
|
|
43
|
+
const latin1MojibakePattern = /[ÃÂâäåæçèé][\u0080-\u00bf\u2018-\u201d\u2039\u203a\u00a0-\u00bf]/u;
|
|
44
|
+
const candidateLinePattern = new RegExp(`[?\\uFFFD\\u0080-\\u009F\\u00A0-\\u00BF\\uE000-\\uF8FFÃÂâäåæçèé${escapeCharacterClass(mojibakeCharacters)}]`, 'u');
|
|
45
|
+
export const inspectTextIntegrity = (text, options = {}) => {
|
|
46
|
+
const file = options.filePath ?? '<inline>';
|
|
47
|
+
const ignoreLineMarker = options.ignoreLineMarker ?? defaultIgnoreLineMarker;
|
|
48
|
+
const ignoreMarkdownCodeSpans = options.ignoreMarkdownCodeSpans ?? true;
|
|
49
|
+
const issues = [];
|
|
50
|
+
for (const [index, line] of text.split(/\r?\n/u).entries()) {
|
|
51
|
+
if (ignoreLineMarker.length > 0 && line.includes(ignoreLineMarker)) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (!candidateLinePattern.test(line)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const lineNumber = index + 1;
|
|
58
|
+
const inspectedLine = ignoreMarkdownCodeSpans ? stripMarkdownCodeSpans(line) : line;
|
|
59
|
+
if (/\?{3,}/u.test(inspectedLine)) {
|
|
60
|
+
issues.push(createIssue(file, lineNumber, 'question-placeholder', line));
|
|
61
|
+
}
|
|
62
|
+
if (inspectedLine.includes('\uFFFD')) {
|
|
63
|
+
issues.push(createIssue(file, lineNumber, 'replacement-character', line));
|
|
64
|
+
}
|
|
65
|
+
if (/[\uE000-\uF8FF]/u.test(inspectedLine)) {
|
|
66
|
+
issues.push(createIssue(file, lineNumber, 'private-use-character', line));
|
|
67
|
+
}
|
|
68
|
+
if (countMojibakeCodePoints(inspectedLine) >= 3 || containsMojibakeFragment(inspectedLine)) {
|
|
69
|
+
issues.push(createIssue(file, lineNumber, 'mojibake-token-cluster', line));
|
|
70
|
+
}
|
|
71
|
+
if (latin1MojibakePattern.test(inspectedLine)) {
|
|
72
|
+
issues.push(createIssue(file, lineNumber, 'latin1-mojibake-cluster', line));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return issues;
|
|
76
|
+
};
|
|
77
|
+
const countMojibakeCodePoints = (line) => {
|
|
78
|
+
let count = 0;
|
|
79
|
+
for (const character of line) {
|
|
80
|
+
const codePoint = character.codePointAt(0);
|
|
81
|
+
if (codePoint !== undefined && mojibakeCodePoints.has(codePoint)) {
|
|
82
|
+
count += 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return count;
|
|
86
|
+
};
|
|
87
|
+
const containsMojibakeFragment = (line) => mojibakeFragments
|
|
88
|
+
.some((fragment) => line.includes(fragment));
|
|
89
|
+
const stripMarkdownCodeSpans = (line) => line.replace(/`[^`]*`/gu, '');
|
|
90
|
+
const createIssue = (file, line, code, source) => ({
|
|
91
|
+
code,
|
|
92
|
+
file,
|
|
93
|
+
line,
|
|
94
|
+
preview: source.trim().slice(0, 160),
|
|
95
|
+
});
|
|
96
|
+
function escapeCharacterClass(text) {
|
|
97
|
+
return text.replace(/[-\\\]^]/gu, '\\$&');
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=inspection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspection.js","sourceRoot":"","sources":["../src/inspection.ts"],"names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,EAAE,CAAC,CAAC;AAEvF,MAAM,WAAW,GAAG,CAClB,IAAY,EACZ,IAAY,EACZ,IAA4B,EAC5B,MAAc,EACM,EAAE,CAAC,CAAC;IACxB,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;CACrC,CAAC,CAAC;AAEH,SAAS,oBAAoB,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/node/cli.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAM9D,eAAO,MAAM,mBAAmB,GAC9B,OAAM,SAAS,MAAM,EAA0B,EAC/C,UAAS,uBAA4B,KACpC,OAAO,CAAC,MAAM,CAYhB,CAAC"}
|
package/dist/node/cli.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { scanChangedTextIntegrityFiles, scanTextIntegrityPaths, } from './scan.js';
|
|
2
|
+
export const runTextIntegrityCli = async (argv = process.argv.slice(2), options = {}) => {
|
|
3
|
+
const args = argv.filter((argument) => argument !== '--');
|
|
4
|
+
const usesChangedMode = args.includes('--changed');
|
|
5
|
+
if (usesChangedMode && (args.length !== 1 || args[0] !== '--changed')) {
|
|
6
|
+
throw new Error('TEXT_INTEGRITY_ARGUMENT_CONFLICT');
|
|
7
|
+
}
|
|
8
|
+
const issues = usesChangedMode
|
|
9
|
+
? await scanChangedTextIntegrityFiles(options)
|
|
10
|
+
: await scanExplicitOrDefaultPaths(args, options);
|
|
11
|
+
return printIssues(issues, options.writeError ?? console.error);
|
|
12
|
+
};
|
|
13
|
+
const scanExplicitOrDefaultPaths = async (paths, options) => {
|
|
14
|
+
const scanPaths = paths.length > 0 ? paths : options.defaultPaths;
|
|
15
|
+
if (scanPaths === undefined || scanPaths.length === 0) {
|
|
16
|
+
throw new Error('TEXT_INTEGRITY_PATH_REQUIRED');
|
|
17
|
+
}
|
|
18
|
+
return scanTextIntegrityPaths(scanPaths, options);
|
|
19
|
+
};
|
|
20
|
+
const printIssues = (issues, writeError) => {
|
|
21
|
+
for (const issue of issues) {
|
|
22
|
+
writeError(`${issue.file}:${String(issue.line)}: ${issue.code}: ${issue.preview}`);
|
|
23
|
+
}
|
|
24
|
+
return issues.length === 0 ? 0 : 1;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/node/cli.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,GACvB,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACtC,OAA0B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAC/C,UAAmC,EAAE,EACpB,EAAE;IACnB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;IAC1D,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,eAAe,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,EAAE,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,MAAM,GAAG,eAAe;QAC5B,CAAC,CAAC,MAAM,6BAA6B,CAAC,OAAO,CAAC;QAC9C,CAAC,CAAC,MAAM,0BAA0B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpD,OAAO,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,0BAA0B,GAAG,KAAK,EACtC,KAAwB,EACxB,OAAgC,EACQ,EAAE;IAC1C,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;IAClE,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAClB,MAAqC,EACrC,UAAqC,EAC7B,EAAE;IACV,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,UAAU,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TextIntegrityScanOptions } from './contracts.js';
|
|
2
|
+
export interface TextIntegrityScanConfiguration {
|
|
3
|
+
readonly concurrency: number;
|
|
4
|
+
readonly ignoredDirectoryNames: ReadonlySet<string>;
|
|
5
|
+
readonly ignoredPathPrefixes: readonly string[];
|
|
6
|
+
readonly respectGitIgnore: boolean;
|
|
7
|
+
readonly textExtensions: ReadonlySet<string>;
|
|
8
|
+
readonly textFileNames: ReadonlySet<string>;
|
|
9
|
+
}
|
|
10
|
+
export declare const createScanConfiguration: (options: TextIntegrityScanOptions) => TextIntegrityScanConfiguration;
|
|
11
|
+
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/node/configuration.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAyC/D,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpD,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7C,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC7C;AAED,eAAO,MAAM,uBAAuB,GAClC,SAAS,wBAAwB,KAChC,8BA0BF,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { availableParallelism } from 'node:os';
|
|
2
|
+
const defaultIgnoredDirectoryNames = [
|
|
3
|
+
'.cache',
|
|
4
|
+
'.git',
|
|
5
|
+
'.next',
|
|
6
|
+
'.tmp',
|
|
7
|
+
'.turbo',
|
|
8
|
+
'.vite',
|
|
9
|
+
'build',
|
|
10
|
+
'coverage',
|
|
11
|
+
'dist',
|
|
12
|
+
'node_modules',
|
|
13
|
+
'output',
|
|
14
|
+
'tmp',
|
|
15
|
+
];
|
|
16
|
+
const defaultTextExtensions = [
|
|
17
|
+
'.c',
|
|
18
|
+
'.cc',
|
|
19
|
+
'.cmake',
|
|
20
|
+
'.cpp',
|
|
21
|
+
'.css',
|
|
22
|
+
'.h',
|
|
23
|
+
'.hpp',
|
|
24
|
+
'.html',
|
|
25
|
+
'.js',
|
|
26
|
+
'.json',
|
|
27
|
+
'.md',
|
|
28
|
+
'.mjs',
|
|
29
|
+
'.mm',
|
|
30
|
+
'.mts',
|
|
31
|
+
'.ts',
|
|
32
|
+
'.tsx',
|
|
33
|
+
'.txt',
|
|
34
|
+
'.wgsl',
|
|
35
|
+
'.xml',
|
|
36
|
+
'.yml',
|
|
37
|
+
'.yaml',
|
|
38
|
+
];
|
|
39
|
+
const defaultTextFileNames = ['AGENTS.md', 'CMakeLists.txt', 'LICENSE'];
|
|
40
|
+
export const createScanConfiguration = (options) => {
|
|
41
|
+
const concurrency = options.concurrency
|
|
42
|
+
?? Math.max(4, Math.min(16, availableParallelism() * 2));
|
|
43
|
+
if (!Number.isSafeInteger(concurrency) || concurrency <= 0) {
|
|
44
|
+
throw new Error('TEXT_INTEGRITY_INVALID_CONCURRENCY');
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
concurrency,
|
|
48
|
+
ignoredDirectoryNames: new Set([
|
|
49
|
+
...defaultIgnoredDirectoryNames,
|
|
50
|
+
...(options.ignoredDirectoryNames ?? []),
|
|
51
|
+
]),
|
|
52
|
+
ignoredPathPrefixes: (options.ignoredPathPrefixes ?? [])
|
|
53
|
+
.map(normalizePathPrefix)
|
|
54
|
+
.filter((prefix) => prefix.length > 0),
|
|
55
|
+
respectGitIgnore: options.respectGitIgnore ?? true,
|
|
56
|
+
textExtensions: new Set([
|
|
57
|
+
...defaultTextExtensions,
|
|
58
|
+
...(options.additionalTextExtensions ?? []),
|
|
59
|
+
]),
|
|
60
|
+
textFileNames: new Set([
|
|
61
|
+
...defaultTextFileNames,
|
|
62
|
+
...(options.additionalTextFileNames ?? []),
|
|
63
|
+
]),
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
const normalizePathPrefix = (prefix) => prefix
|
|
67
|
+
.replaceAll('\\', '/')
|
|
68
|
+
.replace(/^\.\//u, '')
|
|
69
|
+
.replace(/\/+$/u, '');
|
|
70
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/node/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAI/C,MAAM,4BAA4B,GAAG;IACnC,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,OAAO;IACP,OAAO;IACP,UAAU;IACV,MAAM;IACN,cAAc;IACd,QAAQ;IACR,KAAK;CACG,CAAC;AACX,MAAM,qBAAqB,GAAG;IAC5B,IAAI;IACJ,KAAK;IACL,QAAQ;IACR,MAAM;IACN,MAAM;IACN,IAAI;IACJ,MAAM;IACN,OAAO;IACP,KAAK;IACL,OAAO;IACP,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;CACC,CAAC;AACX,MAAM,oBAAoB,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,SAAS,CAAU,CAAC;AAWjF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,OAAiC,EACD,EAAE;IAClC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW;WAClC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,oBAAoB,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3D,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,WAAW,IAAI,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO;QACL,WAAW;QACX,qBAAqB,EAAE,IAAI,GAAG,CAAC;YAC7B,GAAG,4BAA4B;YAC/B,GAAG,CAAC,OAAO,CAAC,qBAAqB,IAAI,EAAE,CAAC;SACzC,CAAC;QACF,mBAAmB,EAAE,CAAC,OAAO,CAAC,mBAAmB,IAAI,EAAE,CAAC;aACrD,GAAG,CAAC,mBAAmB,CAAC;aACxB,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACxC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,IAAI;QAClD,cAAc,EAAE,IAAI,GAAG,CAAC;YACtB,GAAG,qBAAqB;YACxB,GAAG,CAAC,OAAO,CAAC,wBAAwB,IAAI,EAAE,CAAC;SAC5C,CAAC;QACF,aAAa,EAAE,IAAI,GAAG,CAAC;YACrB,GAAG,oBAAoB;YACvB,GAAG,CAAC,OAAO,CAAC,uBAAuB,IAAI,EAAE,CAAC;SAC3C,CAAC;KACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,MAAM;KAC3D,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC;KACrB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;KACrB,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface TextIntegrityScanOptions {
|
|
2
|
+
readonly cwd?: string;
|
|
3
|
+
readonly ignoreLineMarker?: string;
|
|
4
|
+
readonly ignoreMarkdownCodeSpans?: boolean;
|
|
5
|
+
readonly ignoredDirectoryNames?: readonly string[];
|
|
6
|
+
readonly ignoredPathPrefixes?: readonly string[];
|
|
7
|
+
readonly additionalTextExtensions?: readonly string[];
|
|
8
|
+
readonly additionalTextFileNames?: readonly string[];
|
|
9
|
+
readonly concurrency?: number;
|
|
10
|
+
readonly respectGitIgnore?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface TextIntegrityCliOptions extends TextIntegrityScanOptions {
|
|
13
|
+
readonly defaultPaths?: readonly string[];
|
|
14
|
+
readonly writeError?: (message: string) => void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/node/contracts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C,QAAQ,CAAC,qBAAqB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnD,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjD,QAAQ,CAAC,wBAAwB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtD,QAAQ,CAAC,uBAAuB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED,MAAM,WAAW,uBAAwB,SAAQ,wBAAwB;IACvE,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/node/contracts.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TextIntegrityScanConfiguration } from './configuration.js';
|
|
2
|
+
export declare const filterGitRelevantFiles: (files: readonly string[]) => Promise<readonly string[]>;
|
|
3
|
+
export declare const collectChangedTextFiles: (cwd: string, configuration: TextIntegrityScanConfiguration) => Promise<readonly string[]>;
|
|
4
|
+
//# sourceMappingURL=git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/node/git.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAUzE,eAAO,MAAM,sBAAsB,GACjC,OAAO,SAAS,MAAM,EAAE,KACvB,OAAO,CAAC,SAAS,MAAM,EAAE,CA+B3B,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,KAAK,MAAM,EACX,eAAe,8BAA8B,KAC5C,OAAO,CAAC,SAAS,MAAM,EAAE,CAe3B,CAAC"}
|
package/dist/node/git.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { execFile, spawn } from 'node:child_process';
|
|
2
|
+
import { dirname, relative, resolve } from 'node:path';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import { compareNormalizedPaths, isIgnoredPath, isTextFile, normalizeRepoPath, } from './paths.js';
|
|
5
|
+
const execFileAsync = promisify(execFile);
|
|
6
|
+
export const filterGitRelevantFiles = async (files) => {
|
|
7
|
+
const rootCache = new Map();
|
|
8
|
+
const filesByRoot = new Map();
|
|
9
|
+
const nonGitFiles = [];
|
|
10
|
+
for (const file of files) {
|
|
11
|
+
const root = await findGitRoot(dirname(file), rootCache);
|
|
12
|
+
if (root === undefined) {
|
|
13
|
+
nonGitFiles.push(file);
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
const group = filesByRoot.get(root) ?? [];
|
|
17
|
+
group.push(file);
|
|
18
|
+
filesByRoot.set(root, group);
|
|
19
|
+
}
|
|
20
|
+
const filtered = [...nonGitFiles];
|
|
21
|
+
for (const [root, rootFiles] of filesByRoot) {
|
|
22
|
+
const relativePaths = rootFiles.map((file) => normalizeRepoPath(relative(root, file)));
|
|
23
|
+
const ignoredPaths = await collectGitIgnoredPaths(root, relativePaths);
|
|
24
|
+
for (const [index, file] of rootFiles.entries()) {
|
|
25
|
+
const relativePath = relativePaths[index];
|
|
26
|
+
if (relativePath !== undefined && !ignoredPaths.has(relativePath)) {
|
|
27
|
+
filtered.push(file);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return filtered.sort((left, right) => compareNormalizedPaths(normalizeRepoPath(left), normalizeRepoPath(right)));
|
|
32
|
+
};
|
|
33
|
+
export const collectChangedTextFiles = async (cwd, configuration) => {
|
|
34
|
+
const { stdout } = await execFileAsync('git', ['status', '--porcelain=v1', '-z', '--untracked-files=all'], { cwd, encoding: 'utf8', maxBuffer: 16 * 1_024 * 1_024 });
|
|
35
|
+
const files = parseGitStatusPorcelain(stdout)
|
|
36
|
+
.map((filePath) => resolve(cwd, filePath))
|
|
37
|
+
.filter((filePath) => !isIgnoredPath(filePath, cwd, configuration))
|
|
38
|
+
.filter((filePath) => isTextFile(filePath, configuration));
|
|
39
|
+
return [...new Set(files)].sort((left, right) => compareNormalizedPaths(normalizeRepoPath(relative(cwd, left)), normalizeRepoPath(relative(cwd, right))));
|
|
40
|
+
};
|
|
41
|
+
const parseGitStatusPorcelain = (output) => {
|
|
42
|
+
const paths = [];
|
|
43
|
+
const entries = output.split('\0');
|
|
44
|
+
for (let index = 0; index < entries.length; index += 1) {
|
|
45
|
+
const entry = entries[index];
|
|
46
|
+
if (entry === undefined || entry.length === 0) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const status = entry.slice(0, 2);
|
|
50
|
+
const filePath = entry.slice(3);
|
|
51
|
+
if (!status.includes('D')) {
|
|
52
|
+
paths.push(filePath);
|
|
53
|
+
}
|
|
54
|
+
if (status[0] === 'R' || status[0] === 'C') {
|
|
55
|
+
index += 1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return paths;
|
|
59
|
+
};
|
|
60
|
+
const findGitRoot = async (directory, cache) => {
|
|
61
|
+
const resolvedDirectory = resolve(directory);
|
|
62
|
+
if (cache.has(resolvedDirectory)) {
|
|
63
|
+
return cache.get(resolvedDirectory);
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const { stdout } = await execFileAsync('git', ['rev-parse', '--show-toplevel'], { cwd: resolvedDirectory, encoding: 'utf8', maxBuffer: 1_024 * 1_024 });
|
|
67
|
+
const root = resolve(stdout.trim());
|
|
68
|
+
cache.set(resolvedDirectory, root);
|
|
69
|
+
return root;
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (isExitCode(error, 128)) {
|
|
73
|
+
cache.set(resolvedDirectory, undefined);
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const collectGitIgnoredPaths = (root, relativePaths) => new Promise((resolvePromise, reject) => {
|
|
80
|
+
if (relativePaths.length === 0) {
|
|
81
|
+
resolvePromise(new Set());
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const child = spawn('git', ['check-ignore', '-z', '--stdin'], {
|
|
85
|
+
cwd: root,
|
|
86
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
87
|
+
});
|
|
88
|
+
const stdoutChunks = [];
|
|
89
|
+
const stderrChunks = [];
|
|
90
|
+
child.stdout.on('data', (chunk) => stdoutChunks.push(chunk));
|
|
91
|
+
child.stderr.on('data', (chunk) => stderrChunks.push(chunk));
|
|
92
|
+
child.on('error', reject);
|
|
93
|
+
child.on('close', (code) => {
|
|
94
|
+
if (code !== 0 && code !== 1) {
|
|
95
|
+
const diagnostic = Buffer.concat(stderrChunks).toString('utf8').trim();
|
|
96
|
+
reject(new Error(diagnostic || `git check-ignore failed with exit code ${String(code)}`));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const output = Buffer.concat(stdoutChunks).toString('utf8');
|
|
100
|
+
resolvePromise(new Set(output.split('\0').filter((path) => path.length > 0)));
|
|
101
|
+
});
|
|
102
|
+
child.stdin.end(`${relativePaths.join('\0')}\0`, 'utf8');
|
|
103
|
+
});
|
|
104
|
+
const isExitCode = (error, expected) => {
|
|
105
|
+
if (typeof error !== 'object' || error === null || !('code' in error)) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
return error.code === expected;
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/node/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,UAAU,EACV,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACzC,KAAwB,EACI,EAAE;IAC9B,MAAM,SAAS,GAAG,IAAI,GAAG,EAA8B,CAAC;IACxD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAoB,CAAC;IAChD,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;QACzD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvB,SAAS;QACX,CAAC;QACD,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED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Ac,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC3D,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,CAAC,KAAc,EAAE,QAAgB,EAAW,EAAE;IAC/D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC;QACtE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AACjC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TextIntegrityScanConfiguration } from './configuration.js';
|
|
2
|
+
export declare const collectTextFiles: (paths: readonly string[], cwd: string, configuration: TextIntegrityScanConfiguration) => Promise<readonly string[]>;
|
|
3
|
+
export declare const isTextFile: (filePath: string, configuration: TextIntegrityScanConfiguration) => boolean;
|
|
4
|
+
export declare const isIgnoredPath: (filePath: string, cwd: string, configuration: TextIntegrityScanConfiguration) => boolean;
|
|
5
|
+
export declare const normalizeRepoPath: (path: string) => string;
|
|
6
|
+
export declare const compareNormalizedPaths: (left: string, right: string) => number;
|
|
7
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/node/paths.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAEzE,eAAO,MAAM,gBAAgB,GAC3B,OAAO,SAAS,MAAM,EAAE,EACxB,KAAK,MAAM,EACX,eAAe,8BAA8B,KAC5C,OAAO,CAAC,SAAS,MAAM,EAAE,CAU3B,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,UAAU,MAAM,EAChB,eAAe,8BAA8B,KAC5C,OACmE,CAAC;AAEvE,eAAO,MAAM,aAAa,GACxB,UAAU,MAAM,EAChB,KAAK,MAAM,EACX,eAAe,8BAA8B,KAC5C,OAQF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MAAoC,CAAC;AAEtF,eAAO,MAAM,sBAAsB,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAKpE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { readdir, stat } from 'node:fs/promises';
|
|
2
|
+
import { basename, extname, join, relative, resolve } from 'node:path';
|
|
3
|
+
export const collectTextFiles = async (paths, cwd, configuration) => {
|
|
4
|
+
const files = new Set();
|
|
5
|
+
for (const path of paths) {
|
|
6
|
+
await collectPath(resolve(cwd, path), cwd, configuration, files);
|
|
7
|
+
}
|
|
8
|
+
return [...files].sort((left, right) => compareNormalizedPaths(normalizeRepoPath(relative(cwd, left)), normalizeRepoPath(relative(cwd, right))));
|
|
9
|
+
};
|
|
10
|
+
export const isTextFile = (filePath, configuration) => configuration.textFileNames.has(basename(filePath))
|
|
11
|
+
|| configuration.textExtensions.has(extname(filePath).toLowerCase());
|
|
12
|
+
export const isIgnoredPath = (filePath, cwd, configuration) => {
|
|
13
|
+
const repoPath = normalizeRepoPath(relative(cwd, filePath));
|
|
14
|
+
const segments = repoPath.split('/');
|
|
15
|
+
return segments.some((segment) => configuration.ignoredDirectoryNames.has(segment))
|
|
16
|
+
|| configuration.ignoredPathPrefixes.some((prefix) => (repoPath === prefix || repoPath.startsWith(`${prefix}/`)));
|
|
17
|
+
};
|
|
18
|
+
export const normalizeRepoPath = (path) => path.replaceAll('\\', '/');
|
|
19
|
+
export const compareNormalizedPaths = (left, right) => {
|
|
20
|
+
if (left < right) {
|
|
21
|
+
return -1;
|
|
22
|
+
}
|
|
23
|
+
return left > right ? 1 : 0;
|
|
24
|
+
};
|
|
25
|
+
const collectPath = async (filePath, cwd, configuration, files) => {
|
|
26
|
+
if (isIgnoredPath(filePath, cwd, configuration)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const fileStat = await stat(filePath);
|
|
30
|
+
if (fileStat.isDirectory()) {
|
|
31
|
+
const entries = await readdir(filePath, { withFileTypes: true });
|
|
32
|
+
for (const entry of entries) {
|
|
33
|
+
if (!entry.isDirectory() && !entry.isFile()) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
await collectPath(join(filePath, entry.name), cwd, configuration, files);
|
|
37
|
+
}
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (fileStat.isFile() && isTextFile(filePath, configuration)) {
|
|
41
|
+
files.add(resolve(filePath));
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/node/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,KAAwB,EACxB,GAAW,EACX,aAA6C,EACjB,EAAE;IAC9B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAEhC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC;IACD,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ptions } from './contracts.js';
|
|
3
|
+
export declare const scanTextIntegrityPaths: (paths: readonly string[], options?: TextIntegrityScanOptions) => Promise<readonly TextIntegrityIssue[]>;
|
|
4
|
+
export declare const scanChangedTextIntegrityFiles: (options?: TextIntegrityScanOptions) => Promise<readonly TextIntegrityIssue[]>;
|
|
5
|
+
//# sourceMappingURL=scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../src/node/scan.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAA0B,MAAM,iBAAiB,CAAC;AAElF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAgB/D,eAAO,MAAM,sBAAsB,GACjC,OAAO,SAAS,MAAM,EAAE,EACxB,UAAS,wBAA6B,KACrC,OAAO,CAAC,SAAS,kBAAkB,EAAE,CASvC,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,UAAS,wBAA6B,KACrC,OAAO,CAAC,SAAS,kBAAkB,EAAE,CAMvC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { relative, resolve } from 'node:path';
|
|
3
|
+
import { inspectTextIntegrity } from '../inspection.js';
|
|
4
|
+
import { createScanConfiguration } from './configuration.js';
|
|
5
|
+
import { collectChangedTextFiles, filterGitRelevantFiles } from './git.js';
|
|
6
|
+
import { collectTextFiles, compareNormalizedPaths, normalizeRepoPath, } from './paths.js';
|
|
7
|
+
const issueCodeOrder = {
|
|
8
|
+
'question-placeholder': 0,
|
|
9
|
+
'replacement-character': 1,
|
|
10
|
+
'private-use-character': 2,
|
|
11
|
+
'mojibake-token-cluster': 3,
|
|
12
|
+
'latin1-mojibake-cluster': 4,
|
|
13
|
+
};
|
|
14
|
+
export const scanTextIntegrityPaths = async (paths, options = {}) => {
|
|
15
|
+
const cwd = resolve(options.cwd ?? process.cwd());
|
|
16
|
+
const configuration = createScanConfiguration(options);
|
|
17
|
+
const collectedFiles = await collectTextFiles(paths, cwd, configuration);
|
|
18
|
+
const files = configuration.respectGitIgnore
|
|
19
|
+
? await filterGitRelevantFiles(collectedFiles)
|
|
20
|
+
: collectedFiles;
|
|
21
|
+
return scanFiles(files, cwd, options, configuration.concurrency);
|
|
22
|
+
};
|
|
23
|
+
export const scanChangedTextIntegrityFiles = async (options = {}) => {
|
|
24
|
+
const cwd = resolve(options.cwd ?? process.cwd());
|
|
25
|
+
const configuration = createScanConfiguration(options);
|
|
26
|
+
const files = await collectChangedTextFiles(cwd, configuration);
|
|
27
|
+
return scanFiles(files, cwd, options, configuration.concurrency);
|
|
28
|
+
};
|
|
29
|
+
const scanFiles = async (files, cwd, options, concurrency) => {
|
|
30
|
+
const fileResults = await mapWithConcurrency(files, concurrency, async (file) => {
|
|
31
|
+
const contents = await readFile(file);
|
|
32
|
+
if (contents.includes(0)) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
return inspectTextIntegrity(contents.toString('utf8'), {
|
|
36
|
+
filePath: normalizeRepoPath(relative(cwd, file)),
|
|
37
|
+
...(options.ignoreLineMarker === undefined
|
|
38
|
+
? {}
|
|
39
|
+
: { ignoreLineMarker: options.ignoreLineMarker }),
|
|
40
|
+
...(options.ignoreMarkdownCodeSpans === undefined
|
|
41
|
+
? {}
|
|
42
|
+
: { ignoreMarkdownCodeSpans: options.ignoreMarkdownCodeSpans }),
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
return fileResults.flat().sort(compareIssues);
|
|
46
|
+
};
|
|
47
|
+
const compareIssues = (left, right) => (compareNormalizedPaths(left.file, right.file)
|
|
48
|
+
|| left.line - right.line
|
|
49
|
+
|| issueCodeOrder[left.code] - issueCodeOrder[right.code]);
|
|
50
|
+
const mapWithConcurrency = async (items, concurrency, mapper) => {
|
|
51
|
+
const results = new Array(items.length);
|
|
52
|
+
let nextIndex = 0;
|
|
53
|
+
const workerCount = Math.min(concurrency, items.length);
|
|
54
|
+
const workers = Array.from({ length: workerCount }, async () => {
|
|
55
|
+
while (nextIndex < items.length) {
|
|
56
|
+
const currentIndex = nextIndex;
|
|
57
|
+
nextIndex += 1;
|
|
58
|
+
const item = items[currentIndex];
|
|
59
|
+
if (item !== undefined) {
|
|
60
|
+
results[currentIndex] = await mapper(item);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
await Promise.all(workers);
|
|
65
|
+
return results;
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../../src/node/scan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,MAAM,cAAc,GAAqD;IACvE,sBAAsB,EAAE,CAAC;IACzB,uBAAuB,EAAE,CAAC;IAC1B,uBAAuB,EAAE,CAAC;IAC1B,wBAAwB,EAAE,CAAC;IAC3B,yBAAyB,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACzC,KAAwB,EACxB,UAAoC,EAAE,EACE,EAAE;IAC1C,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAClD,MAAM,aAAa,GAAG,uBAAuB,CAAC,OAAO,CAA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AAC;YACf,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;YACjC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,OAAO,CAAC,YAAY,CAAC,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3B,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { TextIntegrityCliOptions, TextIntegrityScanOptions, } from './node/contracts.js';
|
|
2
|
+
export { runTextIntegrityCli } from './node/cli.js';
|
|
3
|
+
export { scanChangedTextIntegrityFiles, scanTextIntegrityPaths, } from './node/scan.js';
|
|
4
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC"}
|
package/dist/node.js
ADDED
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openge/forge-text-integrity",
|
|
3
|
+
"version": "0.1.0-rc.0",
|
|
4
|
+
"description": "Runtime-neutral text integrity inspection and Node.js repository scanning",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./node": {
|
|
14
|
+
"types": "./dist/node.d.ts",
|
|
15
|
+
"import": "./dist/node.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"bin": {
|
|
19
|
+
"forge-text-integrity": "./dist/cli.js"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"NOTICE"
|
|
26
|
+
],
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22.14.0"
|
|
30
|
+
},
|
|
31
|
+
"license": "Apache-2.0",
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/zopenge/foundation-forge.git",
|
|
38
|
+
"directory": "packages/text-integrity"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/zopenge/foundation-forge#readme",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/zopenge/foundation-forge/issues"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc -p tsconfig.build.json",
|
|
46
|
+
"lint": "eslint . --max-warnings 0",
|
|
47
|
+
"typecheck": "tsc -p tsconfig.json --noEmit --pretty false",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:coverage": "vitest run --coverage"
|
|
50
|
+
}
|
|
51
|
+
}
|