@astrojs/ts-plugin 1.10.1 → 1.10.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/frontmatter.d.ts +1 -1
- package/dist/frontmatter.js +5 -5
- package/package.json +6 -5
package/dist/frontmatter.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type CollectionConfig = {
|
|
|
11
11
|
entries: Record<string, string>;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
export declare function getFrontmatterLanguagePlugin(
|
|
14
|
+
export declare function getFrontmatterLanguagePlugin(collectionConfig: CollectionConfig[]): LanguagePlugin<string, FrontmatterHolder>;
|
|
15
15
|
export declare class FrontmatterHolder implements VirtualCode {
|
|
16
16
|
fileName: string;
|
|
17
17
|
languageId: string;
|
package/dist/frontmatter.js
CHANGED
|
@@ -5,18 +5,18 @@ exports.getFrontmatterLanguagePlugin = getFrontmatterLanguagePlugin;
|
|
|
5
5
|
const node_url_1 = require("node:url");
|
|
6
6
|
const yaml2ts_1 = require("@astrojs/yaml2ts");
|
|
7
7
|
const language_core_1 = require("@volar/language-core");
|
|
8
|
-
const SUPPORTED_FRONTMATTER_EXTENSIONS = { md: 'markdown', mdx: 'mdx', mdoc: '
|
|
8
|
+
const SUPPORTED_FRONTMATTER_EXTENSIONS = { md: 'markdown', mdx: 'mdx', mdoc: 'markdoc' };
|
|
9
9
|
const SUPPORTED_FRONTMATTER_EXTENSIONS_KEYS = Object.keys(SUPPORTED_FRONTMATTER_EXTENSIONS);
|
|
10
10
|
const SUPPORTED_FRONTMATTER_EXTENSIONS_VALUES = Object.values(SUPPORTED_FRONTMATTER_EXTENSIONS);
|
|
11
11
|
exports.frontmatterRE = /^---(.*?)^---/ms;
|
|
12
|
-
function getCollectionName(
|
|
13
|
-
for (const collection of
|
|
12
|
+
function getCollectionName(collectionConfig, fsPath) {
|
|
13
|
+
for (const collection of collectionConfig) {
|
|
14
14
|
if (collection.config.entries[fsPath]) {
|
|
15
15
|
return collection.config.entries[fsPath];
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
function getFrontmatterLanguagePlugin(
|
|
19
|
+
function getFrontmatterLanguagePlugin(collectionConfig) {
|
|
20
20
|
return {
|
|
21
21
|
getLanguageId(scriptId) {
|
|
22
22
|
const fileType = SUPPORTED_FRONTMATTER_EXTENSIONS_KEYS.find((ext) => scriptId.endsWith(`.${ext}`));
|
|
@@ -30,7 +30,7 @@ function getFrontmatterLanguagePlugin(collectionConfigs) {
|
|
|
30
30
|
return new FrontmatterHolder(fileName, languageId, snapshot,
|
|
31
31
|
// In TypeScript plugins, unlike in the language server, the scriptId is just a string file path
|
|
32
32
|
// so we'll have to convert it to a URL to match the collection config entries
|
|
33
|
-
getCollectionName(
|
|
33
|
+
getCollectionName(collectionConfig, (0, node_url_1.pathToFileURL)(fileName).toString().toLowerCase()));
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
typescript: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/ts-plugin",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.3",
|
|
4
4
|
"description": "A TypeScript Plugin providing Astro intellisense",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@astrojs/compiler": "^2.10.3",
|
|
26
26
|
"@astrojs/yaml2ts": "^0.2.1",
|
|
27
27
|
"@jridgewell/sourcemap-codec": "^1.4.15",
|
|
28
|
-
"@volar/language-core": "~2.4.
|
|
29
|
-
"@volar/typescript": "~2.4.
|
|
28
|
+
"@volar/language-core": "~2.4.5",
|
|
29
|
+
"@volar/typescript": "~2.4.5",
|
|
30
30
|
"semver": "^7.3.8",
|
|
31
31
|
"vscode-languageserver-textdocument": "^1.0.11"
|
|
32
32
|
},
|
|
@@ -35,11 +35,12 @@
|
|
|
35
35
|
"@types/mocha": "^10.0.1",
|
|
36
36
|
"@types/node": "^18.17.8",
|
|
37
37
|
"@types/semver": "^7.3.13",
|
|
38
|
+
"@vscode/test-electron": "^2.3.2",
|
|
38
39
|
"chai": "^4.3.7",
|
|
39
40
|
"glob": "^8.0.3",
|
|
40
41
|
"mocha": "^10.2.0",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
42
|
+
"typescript": "^5.5.4",
|
|
43
|
+
"vscode-uri": "^3.0.8"
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
45
46
|
"build": "tsc",
|