prettier-plugin-embed 0.2.0 → 0.2.1

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.bak CHANGED
@@ -109,7 +109,7 @@ Click Here
109
109
  | :-----------------------: | :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------- |
110
110
  | `embeddedNoopIdentifiers` | `[]` | Tag or comment identifiers that prevent their subsequent template literals from being identified as embedded languages and from being formatted |
111
111
 
112
- This doesn't require other plugins and can override the native embedded language formatting for ECMAScript code. It serves as a way to turn off embedded language formatting for specific language identifiers.
112
+ This doesn't require other plugins and can override the native embedded language formatting. It serves as a way to turn off embedded language formatting for specific language identifiers.
113
113
 
114
114
  #### CSS
115
115
 
package/README.md CHANGED
@@ -108,7 +108,7 @@ Click Here
108
108
  | :-----------------------: | :-----: | ----------------------------------------------------------------------------------------------------------------------------------------------- |
109
109
  | `embeddedNoopIdentifiers` | `[]` | Tag or comment identifiers that prevent their subsequent template literals from being identified as embedded languages and from being formatted |
110
110
 
111
- This doesn't require other plugins and can override the native embedded language formatting for ECMAScript code. It serves as a way to turn off embedded language formatting for specific language identifiers.
111
+ This doesn't require other plugins and can override the native embedded language formatting. It serves as a way to turn off embedded language formatting for specific language identifiers.
112
112
 
113
113
  #### CSS
114
114
 
@@ -3,7 +3,7 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
3
3
  * - https://github.com/microsoft/vscode/blob/de0121cf0e05d1673903551b6dbb2871556bfae9/extensions/javascript/package.json#L37
4
4
  * - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L3314
5
5
  */
6
- declare const DEFAULT_IDENTIFIERS: readonly ["js", "es", "es6", "mjs", "cjs", "pac", "javascript"];
6
+ declare const DEFAULT_IDENTIFIERS: readonly ["js", "jsx", "es", "es6", "mjs", "cjs", "pac", "javascript"];
7
7
  type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
8
8
  type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
9
9
  declare const DEFAULT_ES_PARSERS: readonly ["babel", "babel-flow", "acorn", "espree", "flow", "meriyah"];
@@ -18,7 +18,7 @@ export declare const options: {
18
18
  type: "string";
19
19
  array: true;
20
20
  default: {
21
- value: ("js" | "es" | "es6" | "mjs" | "cjs" | "pac" | "javascript")[];
21
+ value: ("js" | "jsx" | "es" | "es6" | "mjs" | "cjs" | "pac" | "javascript")[];
22
22
  }[];
23
23
  description: string;
24
24
  };
@@ -3,7 +3,7 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../u
3
3
  * - https://github.com/microsoft/vscode/blob/de0121cf0e05d1673903551b6dbb2871556bfae9/extensions/typescript-basics/package.json#L24
4
4
  * - https://github.com/github-linguist/linguist/blob/7ca3799b8b5f1acde1dd7a8dfb7ae849d3dfb4cd/lib/linguist/languages.yml#L7158
5
5
  */
6
- declare const DEFAULT_IDENTIFIERS: readonly ["ts", "cts", "mts", "typescript"];
6
+ declare const DEFAULT_IDENTIFIERS: readonly ["ts", "tsx", "cts", "mts", "typescript"];
7
7
  type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
8
8
  type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
9
9
  declare const DEFAULT_TS_PARSERS: readonly ["typescript", "babel-ts"];
@@ -18,7 +18,7 @@ export declare const options: {
18
18
  type: "string";
19
19
  array: true;
20
20
  default: {
21
- value: ("ts" | "cts" | "mts" | "typescript")[];
21
+ value: ("ts" | "tsx" | "cts" | "mts" | "typescript")[];
22
22
  }[];
23
23
  description: string;
24
24
  };
package/dist/index.js CHANGED
@@ -352,6 +352,7 @@ const { line: pe, group: B, indent: he, softline: ge } = k, Et = async (e, n, r,
352
352
  }
