@wuchale/jsx 0.9.4 → 0.9.6

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.d.ts CHANGED
@@ -3,7 +3,7 @@ import { type JSXLib } from "./transformer.js";
3
3
  export declare function createJsxHeuristic(opts: CreateHeuristicOpts): HeuristicFunc;
4
4
  export declare const jsxDefaultHeuristic: HeuristicFunc;
5
5
  type LoadersAvailable = 'default' | 'react' | 'solidjs';
6
- type JSXArgs = AdapterArgs<LoadersAvailable> & {
6
+ export type JSXArgs = AdapterArgs<LoadersAvailable> & {
7
7
  variant?: JSXLib;
8
8
  };
9
9
  export declare function getDefaultLoaderPath(loader: LoaderChoice<LoadersAvailable>, bundle: boolean): string | {
package/dist/index.js CHANGED
@@ -88,6 +88,9 @@ export const adapter = (args = defaultArgs) => {
88
88
  loaderExts: ['.js', '.ts'],
89
89
  defaultLoaderPath: getDefaultLoaderPath(loader, rest.bundleLoad),
90
90
  runtime,
91
+ getRuntimeVars: {
92
+ reactive: 'useW_load_rx_'
93
+ },
91
94
  ...rest,
92
95
  };
93
96
  };
@@ -26,14 +26,11 @@ export class JSXTransformer extends Transformer {
26
26
  mstr: this.mstr,
27
27
  vars: this.vars,
28
28
  getRange: node => ({
29
- // @ts-expect-error
30
29
  start: node.start,
31
- // @ts-expect-error
32
30
  end: node.end
33
31
  }),
34
32
  isComment: node => node.type === 'JSXExpressionContainer'
35
33
  && node.expression.type === 'JSXEmptyExpression'
36
- // @ts-expect-error
37
34
  && node.expression.end > node.expression.start,
38
35
  isText: node => node.type === 'JSXText',
39
36
  leaveInPlace: () => false,
@@ -111,9 +108,7 @@ export class JSXTransformer extends Transformer {
111
108
  if (this.inCompoundText && this.currentJsxKey != null) {
112
109
  const key = node.openingElement.attributes.find(attr => attr.type === 'JSXAttribute' && attr.name.name === 'key');
113
110
  if (!key) {
114
- this.mstr.appendLeft(
115
- // @ts-expect-error
116
- node.openingElement.name.end, ` key="_${this.currentJsxKey}"`);
111
+ this.mstr.appendLeft(node.openingElement.name.end, ` key="_${this.currentJsxKey}"`);
117
112
  this.currentJsxKey++;
118
113
  }
119
114
  }
@@ -129,16 +124,11 @@ export class JSXTransformer extends Transformer {
129
124
  if (!pass) {
130
125
  return [];
131
126
  }
132
- this.mstr.update(
133
- // @ts-expect-error
134
- node.start + startWh,
135
- // @ts-expect-error
136
- node.end - endWh, `{${this.vars().rtTrans}(${this.index.get(msgInfo.toKey())})}`);
127
+ this.mstr.update(node.start + startWh, node.end - endWh, `{${this.vars().rtTrans}(${this.index.get(msgInfo.toKey())})}`);
137
128
  return [msgInfo];
138
129
  };
139
130
  visitJSXFragment = (node) => this.visitChildrenJ(node);
140
131
  getMarkupCommentBody = (node) => {
141
- // @ts-expect-error
142
132
  const comment = this.content.slice(node.start, node.end).trim();
143
133
  if (!comment) {
144
134
  return '';
@@ -185,11 +175,7 @@ export class JSXTransformer extends Transformer {
185
175
  if (!pass) {
186
176
  return [];
187
177
  }
188
- this.mstr.update(
189
- // @ts-expect-error
190
- value.start,
191
- // @ts-expect-error
192
- value.end, `{${this.vars().rtTrans}(${this.index.get(msgInfo.toKey())})}`);
178
+ this.mstr.update(value.start, value.end, `{${this.vars().rtTrans}(${this.index.get(msgInfo.toKey())})}`);
193
179
  return [msgInfo];
194
180
  };
195
181
  visitJSXSpreadAttribute = (node) => this.visit(node.argument);
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@wuchale/jsx",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "Protobuf-like i18n from plain code: JSX adapter",
5
5
  "scripts": {
6
6
  "dev": "tsc --watch",
7
7
  "build": "tsc",
8
- "test": "node tests"
8
+ "test": "node tests/index.ts"
9
9
  },
10
10
  "keywords": [
11
11
  "i18n",
@@ -69,9 +69,9 @@
69
69
  }
70
70
  },
71
71
  "dependencies": {
72
- "@sveltejs/acorn-typescript": "^1.0.6",
72
+ "@sveltejs/acorn-typescript": "^1.0.7",
73
73
  "acorn": "^8.15.0",
74
- "wuchale": "^0.18.3"
74
+ "wuchale": "^0.18.6"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@types/estree-jsx": "^1.0.5",