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