ui-strings 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/cli.js +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,6 +92,15 @@ bun run typecheck
|
|
|
92
92
|
bun run build # bundle dist/cli.js
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
To try a local build in another React project without publishing:
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
bun run build
|
|
99
|
+
npm link
|
|
100
|
+
# In another React project
|
|
101
|
+
ui-strings scan
|
|
102
|
+
```
|
|
103
|
+
|
|
95
104
|
## Contributing
|
|
96
105
|
|
|
97
106
|
Issues and pull requests are welcome.
|
package/dist/cli.js
CHANGED
|
@@ -77,7 +77,8 @@ var TECHNICAL_KEYS = new Set([
|
|
|
77
77
|
"slug",
|
|
78
78
|
"locale",
|
|
79
79
|
"format",
|
|
80
|
-
"testId"
|
|
80
|
+
"testId",
|
|
81
|
+
"__html"
|
|
81
82
|
]);
|
|
82
83
|
var CLASSNAME_CALLEES = new Set([
|
|
83
84
|
"cn",
|
|
@@ -203,6 +204,7 @@ var INLINE_TAGS = new Set([
|
|
|
203
204
|
"rt"
|
|
204
205
|
]);
|
|
205
206
|
var BREAK_TAGS = new Set(["br", "wbr"]);
|
|
207
|
+
var RAW_TEXT_TAGS = new Set(["script", "style"]);
|
|
206
208
|
var INTERACTIVE_KEY_PATTERN = /^(message|error|success|warning|status)|(message|error)$/i;
|
|
207
209
|
var INTERACTIVE_FILE_PATTERN = /(^|\/)(actions|route)\.tsx?$/;
|
|
208
210
|
var collapseWhitespace = (text) => text.replace(/\s+/g, " ").trim();
|
|
@@ -586,6 +588,13 @@ var scanProject = (options) => {
|
|
|
586
588
|
return;
|
|
587
589
|
}
|
|
588
590
|
if (Node.isJsxElement(node) || Node.isJsxFragment(node)) {
|
|
591
|
+
const tag = tagNameOf(node);
|
|
592
|
+
if (tag !== undefined && RAW_TEXT_TAGS.has(tag)) {
|
|
593
|
+
node.forEachDescendant((descendant) => {
|
|
594
|
+
consumed.add(nodeKey(descendant));
|
|
595
|
+
});
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
589
598
|
const runs = mergeRuns(node, detector.hasCopyText);
|
|
590
599
|
const coversAll = runs.length === 1 && runs[0]?.nodes.length === node.getJsxChildren().length;
|
|
591
600
|
for (const run of runs) {
|