@web-widget/vue 1.52.1 → 1.53.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/dist/vite.d.ts +1 -0
- package/dist/vite.js +29 -13
- package/package.json +7 -6
package/dist/vite.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as vite from 'vite';
|
|
|
2
2
|
import { WebWidgetUserConfig } from '@web-widget/vite-plugin';
|
|
3
3
|
|
|
4
4
|
interface VueWebWidgetPluginOptions extends Partial<WebWidgetUserConfig> {
|
|
5
|
+
workspace?: string;
|
|
5
6
|
}
|
|
6
7
|
declare function vueWebWidgetPlugin(options?: VueWebWidgetPluginOptions): vite.Plugin<any>[];
|
|
7
8
|
|
package/dist/vite.js
CHANGED
|
@@ -1,42 +1,58 @@
|
|
|
1
1
|
// src/vite.ts
|
|
2
2
|
import { webWidgetPlugin } from "@web-widget/vite-plugin";
|
|
3
|
-
|
|
3
|
+
import { posix } from "path";
|
|
4
|
+
import { normalizePath } from "@rollup/pluginutils";
|
|
5
|
+
function escapeRegExp(path) {
|
|
6
|
+
return path.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7
|
+
}
|
|
8
|
+
function appendSlash(path) {
|
|
9
|
+
return path.endsWith(posix.sep) ? path : `${path}${posix.sep}`;
|
|
10
|
+
}
|
|
4
11
|
function vueWebWidgetPlugin(options) {
|
|
5
12
|
const {
|
|
6
13
|
manifest,
|
|
7
14
|
provide = "@web-widget/vue",
|
|
15
|
+
workspace = "",
|
|
8
16
|
export: exportWidget = {},
|
|
9
17
|
import: importWidget = {}
|
|
10
18
|
} = options != null ? options : {};
|
|
11
|
-
const
|
|
12
|
-
const
|
|
19
|
+
const workspacePattern = workspace ? escapeRegExp(normalizePath(appendSlash(workspace))) : workspace;
|
|
20
|
+
const widgetPattern = `[.@]widget`;
|
|
21
|
+
const routePattern = `[.@]route`;
|
|
22
|
+
const modulesPattern = `[.@](?:route|widget)`;
|
|
23
|
+
const extensionPattern = `\\.vue`;
|
|
24
|
+
const vueBuildModeQueryPattern = `(?:\\?vue&type=script\\b.*)`;
|
|
25
|
+
const routeRegExp = new RegExp(
|
|
26
|
+
`^${workspacePattern}.*${routePattern}${extensionPattern}$`
|
|
27
|
+
);
|
|
13
28
|
return webWidgetPlugin({
|
|
14
29
|
manifest,
|
|
15
30
|
provide,
|
|
16
31
|
export: {
|
|
17
|
-
include:
|
|
32
|
+
include: new RegExp(
|
|
33
|
+
`^${workspacePattern}[^?]*${modulesPattern}${extensionPattern}$`
|
|
34
|
+
),
|
|
18
35
|
extractFromExportDefault: [
|
|
19
36
|
{
|
|
20
37
|
name: "handler",
|
|
21
38
|
default: "{GET({render}){return render()}}",
|
|
22
|
-
include:
|
|
39
|
+
include: routeRegExp
|
|
23
40
|
},
|
|
24
41
|
{
|
|
25
42
|
name: "meta",
|
|
26
43
|
default: "{}",
|
|
27
|
-
include:
|
|
44
|
+
include: routeRegExp
|
|
28
45
|
}
|
|
29
46
|
],
|
|
30
47
|
...exportWidget
|
|
31
48
|
},
|
|
32
49
|
import: {
|
|
33
|
-
include:
|
|
34
|
-
includeImporter:
|
|
35
|
-
// vite
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
],
|
|
50
|
+
include: new RegExp(`^[^?]*${widgetPattern}\\.[^?]*$`),
|
|
51
|
+
includeImporter: new RegExp(
|
|
52
|
+
// vite dev mode: .vue
|
|
53
|
+
// vite build mode: .vue?vue&type=script&setup=true&lang.ts
|
|
54
|
+
`^${workspacePattern}[^?]*${extensionPattern}${vueBuildModeQueryPattern}?$`
|
|
55
|
+
),
|
|
40
56
|
...importWidget
|
|
41
57
|
}
|
|
42
58
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@web-widget/vue",
|
|
3
3
|
"description": "Vue adapter",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.53.1",
|
|
5
5
|
"homepage": "https://github.com/web-widget/web-widget#readme",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@
|
|
17
|
-
"@web-widget/
|
|
18
|
-
"@web-widget/
|
|
19
|
-
"@web-widget/
|
|
20
|
-
"@web-widget/
|
|
16
|
+
"@rollup/pluginutils": "^5.1.4",
|
|
17
|
+
"@web-widget/helpers": "1.53.1",
|
|
18
|
+
"@web-widget/vite-plugin": "1.53.1",
|
|
19
|
+
"@web-widget/web-widget": "1.53.1",
|
|
20
|
+
"@web-widget/schema": "1.53.1",
|
|
21
|
+
"@web-widget/react": "1.53.1"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"tsup": "^8.3.4",
|