@localeguard/template-analyzer 0.3.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/README.md +44 -0
- package/dist/src/angular.d.ts +6 -0
- package/dist/src/angular.d.ts.map +1 -0
- package/dist/src/angular.js +16 -0
- package/dist/src/angular.js.map +1 -0
- package/dist/src/index.d.ts +21 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +91 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/scanner.d.ts +25 -0
- package/dist/src/scanner.d.ts.map +1 -0
- package/dist/src/scanner.js +250 -0
- package/dist/src/scanner.js.map +1 -0
- package/dist/src/vue.d.ts +7 -0
- package/dist/src/vue.d.ts.map +1 -0
- package/dist/src/vue.js +34 -0
- package/dist/src/vue.js.map +1 -0
- package/package.json +41 -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 Derivative
|
|
95
|
+
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, excluding
|
|
103
|
+
those notices that do not pertain to any part of the Derivative
|
|
104
|
+
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 do
|
|
117
|
+
not modify the License. You may add Your own attribution notices
|
|
118
|
+
within Derivative Works that You distribute, alongside or as an
|
|
119
|
+
addendum to the NOTICE text from the Work, provided that such
|
|
120
|
+
additional attribution notices cannot be construed as modifying
|
|
121
|
+
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 2026 LocaleGuard contributors
|
|
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/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @localeguard/template-analyzer
|
|
2
|
+
|
|
3
|
+
Detect **hardcoded** user-facing text in Vue (`.vue`) and Angular (`.html`)
|
|
4
|
+
templates for [LocaleGuard](https://github.com/isamrish/localeguard). Zero runtime
|
|
5
|
+
dependencies — a small, focused HTML/template scanner (no `@vue/compiler-sfc` or
|
|
6
|
+
Angular compiler required).
|
|
7
|
+
|
|
8
|
+
Reports the same issue types as the React analyzer:
|
|
9
|
+
|
|
10
|
+
- **`hardcoded-string`** — static template text, e.g. `<h1>Cluster Manager</h1>`
|
|
11
|
+
- **`hardcoded-attribute`** — literal `aria-label`/`title`/`alt`/`placeholder`
|
|
12
|
+
|
|
13
|
+
## Design: low false positives
|
|
14
|
+
|
|
15
|
+
Only **static** content is flagged. Anything dynamic or already marked for
|
|
16
|
+
translation is ignored:
|
|
17
|
+
|
|
18
|
+
| Template | Flagged? |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| `<h1>Cluster Manager</h1>` | ✅ |
|
|
21
|
+
| `<p>{{ t('title') }}</p>` | ❌ interpolation |
|
|
22
|
+
| `<p>Hello {{ name }}</p>` | ✅ (only the static `Hello`) |
|
|
23
|
+
| `<img :alt="x" />` / `<img [alt]="x" />` | ❌ bound attribute |
|
|
24
|
+
| `<img alt="Logo" />` | ✅ |
|
|
25
|
+
| `<i18n-t>…</i18n-t>` (Vue) | ❌ translation component |
|
|
26
|
+
| `<p i18n>…</p>` (Angular) | ❌ marked for i18n |
|
|
27
|
+
| `<button translate>KEY</button>` (Angular) | ❌ translate directive |
|
|
28
|
+
| `<code>npm i</code>`, `<span>100%</span>` | ❌ technical / non-text |
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
Composed automatically by the `localeguard` CLI based on the `framework` config
|
|
33
|
+
(`vue-i18n` scans `.vue`; `ngx-translate` scans `.html`). It can also be used
|
|
34
|
+
directly:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { scanVueSfc, scanAngularTemplate } from "@localeguard/template-analyzer";
|
|
38
|
+
|
|
39
|
+
const issues = scanVueSfc(vueSource, "App.vue", ["i18n-t"]);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
[Apache-2.0](https://github.com/isamrish/localeguard/blob/main/LICENSE)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular component templates (external `.html` files).
|
|
3
|
+
*/
|
|
4
|
+
import type { Issue } from "@localeguard/core";
|
|
5
|
+
export declare function scanAngularTemplate(source: string, fileName: string, translationComponents?: string[]): Issue[];
|
|
6
|
+
//# sourceMappingURL=angular.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular.d.ts","sourceRoot":"","sources":["../../src/angular.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,qBAAqB,CAAC,EAAE,MAAM,EAAE,GAC/B,KAAK,EAAE,CAOT"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Angular component templates (external `.html` files).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.scanAngularTemplate = scanAngularTemplate;
|
|
7
|
+
const scanner_1 = require("./scanner");
|
|
8
|
+
function scanAngularTemplate(source, fileName, translationComponents) {
|
|
9
|
+
return (0, scanner_1.scanTemplate)(source, {
|
|
10
|
+
mode: "angular",
|
|
11
|
+
fileName,
|
|
12
|
+
startLine: 1,
|
|
13
|
+
translationComponents,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=angular.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular.js","sourceRoot":"","sources":["../../src/angular.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAMH,kDAWC;AAbD,uCAAyC;AAEzC,SAAgB,mBAAmB,CACjC,MAAc,EACd,QAAgB,EAChB,qBAAgC;IAEhC,OAAO,IAAA,sBAAY,EAAC,MAAM,EAAE;QAC1B,IAAI,EAAE,SAAS;QACf,QAAQ;QACR,SAAS,EAAE,CAAC;QACZ,qBAAqB;KACtB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @localeguard/template-analyzer — detect hardcoded text in Vue (`.vue`) and
|
|
3
|
+
* Angular (`.html`) templates. Zero runtime dependencies.
|
|
4
|
+
*/
|
|
5
|
+
import type { Framework, Issue } from "@localeguard/core";
|
|
6
|
+
export interface TemplateAnalyzerConfig {
|
|
7
|
+
include?: string[];
|
|
8
|
+
ignore?: string[];
|
|
9
|
+
translationComponents?: string[];
|
|
10
|
+
framework?: Framework;
|
|
11
|
+
}
|
|
12
|
+
export interface AnalyzeOptions {
|
|
13
|
+
/** Absolute project root; reported file paths are relative to this. */
|
|
14
|
+
rootDir: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function analyzeTemplates(config: TemplateAnalyzerConfig, opts: AnalyzeOptions): Issue[];
|
|
17
|
+
export { scanTemplate } from "./scanner";
|
|
18
|
+
export type { ScanOptions, TemplateMode } from "./scanner";
|
|
19
|
+
export { scanVueSfc } from "./vue";
|
|
20
|
+
export { scanAngularTemplate } from "./angular";
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAK1D,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;CACjB;AASD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,cAAc,GAAG,KAAK,EAAE,CA6B9F;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @localeguard/template-analyzer — detect hardcoded text in Vue (`.vue`) and
|
|
4
|
+
* Angular (`.html`) templates. Zero runtime dependencies.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.scanAngularTemplate = exports.scanVueSfc = exports.scanTemplate = void 0;
|
|
41
|
+
exports.analyzeTemplates = analyzeTemplates;
|
|
42
|
+
const fs = __importStar(require("node:fs"));
|
|
43
|
+
const path = __importStar(require("node:path"));
|
|
44
|
+
const core_1 = require("@localeguard/core");
|
|
45
|
+
const angular_1 = require("./angular");
|
|
46
|
+
const vue_1 = require("./vue");
|
|
47
|
+
/** Default globs by framework when `include` is not set. */
|
|
48
|
+
function defaultInclude(framework) {
|
|
49
|
+
if (framework === "vue-i18n")
|
|
50
|
+
return ["src/**/*.vue"];
|
|
51
|
+
if (framework === "ngx-translate")
|
|
52
|
+
return ["src/**/*.html"];
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
function analyzeTemplates(config, opts) {
|
|
56
|
+
const include = config.include ?? defaultInclude(config.framework);
|
|
57
|
+
if (include.length === 0)
|
|
58
|
+
return [];
|
|
59
|
+
const files = (0, core_1.findFiles)({ rootDir: opts.rootDir, include, ignore: config.ignore });
|
|
60
|
+
const angular = config.framework === "ngx-translate";
|
|
61
|
+
const issues = [];
|
|
62
|
+
for (const absFile of files) {
|
|
63
|
+
const ext = path.extname(absFile).toLowerCase();
|
|
64
|
+
// `.vue` is unambiguous; only treat `.html` as a template for Angular, so we
|
|
65
|
+
// never scan arbitrary HTML pages in other projects.
|
|
66
|
+
if (ext !== ".vue" && !(ext === ".html" && angular))
|
|
67
|
+
continue;
|
|
68
|
+
let text;
|
|
69
|
+
try {
|
|
70
|
+
text = fs.readFileSync(absFile, "utf8");
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const rel = path.relative(opts.rootDir, absFile) || absFile;
|
|
76
|
+
if (ext === ".vue") {
|
|
77
|
+
issues.push(...(0, vue_1.scanVueSfc)(text, rel, config.translationComponents));
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
issues.push(...(0, angular_1.scanAngularTemplate)(text, rel, config.translationComponents));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return issues;
|
|
84
|
+
}
|
|
85
|
+
var scanner_1 = require("./scanner");
|
|
86
|
+
Object.defineProperty(exports, "scanTemplate", { enumerable: true, get: function () { return scanner_1.scanTemplate; } });
|
|
87
|
+
var vue_2 = require("./vue");
|
|
88
|
+
Object.defineProperty(exports, "scanVueSfc", { enumerable: true, get: function () { return vue_2.scanVueSfc; } });
|
|
89
|
+
var angular_2 = require("./angular");
|
|
90
|
+
Object.defineProperty(exports, "scanAngularTemplate", { enumerable: true, get: function () { return angular_2.scanAngularTemplate; } });
|
|
91
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BH,4CA6BC;AAzDD,4CAA8B;AAC9B,gDAAkC;AAElC,4CAA8C;AAG9C,uCAAgD;AAChD,+BAAmC;AAcnC,4DAA4D;AAC5D,SAAS,cAAc,CAAC,SAAqB;IAC3C,IAAI,SAAS,KAAK,UAAU;QAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACtD,IAAI,SAAS,KAAK,eAAe;QAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5D,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAgB,gBAAgB,CAAC,MAA8B,EAAE,IAAoB;IACnF,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,C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A,YAAY,OAAA;AAErB,6BAAmC;AAA1B,iGAAA,UAAU,OAAA;AACnB,qCAAgD;AAAvC,8GAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A small, dependency-free scanner for HTML-style templates (Vue `<template>`
|
|
3
|
+
* blocks and Angular component templates). It flags hardcoded, user-facing text
|
|
4
|
+
* while staying conservative to keep false positives low:
|
|
5
|
+
*
|
|
6
|
+
* - `{{ … }}` interpolation is dynamic and ignored.
|
|
7
|
+
* - Bound attributes (`:title`, `[title]`, `v-bind:title`) are ignored.
|
|
8
|
+
* - Text inside translation components (`<i18n-t>`), Angular `i18n`-marked
|
|
9
|
+
* elements, `translate`/`v-t` directives, and technical/raw elements
|
|
10
|
+
* (`script`, `style`, `code`, `pre`, …) is ignored.
|
|
11
|
+
*
|
|
12
|
+
* This is a pragmatic tokenizer, not a spec-complete HTML parser.
|
|
13
|
+
*/
|
|
14
|
+
import type { Issue } from "@localeguard/core";
|
|
15
|
+
export type TemplateMode = "vue" | "angular";
|
|
16
|
+
export interface ScanOptions {
|
|
17
|
+
mode: TemplateMode;
|
|
18
|
+
fileName: string;
|
|
19
|
+
/** 1-based line of the first character of `source` within the real file. */
|
|
20
|
+
startLine?: number;
|
|
21
|
+
/** Extra element names whose text should be treated as already-translated. */
|
|
22
|
+
translationComponents?: string[];
|
|
23
|
+
}
|
|
24
|
+
export declare function scanTemplate(source: string, options: ScanOptions): Issue[];
|
|
25
|
+
//# sourceMappingURL=scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../src/scanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,SAAS,CAAC;AAE7C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC;AAkCD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,KAAK,EAAE,CAyF1E"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* A small, dependency-free scanner for HTML-style templates (Vue `<template>`
|
|
4
|
+
* blocks and Angular component templates). It flags hardcoded, user-facing text
|
|
5
|
+
* while staying conservative to keep false positives low:
|
|
6
|
+
*
|
|
7
|
+
* - `{{ … }}` interpolation is dynamic and ignored.
|
|
8
|
+
* - Bound attributes (`:title`, `[title]`, `v-bind:title`) are ignored.
|
|
9
|
+
* - Text inside translation components (`<i18n-t>`), Angular `i18n`-marked
|
|
10
|
+
* elements, `translate`/`v-t` directives, and technical/raw elements
|
|
11
|
+
* (`script`, `style`, `code`, `pre`, …) is ignored.
|
|
12
|
+
*
|
|
13
|
+
* This is a pragmatic tokenizer, not a spec-complete HTML parser.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.scanTemplate = scanTemplate;
|
|
17
|
+
const core_1 = require("@localeguard/core");
|
|
18
|
+
const LOCALIZABLE_ATTRS = new Set(["aria-label", "title", "alt", "placeholder"]);
|
|
19
|
+
/** Text inside these elements is technical or raw, never prose. */
|
|
20
|
+
const NON_LOCALIZABLE_ELEMENTS = new Set([
|
|
21
|
+
"script",
|
|
22
|
+
"style",
|
|
23
|
+
"code",
|
|
24
|
+
"pre",
|
|
25
|
+
"kbd",
|
|
26
|
+
"samp",
|
|
27
|
+
"var",
|
|
28
|
+
"textarea",
|
|
29
|
+
]);
|
|
30
|
+
/** Elements parsed as raw text (their contents are not markup). */
|
|
31
|
+
const RAW_TEXT_ELEMENTS = new Set(["script", "style"]);
|
|
32
|
+
const HAS_LETTER = /\p{L}/u;
|
|
33
|
+
const HTML_ENTITY = /&[a-zA-Z]+;|&#\d+;/g;
|
|
34
|
+
const INTERPOLATION = /\{\{[\s\S]*?\}\}/g;
|
|
35
|
+
function scanTemplate(source, options) {
|
|
36
|
+
const issues = [];
|
|
37
|
+
const translationComponents = new Set((options.translationComponents ?? []).map((c) => c.toLowerCase()));
|
|
38
|
+
const stack = [];
|
|
39
|
+
let pos = 0;
|
|
40
|
+
let line = options.startLine ?? 1;
|
|
41
|
+
const advanceTo = (next) => {
|
|
42
|
+
for (let i = pos; i < next; i++) {
|
|
43
|
+
if (source[i] === "\n")
|
|
44
|
+
line += 1;
|
|
45
|
+
}
|
|
46
|
+
pos = next;
|
|
47
|
+
};
|
|
48
|
+
const skipping = () => stack.length > 0 && stack[stack.length - 1].skipText;
|
|
49
|
+
while (pos < source.length) {
|
|
50
|
+
const lt = source.indexOf("<", pos);
|
|
51
|
+
// Trailing text after the last tag.
|
|
52
|
+
if (lt === -1) {
|
|
53
|
+
maybeText(source.slice(pos), line, skipping(), options, issues);
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
if (lt > pos) {
|
|
57
|
+
const text = source.slice(pos, lt);
|
|
58
|
+
maybeText(text, line, skipping(), options, issues);
|
|
59
|
+
advanceTo(lt);
|
|
60
|
+
}
|
|
61
|
+
// Comment.
|
|
62
|
+
if (source.startsWith("<!--", pos)) {
|
|
63
|
+
const end = source.indexOf("-->", pos + 4);
|
|
64
|
+
advanceTo(end === -1 ? source.length : end + 3);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
// Closing tag.
|
|
68
|
+
if (source.startsWith("</", pos)) {
|
|
69
|
+
const gt = source.indexOf(">", pos);
|
|
70
|
+
const name = source.slice(pos + 2, gt === -1 ? source.length : gt).trim().toLowerCase();
|
|
71
|
+
for (let i = stack.length - 1; i >= 0; i--) {
|
|
72
|
+
if (stack[i].name === name) {
|
|
73
|
+
stack.length = i;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
advanceTo(gt === -1 ? source.length : gt + 1);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
// Opening tag (or stray '<').
|
|
81
|
+
const gt = findTagEnd(source, pos);
|
|
82
|
+
if (gt === -1) {
|
|
83
|
+
advanceTo(source.length);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
const raw = source.slice(pos, gt + 1);
|
|
87
|
+
const tagLine = line;
|
|
88
|
+
const parsed = parseTag(raw);
|
|
89
|
+
if (!parsed) {
|
|
90
|
+
advanceTo(gt + 1);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const { name, attrs, selfClosing } = parsed;
|
|
94
|
+
emitAttributeIssues(name, attrs, tagLine, options, issues);
|
|
95
|
+
advanceTo(gt + 1);
|
|
96
|
+
if (RAW_TEXT_ELEMENTS.has(name) && !selfClosing) {
|
|
97
|
+
const close = source.toLowerCase().indexOf(`</${name}`, pos);
|
|
98
|
+
advanceTo(close === -1 ? source.length : close);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (!selfClosing && !isVoidElement(name)) {
|
|
102
|
+
const parentSkip = skipping();
|
|
103
|
+
stack.push({
|
|
104
|
+
name,
|
|
105
|
+
skipText: parentSkip || elementSkipsText(name, attrs, translationComponents, options.mode),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return issues;
|
|
110
|
+
}
|
|
111
|
+
function maybeText(rawText, textLine, skip, options, issues) {
|
|
112
|
+
if (skip)
|
|
113
|
+
return;
|
|
114
|
+
const withoutInterp = rawText.replace(INTERPOLATION, " ");
|
|
115
|
+
const collapsed = withoutInterp.replace(/\s+/g, " ").trim();
|
|
116
|
+
if (collapsed.length === 0)
|
|
117
|
+
return;
|
|
118
|
+
if (!HAS_LETTER.test(collapsed.replace(HTML_ENTITY, "")))
|
|
119
|
+
return;
|
|
120
|
+
// Line of the first non-whitespace character of the (original) text.
|
|
121
|
+
const leading = rawText.length - rawText.replace(/^\s+/, "").length;
|
|
122
|
+
const line = textLine + countNewlines(rawText.slice(0, leading));
|
|
123
|
+
issues.push({
|
|
124
|
+
type: "hardcoded-string",
|
|
125
|
+
severity: core_1.SEVERITY_BY_TYPE["hardcoded-string"],
|
|
126
|
+
file: options.fileName,
|
|
127
|
+
line,
|
|
128
|
+
message: `Hardcoded template text: ${quote(collapsed)}`,
|
|
129
|
+
suggestion: "Move user-facing text into a translation message.",
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function emitAttributeIssues(name, attrs, tagLine, options, issues) {
|
|
133
|
+
const attrNames = new Set(attrs.map((a) => a.name.toLowerCase()));
|
|
134
|
+
for (const attr of attrs) {
|
|
135
|
+
const lower = attr.name.toLowerCase();
|
|
136
|
+
if (isBoundAttr(lower))
|
|
137
|
+
continue;
|
|
138
|
+
if (!LOCALIZABLE_ATTRS.has(lower))
|
|
139
|
+
continue;
|
|
140
|
+
if (attr.value === undefined || !HAS_LETTER.test(attr.value))
|
|
141
|
+
continue;
|
|
142
|
+
// Angular: i18n-<attr> marks the attribute as translatable.
|
|
143
|
+
if (options.mode === "angular" && attrNames.has(`i18n-${lower}`))
|
|
144
|
+
continue;
|
|
145
|
+
issues.push({
|
|
146
|
+
type: "hardcoded-attribute",
|
|
147
|
+
severity: core_1.SEVERITY_BY_TYPE["hardcoded-attribute"],
|
|
148
|
+
file: options.fileName,
|
|
149
|
+
line: tagLine,
|
|
150
|
+
message: `Hardcoded ${lower} value: ${quote(attr.value)}`,
|
|
151
|
+
suggestion: `Localize the ${lower} attribute.`,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function elementSkipsText(name, attrs, translationComponents, mode) {
|
|
156
|
+
if (NON_LOCALIZABLE_ELEMENTS.has(name))
|
|
157
|
+
return true;
|
|
158
|
+
if (translationComponents.has(name))
|
|
159
|
+
return true;
|
|
160
|
+
const attrNames = new Set(attrs.map((a) => a.name.toLowerCase()));
|
|
161
|
+
if (mode === "vue") {
|
|
162
|
+
if (attrNames.has("v-t") || attrNames.has("v-text") || attrNames.has("v-html"))
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
// Angular: a bare `i18n` attribute marks the element's text as translatable;
|
|
167
|
+
// `translate` is the ngx-translate directive; innerHTML/textContent bindings
|
|
168
|
+
// replace the text dynamically.
|
|
169
|
+
if (attrNames.has("i18n") || attrNames.has("translate"))
|
|
170
|
+
return true;
|
|
171
|
+
if (attrNames.has("[innerhtml]") || attrNames.has("[textcontent]"))
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
function isBoundAttr(name) {
|
|
177
|
+
return (name.startsWith(":") ||
|
|
178
|
+
name.startsWith("@") ||
|
|
179
|
+
name.startsWith("[") ||
|
|
180
|
+
name.startsWith("(") ||
|
|
181
|
+
name.startsWith("*") ||
|
|
182
|
+
name.startsWith("#") ||
|
|
183
|
+
name.startsWith("v-bind:") ||
|
|
184
|
+
name.startsWith("v-on:") ||
|
|
185
|
+
name.startsWith("bind-") ||
|
|
186
|
+
name.startsWith("on-"));
|
|
187
|
+
}
|
|
188
|
+
function parseTag(raw) {
|
|
189
|
+
// raw includes the surrounding < … >
|
|
190
|
+
const inner = raw.slice(1, raw.endsWith("/>") ? -2 : -1).trim();
|
|
191
|
+
const selfClosing = raw.endsWith("/>");
|
|
192
|
+
const nameMatch = /^[a-zA-Z][\w.-]*/.exec(inner);
|
|
193
|
+
if (!nameMatch)
|
|
194
|
+
return null;
|
|
195
|
+
const name = nameMatch[0].toLowerCase();
|
|
196
|
+
const attrs = parseAttributes(inner.slice(nameMatch[0].length));
|
|
197
|
+
return { name, attrs, selfClosing };
|
|
198
|
+
}
|
|
199
|
+
function parseAttributes(text) {
|
|
200
|
+
const attrs = [];
|
|
201
|
+
// Attribute names in Vue/Angular can include : @ [ ] ( ) * # . - _ and letters.
|
|
202
|
+
const re = /([:@#[\]()*.\w-]+)(\s*=\s*("([^"]*)"|'([^']*)'|(\S+)))?/g;
|
|
203
|
+
let m;
|
|
204
|
+
while ((m = re.exec(text)) !== null) {
|
|
205
|
+
if (!m[1])
|
|
206
|
+
continue;
|
|
207
|
+
const value = m[4] ?? m[5] ?? m[6];
|
|
208
|
+
attrs.push({ name: m[1], value });
|
|
209
|
+
}
|
|
210
|
+
return attrs;
|
|
211
|
+
}
|
|
212
|
+
function findTagEnd(source, start) {
|
|
213
|
+
// Find the '>' that closes this tag, skipping any inside quoted attribute values.
|
|
214
|
+
let quoteCh = null;
|
|
215
|
+
for (let i = start + 1; i < source.length; i++) {
|
|
216
|
+
const ch = source[i];
|
|
217
|
+
if (quoteCh) {
|
|
218
|
+
if (ch === quoteCh)
|
|
219
|
+
quoteCh = null;
|
|
220
|
+
}
|
|
221
|
+
else if (ch === '"' || ch === "'") {
|
|
222
|
+
quoteCh = ch;
|
|
223
|
+
}
|
|
224
|
+
else if (ch === ">") {
|
|
225
|
+
return i;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return -1;
|
|
229
|
+
}
|
|
230
|
+
const VOID_ELEMENTS = new Set([
|
|
231
|
+
"area", "base", "br", "col", "embed", "hr", "img", "input",
|
|
232
|
+
"link", "meta", "param", "source", "track", "wbr",
|
|
233
|
+
]);
|
|
234
|
+
function isVoidElement(name) {
|
|
235
|
+
return VOID_ELEMENTS.has(name);
|
|
236
|
+
}
|
|
237
|
+
function countNewlines(text) {
|
|
238
|
+
let count = 0;
|
|
239
|
+
for (let i = 0; i < text.length; i++) {
|
|
240
|
+
if (text[i] === "\n")
|
|
241
|
+
count += 1;
|
|
242
|
+
}
|
|
243
|
+
return count;
|
|
244
|
+
}
|
|
245
|
+
function quote(value) {
|
|
246
|
+
const max = 50;
|
|
247
|
+
const truncated = value.length > max ? `${value.slice(0, max - 1)}…` : value;
|
|
248
|
+
return JSON.stringify(truncated);
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../src/scanner.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAgDH,oCAyFC;AAvID,4CAAqD;AAcrD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;AAEjF,mEAAmE;AACnE,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC;IACvC,QAAQ;IACR,OAAO;IACP,MAAM;IACN,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,UAAU;CACX,CAAC,CAAC;AAEH,mEAAmE;AACnE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvD,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAC1C,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAa1C,SAAgB,YAAY,CAAC,MAAc,EAAE,OAAoB;IAC/D,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,MAAM,qBAAqB,GAAG,IAAI,GAAG,CACnC,CAAC,OAAO,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAClE,CAAC;IACF,MAAM,KAAK,GAAiB,EAAE,CAAC;IAC/B,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,IAAI,GAAG,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC;IAElC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAQ,EAAE;QACvC,KAAK,IAAI,CAAC,GAAG,GAAG,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C;AAED,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO;IAC1D,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK;CAClD,CAAC,CAAC;AAEH,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI;YAAE,KAAK,IAAI,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,KAAK,CAAC,KAAa;IAC1B,MAAM,GAAG,GAAG,EAAE,CAAC;IACf,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;IAC7E,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue Single File Components: extract the top-level `<template>` block and scan
|
|
3
|
+
* it. Line numbers are offset back to the position in the `.vue` file.
|
|
4
|
+
*/
|
|
5
|
+
import type { Issue } from "@localeguard/core";
|
|
6
|
+
export declare function scanVueSfc(source: string, fileName: string, translationComponents?: string[]): Issue[];
|
|
7
|
+
//# sourceMappingURL=vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../src/vue.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,qBAAqB,CAAC,EAAE,MAAM,EAAE,GAC/B,KAAK,EAAE,CAST"}
|
package/dist/src/vue.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Vue Single File Components: extract the top-level `<template>` block and scan
|
|
4
|
+
* it. Line numbers are offset back to the position in the `.vue` file.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.scanVueSfc = scanVueSfc;
|
|
8
|
+
const scanner_1 = require("./scanner");
|
|
9
|
+
function scanVueSfc(source, fileName, translationComponents) {
|
|
10
|
+
const block = extractTemplateBlock(source);
|
|
11
|
+
if (!block)
|
|
12
|
+
return [];
|
|
13
|
+
return (0, scanner_1.scanTemplate)(block.content, {
|
|
14
|
+
mode: "vue",
|
|
15
|
+
fileName,
|
|
16
|
+
startLine: block.startLine,
|
|
17
|
+
translationComponents,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function extractTemplateBlock(source) {
|
|
21
|
+
const open = /<template(\s[^>]*)?>/i.exec(source);
|
|
22
|
+
if (!open)
|
|
23
|
+
return null;
|
|
24
|
+
const contentStart = open.index + open[0].length;
|
|
25
|
+
// The root <template> closes at the last </template> (later ones may be
|
|
26
|
+
// nested `<template #slot>` / `<template v-if>` elements).
|
|
27
|
+
const closeIdx = source.toLowerCase().lastIndexOf("</template>");
|
|
28
|
+
if (closeIdx === -1 || closeIdx < contentStart)
|
|
29
|
+
return null;
|
|
30
|
+
const content = source.slice(contentStart, closeIdx);
|
|
31
|
+
const startLine = source.slice(0, contentStart).split("\n").length;
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CAAC;AAChC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@localeguard/template-analyzer",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Detect hardcoded text in Vue (.vue) and Angular (.html) templates for LocaleGuard.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "isamrish",
|
|
7
|
+
"homepage": "https://github.com/isamrish/localeguard/tree/main/packages/template-analyzer#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/isamrish/localeguard.git",
|
|
11
|
+
"directory": "packages/template-analyzer"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/isamrish/localeguard/issues"
|
|
15
|
+
},
|
|
16
|
+
"main": "dist/src/index.js",
|
|
17
|
+
"types": "dist/src/index.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/src"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=18"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"prepublishOnly": "tsc -b"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@localeguard/core": "0.3.0"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"localization",
|
|
35
|
+
"i18n",
|
|
36
|
+
"vue",
|
|
37
|
+
"angular",
|
|
38
|
+
"template",
|
|
39
|
+
"static-analysis"
|
|
40
|
+
]
|
|
41
|
+
}
|