@wuchale/jsx 0.6.2 → 0.6.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defaultGenerateLoadID, defaultHeuristic, deepMergeObjects } from 'wuchale';
2
2
  import { adapter as vanillaAdapter } from 'wuchale/adapter-vanilla';
3
3
  import { JSXTransformer } from "./transformer.js";
4
- import { getDependencies } from 'wuchale/adapter-utils';
4
+ import { getDependencies, loaderPathResolver } from 'wuchale/adapter-utils';
5
5
  const ignoreElements = ['style', 'path'];
6
6
  const jsxHeuristic = (msgStr, details) => {
7
7
  if (!defaultHeuristic(msgStr, details)) {
@@ -65,6 +65,7 @@ const defaultArgs = {
65
65
  runtime: defaultRuntime,
66
66
  variant: 'default',
67
67
  };
68
+ const resolveLoaderPath = loaderPathResolver(import.meta.url, '../src/loaders', 'js');
68
69
  export const adapter = (args = defaultArgs) => {
69
70
  let { heuristic, pluralsFunc, variant, runtime, ...rest } = deepMergeObjects(args, defaultArgs);
70
71
  if (variant === 'solidjs' && args.runtime == null) {
@@ -93,7 +94,7 @@ export const adapter = (args = defaultArgs) => {
93
94
  if (rest.bundleLoad) {
94
95
  loader += '.bundle';
95
96
  }
96
- return new URL(`../src/loaders/${loader}.js`, import.meta.url).pathname;
97
+ return resolveLoaderPath(loader);
97
98
  },
98
99
  runtime,
99
100
  ...rest,
@@ -12,7 +12,7 @@ export declare class JSXTransformer extends Transformer {
12
12
  inCompoundText: boolean;
13
13
  commentDirectivesStack: CommentDirectives[];
14
14
  lastVisitIsComment: boolean;
15
- currentElementI: number;
15
+ currentJsxKey: number;
16
16
  mixedVisitor: MixedVisitor<MixedNodesTypes>;
17
17
  constructor(content: string, filename: string, index: IndexTracker, heuristic: HeuristicFunc, pluralsFunc: string, catalogExpr: CatalogExpr, rtConf: RuntimeConf);
18
18
  initMixedVisitor: () => MixedVisitor<MixedNodesTypes>;
@@ -18,7 +18,7 @@ export class JSXTransformer extends Transformer {
18
18
  inCompoundText = false;
19
19
  commentDirectivesStack = [];
20
20
  lastVisitIsComment = false;
21
- currentElementI = 0;
21
+ currentJsxKey = 0;
22
22
  mixedVisitor;
23
23
  constructor(content, filename, index, heuristic, pluralsFunc, catalogExpr, rtConf) {
24
24
  super(content, filename, index, heuristic, pluralsFunc, catalogExpr, rtConf);
@@ -110,7 +110,8 @@ export class JSXTransformer extends Transformer {
110
110
  if (this.inCompoundText) {
111
111
  this.mstr.appendLeft(
112
112
  // @ts-expect-error
113
- node.openingElement.name.end, ` key="_${this.currentElementI}"`);
113
+ node.openingElement.name.end, ` key="_${this.currentJsxKey}"`);
114
+ this.currentJsxKey++;
114
115
  }
115
116
  this.currentElement = currentElement;
116
117
  return msgs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wuchale/jsx",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
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.15.4"
75
+ "wuchale": "^0.15.8"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@types/estree-jsx": "^1.0.5",