353
353
  }, Lt = [
354
354
  "js",
355
+ "jsx",
355
356
  "es",
356
357
  "es6",
357
358
  "mjs",
@@ -898,7 +899,10 @@ const In = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
898
899
  const { node: u } = r, { createPlaceholder: $, placeholderRegex: S } = j(), i = u.quasis.map(
899
900
  (a, c, { length: I }) => c === I - 1 ? a.value.cooked : a.value.cooked + $(c)
900
901
  ).join(""), _ = ((o = i.match(/^\s+/)) == null ? void 0 : o[0]) ?? "", b = ((h = i.match(/\s+$/)) == null ? void 0 : h[0]) ?? "", v = M(r, n), L = await e(i, {
901
- parser: t.embeddedTsParser ?? "typescript"
902
+ parser: t.embeddedTsParser ?? "typescript",
903
+ // set filepath to undefined to enable jsx auto detection:
904
+ // https://github.com/prettier/prettier/blob/427a84d24203e2d54160cde153a1e6a6390fe65a/src/language-js/parse/typescript.js#L49-L53
905
+ filepath: void 0
902
906
  }), m = q(
903
907
  L,
904
908
  S,
@@ -922,7 +926,7 @@ const In = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
922
926
  } catch (u) {
923
927
  throw console.error(u), u;
924
928
  }
925
- }, xn = ["ts", "cts", "mts", "typescript"], $n = "embeddedTsParser", vn = R(Ke), wn = {
929
+ }, xn = ["ts", "tsx", "cts", "mts", "typescript"], $n = "embeddedTsParser", vn = R(Ke), wn = {
926
930
  [vn]: {
927
931
  category: "Global",
928
932
  type: "string",
package/dist/options.d.ts CHANGED
@@ -64,7 +64,7 @@ export declare const options: {
64
64
  type: "string";
65
65
  array: true;
66
66
  default: {
67
- value: ("js" | "es" | "es6" | "mjs" | "cjs" | "pac" | "javascript")[];
67
+ value: ("js" | "jsx" | "es" | "es6" | "mjs" | "cjs" | "pac" | "javascript")[];
68
68
  }[];
69
69
  description: string;
70
70
  };
@@ -141,7 +141,7 @@ export declare const options: {
141
141
  type: "string";
142
142
  array: true;
143
143
  default: {
144
- value: ("ts" | "cts" | "mts" | "typescript")[];
144
+ value: ("ts" | "tsx" | "cts" | "mts" | "typescript")[];
145
145
  }[];
146
146
  description: string;
147
147
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "prettier-plugin-embed",
3
3
  "description": "A configurable Prettier plugin to format embedded languages in js/ts files.",
4
4
  "private": false,
5
- "version": "0.2.0",
5
+ "version": "0.2.1",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "./dist"
@@ -61,17 +61,17 @@
61
61
  "postncu": "npm i"
62
62
  },
63
63
  "devDependencies": {
64
- "@commitlint/cli": "^18.0.0",
65
- "@commitlint/config-conventional": "^18.0.0",
64
+ "@commitlint/cli": "^18.1.0",
65
+ "@commitlint/config-conventional": "^18.1.0",
66
66
  "@semantic-release/git": "^10.0.1",
67
67
  "@types/estree": "^1.0.3",
68
- "@typescript-eslint/eslint-plugin": "^6.8.0",
69
- "@typescript-eslint/parser": "^6.8.0",
68
+ "@typescript-eslint/eslint-plugin": "^6.9.0",
69
+ "@typescript-eslint/parser": "^6.9.0",
70
70
  "@vitest/browser": "^0.34.6",
71
71
  "@vitest/coverage-istanbul": "^0.34.6",
72
72
  "@vitest/ui": "^0.34.6",
73
73
  "code-tag": "^1.1.0",
74
- "eslint": "^8.51.0",
74
+ "eslint": "^8.52.0",
75
75
  "fast-glob": "^3.3.1",
76
76
  "npm-check-updates": "^16.14.6",
77
77
  "playwright": "^1.39.0",