@wuchale/jsx 0.6.3 → 0.7.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/dist/index.js +1 -1
- package/dist/transformer.d.ts +2 -2
- package/dist/transformer.js +7 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { defaultGenerateLoadID, defaultHeuristic, deepMergeObjects } from 'wucha
|
|
|
2
2
|
import { adapter as vanillaAdapter } from 'wuchale/adapter-vanilla';
|
|
3
3
|
import { JSXTransformer } from "./transformer.js";
|
|
4
4
|
import { getDependencies, loaderPathResolver } from 'wuchale/adapter-utils';
|
|
5
|
-
const ignoreElements = ['style', 'path'];
|
|
5
|
+
const ignoreElements = ['style', 'path', 'code', 'pre'];
|
|
6
6
|
const jsxHeuristic = (msgStr, details) => {
|
|
7
7
|
if (!defaultHeuristic(msgStr, details)) {
|
|
8
8
|
return false;
|
package/dist/transformer.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { Message } from 'wuchale';
|
|
|
2
2
|
import type * as JX from 'estree-jsx';
|
|
3
3
|
import type * as Estree from 'acorn';
|
|
4
4
|
import { Transformer } from 'wuchale/adapter-vanilla';
|
|
5
|
-
import type { IndexTracker, HeuristicFunc, TransformOutput,
|
|
6
|
-
import { MixedVisitor } from "wuchale/adapter-utils";
|
|
5
|
+
import type { IndexTracker, HeuristicFunc, TransformOutput, RuntimeConf, CatalogExpr } from 'wuchale';
|
|
6
|
+
import { MixedVisitor, type CommentDirectives } from "wuchale/adapter-utils";
|
|
7
7
|
export declare function parseScript(content: string): [Estree.Program, Estree.Comment[][]];
|
|
8
8
|
type MixedNodesTypes = JX.JSXElement | JX.JSXFragment | JX.JSXText | JX.JSXExpressionContainer | JX.JSXSpreadChild;
|
|
9
9
|
export type JSXLib = 'default' | 'solidjs';
|
package/dist/transformer.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Message } from 'wuchale';
|
|
|
4
4
|
import { tsPlugin } from '@sveltejs/acorn-typescript';
|
|
5
5
|
import jsx from 'acorn-jsx';
|
|
6
6
|
import { Transformer, scriptParseOptionsWithComments } from 'wuchale/adapter-vanilla';
|
|
7
|
-
import { nonWhitespaceText, MixedVisitor } from "wuchale/adapter-utils";
|
|
7
|
+
import { nonWhitespaceText, MixedVisitor, processCommentDirectives } from "wuchale/adapter-utils";
|
|
8
8
|
const JsxParser = Parser.extend(tsPlugin(), jsx());
|
|
9
9
|
export function parseScript(content) {
|
|
10
10
|
const [opts, comments] = scriptParseOptionsWithComments();
|
|
@@ -183,12 +183,12 @@ export class JSXTransformer extends Transformer {
|
|
|
183
183
|
if (!commentContents) {
|
|
184
184
|
return [];
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
this.commentDirectives = processCommentDirectives(commentContents, this.commentDirectives);
|
|
187
187
|
if (this.lastVisitIsComment) {
|
|
188
|
-
this.commentDirectivesStack[this.commentDirectivesStack.length - 1] =
|
|
188
|
+
this.commentDirectivesStack[this.commentDirectivesStack.length - 1] = this.commentDirectives;
|
|
189
189
|
}
|
|
190
190
|
else {
|
|
191
|
-
this.commentDirectivesStack.push(
|
|
191
|
+
this.commentDirectivesStack.push(this.commentDirectives);
|
|
192
192
|
}
|
|
193
193
|
this.lastVisitIsComment = true;
|
|
194
194
|
return [];
|
|
@@ -206,6 +206,9 @@ export class JSXTransformer extends Transformer {
|
|
|
206
206
|
this.commentDirectives = this.commentDirectivesStack.pop();
|
|
207
207
|
this.lastVisitIsComment = false;
|
|
208
208
|
}
|
|
209
|
+
if (this.commentDirectives.ignoreFile) {
|
|
210
|
+
return [];
|
|
211
|
+
}
|
|
209
212
|
if (this.commentDirectives.forceInclude !== false) {
|
|
210
213
|
msgs = this.visit(node);
|
|
211
214
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wuchale/jsx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Protobuf-like i18n from plain code: JSX adapter",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "tsc --watch",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@sveltejs/acorn-typescript": "^1.0.5",
|
|
73
73
|
"acorn": "^8.15.0",
|
|
74
74
|
"acorn-jsx": "^5.3.2",
|
|
75
|
-
"wuchale": "^0.
|
|
75
|
+
"wuchale": "^0.16.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@types/estree-jsx": "^1.0.5",
|