prettier-plugin-embed 0.3.0-rc.0 → 0.3.0-rc.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/dist/options.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { PrettierPluginEmbedOptions, EmbeddedDefaultIdentifier, AutocompleteStringList } from "./embedded/index.js";
1
+ import { type AutocompleteStringList, type EmbeddedDefaultIdentifier, type PrettierPluginEmbedOptions } from "./embedded/index.js";
2
2
  type EmbeddedIdentifiers = AutocompleteStringList<EmbeddedDefaultIdentifier[]>;
3
3
  declare const NO_EMBEDDED_IDENTIFICATION_BY_COMMENT = "noEmbeddedIdentificationByComment";
4
4
  declare const NO_EMBEDDED_IDENTIFICATION_BY_TAG = "noEmbeddedIdentificationByTag";
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { Options, Doc, AstPath } from "prettier";
2
- import type { Node as EsTreeNode, TemplateLiteral, Comment } from "estree";
3
- import { type EmbeddedDefaultIdentifier, type AutocompleteStringList, type PrettierPluginEmbedOptions, makeIdentifiersOptionName, EmbeddedLanguage } from "./embedded/index.js";
1
+ import type { Comment, Node as EsTreeNode, TemplateLiteral } from "estree";
2
+ import type { AstPath, Doc, Options } from "prettier";
3
+ import { makeIdentifiersOptionName, type AutocompleteStringList, type EmbeddedDefaultIdentifier, type EmbeddedLanguage, type PrettierPluginEmbedOptions } from "./embedded/index.js";
4
4
  import type { PrettierPluginGlobalOptions } from "./options.js";
5
5
  export type PrettierNode = EsTreeNode & {
6
6
  comments?: (Comment & {
@@ -10,7 +10,12 @@ export type PrettierNode = EsTreeNode & {
10
10
  })[];
11
11
  };
12
12
  export type InternalPrintFun = (selector?: string | number | (string | number)[] | AstPath<TemplateLiteral>) => Doc;
13
- export type Embedder<T extends Options = Options> = (textToDoc: (text: string, options: T) => Promise<Doc>, print: InternalPrintFun, path: AstPath<TemplateLiteral>, options: T, identifier: string, identifiers: string[]) => Promise<Doc>;
13
+ export interface EmbedderPayload {
14
+ identifier: string;
15
+ identifiers: string[];
16
+ embeddedOverrideOptions: EmbeddedOverride["options"] | undefined;
17
+ }
18
+ export type Embedder<T extends Options = Options> = (textToDoc: (text: string, options: T) => Promise<Doc>, print: InternalPrintFun, path: AstPath<TemplateLiteral>, options: T, embedderPayload: EmbedderPayload) => Promise<Doc>;
14
19
  export interface EmbeddedOverride {
15
20
  identifiers: AutocompleteStringList<EmbeddedDefaultIdentifier[]>;
16
21
  options: Omit<Omit<Options, keyof PrettierPluginEmbedOptions> & Omit<PrettierPluginEmbedOptions, keyof PrettierPluginGlobalOptions | ReturnType<typeof makeIdentifiersOptionName<EmbeddedLanguage>>>, "printWidth" | "endOfLine" | "useTabs" | "tabWidth" | "parser" | "filepath" | "embeddedLanguageFormatting" | `__${string}`>;
@@ -0,0 +1,5 @@
1
+ import { type AstPath } from "prettier";
2
+ import type { PrettierNode } from "./types.js";
3
+ export declare const resolveEmbeddedOverrideOptions: (embeddedOverridesString: string | undefined, identifier: string, sourceFilePath?: string) => Promise<Omit<Omit<import("prettier").Options, keyof import("./index.js").PrettierPluginEmbedOptions> & Omit<import("./index.js").PrettierPluginEmbedOptions, "embeddedNoopIdentifiers" | "embeddedCssIdentifiers" | "embeddedEsIdentifiers" | "embeddedGlslIdentifiers" | "embeddedHtmlIdentifiers" | "embeddedMarkdownIdentifiers" | "embeddedPhpIdentifiers" | "embeddedRubyIdentifiers" | "embeddedSqlIdentifiers" | "embeddedTsIdentifiers" | "embeddedXmlIdentifiers" | keyof import("./options.js").PrettierPluginGlobalOptions>, "parser" | "filepath" | "endOfLine" | "embeddedLanguageFormatting" | "printWidth" | "tabWidth" | "useTabs" | `__${string}`> | undefined>;
4
+ export declare function getIdentifierFromComment({ node, parent }: AstPath<PrettierNode>, comments: string[], noIdentificationList: string[]): string | undefined;
5
+ export declare function getIdentifierFromTag({ node, parent }: AstPath<PrettierNode>, tags: string[], noIdentificationList: string[]): string | undefined;
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.3.0-rc.0",
5
+ "version": "0.3.0-rc.2",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "./dist"
@@ -57,7 +57,7 @@
57
57
  "restore-readme": "tsx ./scripts/restore-readme",
58
58
  "prepublishOnly": "npm run build && npm run process-readme",
59
59
  "postpublish": "npm run restore-readme",
60
- "ncu": "npx npm-check-updates -u",
60
+ "ncu": "npx ncu",
61
61
  "postncu": "npm i"
62
62
  },
63
63
  "devDependencies": {
@@ -65,23 +65,24 @@
65
65
  "@commitlint/config-conventional": "^18.4.3",
66
66
  "@semantic-release/git": "^10.0.1",
67
67
  "@types/estree": "^1.0.5",
68
+ "@types/node": "^20.10.0",
68
69
  "@typescript-eslint/eslint-plugin": "^6.12.0",
69
70
  "@typescript-eslint/parser": "^6.12.0",
70
71
  "@vitest/browser": "^0.34.6",
71
72
  "@vitest/coverage-istanbul": "^0.34.6",
72
73
  "@vitest/ui": "^0.34.6",
73
74
  "code-tag": "^1.1.0",
75
+ "esbuild": "^0.19.8",
74
76
  "eslint": "^8.54.0",
75
77
  "fast-glob": "^3.3.2",
76
78
  "npm-check-updates": "^16.14.11",
77
79
  "playwright": "^1.40.0",
80
+ "prettier-plugin-organize-imports": "^3.2.4",
78
81
  "semantic-release": "^22.0.8",
79
- "tsx": "^4.2.0",
82
+ "tsx": "^4.5.0",
80
83
  "typescript": "^5.3.2",
81
- "vite": "^5.0.0",
82
- "vitest": "^0.34.6"
83
- },
84
- "peerDependencies": {
84
+ "vite": "^5.0.2",
85
+ "vitest": "^0.34.6",
85
86
  "@prettier/plugin-php": ">=0.20.1 <1",
86
87
  "@prettier/plugin-ruby": "^4.0.0",
87
88
  "@prettier/plugin-xml": "^3.1.0",
@@ -92,6 +93,7 @@
92
93
  "prettier-plugin-sql": ">=0.15.0 <1"
93
94
  },
94
95
  "dependencies": {
95
- "micro-memoize": "^4.1.2"
96
+ "micro-memoize": "^4.1.2",
97
+ "package-up": "^5.0.0"
96
98
  }
97
99
  }