@vue/language-plugin-pug 1.9.0-alpha.2 → 2.0.0

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/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-plugin-pug",
3
- "version": "1.9.0-alpha.2",
4
- "main": "out/index.js",
3
+ "version": "2.0.0",
5
4
  "license": "MIT",
6
5
  "files": [
7
6
  "out/**/*.js",
@@ -14,11 +13,11 @@
14
13
  },
15
14
  "devDependencies": {
16
15
  "@types/node": "latest",
17
- "@vue/language-core": "1.9.0-alpha.2"
16
+ "@vue/language-core": "2.0.0"
18
17
  },
19
18
  "dependencies": {
20
- "@volar/source-map": "~1.10.10",
21
- "volar-service-pug": "0.0.16"
19
+ "@volar/source-map": "~2.1.0",
20
+ "volar-service-pug": "0.0.31"
22
21
  },
23
- "gitHead": "f77140a9e3f75713534d55821d5b22432d832646"
22
+ "gitHead": "aa47e5a7d8a6dae62cc80dbdb5db6a9bfa4f8715"
24
23
  }
package/out/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { VueLanguagePlugin } from '@vue/language-core';
2
- declare const plugin: VueLanguagePlugin;
3
- export = plugin;
4
- //# sourceMappingURL=index.d.ts.map
package/out/index.js DELETED
@@ -1,49 +0,0 @@
1
- "use strict";
2
- const pug = require("volar-service-pug/out/languageService");
3
- const source_map_1 = require("@volar/source-map");
4
- const plugin = ({ modules }) => {
5
- return {
6
- name: require('../package.json').name,
7
- version: 1,
8
- compileSFCTemplate(lang, template, options) {
9
- if (lang === 'pug') {
10
- const pugFile = pug?.baseParse(template);
11
- const map = new source_map_1.SourceMap(pugFile.mappings);
12
- if (pugFile) {
13
- const compiler = modules['@vue/compiler-dom'];
14
- const completed = compiler.compile(pugFile.htmlCode, {
15
- ...options,
16
- comments: true,
17
- onWarn(warning) {
18
- options?.onWarn?.(createProxyObject(warning));
19
- },
20
- onError(error) {
21
- options?.onError?.(createProxyObject(error));
22
- },
23
- });
24
- return createProxyObject(completed);
25
- function createProxyObject(target) {
26
- return new Proxy(target, {
27
- get(target, prop) {
28
- if (prop === 'offset') {
29
- const htmlOffset = target.offset;
30
- for (const mapped of map.toSourceOffsets(htmlOffset)) {
31
- return mapped[0];
32
- }
33
- return -1;
34
- }
35
- const value = target[prop];
36
- if (typeof value === 'object') {
37
- return createProxyObject(target[prop]);
38
- }
39
- return value;
40
- }
41
- });
42
- }
43
- }
44
- }
45
- },
46
- };
47
- };
48
- module.exports = plugin;
49
- //# sourceMappingURL=index.js.map