create-packer 1.38.0 → 1.39.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 +4 -5
- package/template/cli/package.json +0 -1
- package/template/docusaurus/package.json +1 -1
- package/template/{web-app/react-vite/.eslintignore → lib/workspace/.stylelintignore} +2 -0
- package/template/lib/workspace/.stylelintrc +4 -9
- package/template/lib/workspace/eslint.config.mjs +116 -0
- package/template/lib/workspace/package.json +81 -73
- package/template/lib/workspace/packages/react/package.json +41 -41
- package/template/lib/workspace/packages/react/tsconfig.json +3 -8
- package/template/lib/workspace/packages/react/tsconfig.lint.json +21 -0
- package/template/lib/workspace/packages/ts/package.json +29 -29
- package/template/lib/workspace/packages/ts/tsconfig.json +9 -6
- package/template/lib/workspace/packages/ts/tsconfig.lint.json +21 -0
- package/template/nest/package.json +82 -84
- package/template/web-app/react-rsbuild/domain/app/components/app-context.tsx +17 -17
- package/template/web-app/react-rsbuild/domain/router/components/index.ts +2 -0
- package/template/web-app/react-rsbuild/domain/router/components/route-layout.tsx +19 -0
- package/template/web-app/react-rsbuild/domain/router/components/sub-route-outlet.tsx +22 -0
- package/template/web-app/react-rsbuild/domain/router/index.ts +4 -3
- package/template/web-app/react-rsbuild/eslint.config.js +104 -0
- package/template/web-app/react-rsbuild/package.json +78 -79
- package/template/web-app/react-rsbuild/pages/home/index.ts +1 -1
- package/template/web-app/react-rsbuild/pages/home/{home.styled.ts → view.styled.ts} +7 -7
- package/template/web-app/react-rsbuild/pages/home/{home.tsx → view.tsx} +10 -10
- package/template/web-app/{react-vite/shared/tools → react-rsbuild/shared/components}/componentInstance.tsx +80 -80
- package/template/web-app/react-rsbuild/shared/components/index.ts +1 -0
- package/template/web-app/react-rsbuild/shared/service/home.ts +8 -8
- package/template/web-app/react-rsbuild/shared/theme/theme.styled.ts +56 -56
- package/template/web-app/react-rsbuild/shared/tools/index.ts +0 -1
- package/template/web-app/react-vite/domain/router/components/index.ts +2 -0
- package/template/web-app/react-vite/domain/router/components/route-layout.tsx +19 -0
- package/template/web-app/react-vite/domain/router/components/sub-route-outlet.tsx +22 -0
- package/template/web-app/react-vite/domain/router/index.ts +4 -3
- package/template/web-app/react-vite/eslint.config.js +104 -0
- package/template/web-app/react-vite/package.json +79 -79
- package/template/web-app/react-vite/pages/home/index.ts +1 -1
- package/template/web-app/react-vite/pages/home/{home.mock.ts → view.mock.ts} +19 -19
- package/template/web-app/{react-webpack/pages/home/home.styled.ts → react-vite/pages/home/view.styled.ts} +7 -7
- package/template/web-app/react-vite/pages/home/{home.tsx → view.tsx} +10 -10
- package/template/web-app/{react-rsbuild/shared/tools → react-vite/shared/components}/componentInstance.tsx +80 -80
- package/template/web-app/react-vite/shared/components/index.ts +1 -0
- package/template/web-app/react-vite/shared/service/home.ts +10 -10
- package/template/web-app/react-vite/shared/theme/theme.styled.ts +55 -56
- package/template/web-app/react-vite/shared/tools/index.ts +0 -1
- package/template/web-app/react-vite/vite.config.ts +80 -76
- package/template/web-app/react-webpack/domain/router/components/index.ts +2 -0
- package/template/web-app/react-webpack/domain/router/components/route-layout.tsx +19 -0
- package/template/web-app/react-webpack/domain/router/components/sub-route-outlet.tsx +22 -0
- package/template/web-app/react-webpack/domain/router/index.ts +4 -3
- package/template/web-app/react-webpack/eslint.config.js +104 -0
- package/template/web-app/react-webpack/package.json +84 -87
- package/template/web-app/react-webpack/pages/home/index.ts +1 -1
- package/template/web-app/{react-vite/pages/home/home.styled.ts → react-webpack/pages/home/view.styled.ts} +7 -7
- package/template/web-app/react-webpack/pages/home/{home.tsx → view.tsx} +10 -10
- package/template/web-app/react-webpack/shared/{tools → components}/componentInstance.tsx +78 -78
- package/template/web-app/react-webpack/shared/components/index.ts +1 -0
- package/template/web-app/react-webpack/shared/theme/theme.styled.ts +56 -56
- package/template/web-app/react-webpack/shared/tools/index.ts +0 -1
- package/template/web-app/solid/package.json +53 -51
- package/template/web-app/solid/src/pages/home/index.ts +1 -1
- package/template/web-app/solid/src/pages/home/{home.container.tsx → view.tsx} +5 -5
- package/template/web-app/solid/src/pages/notFound/index.ts +1 -1
- package/template/web-app/solid/src/pages/notFound/{notFound.container.tsx → view.tsx} +3 -3
- package/template/web-app/svelte/.prettierrc +21 -14
- package/template/web-app/svelte/.svelte-kit/ambient.d.ts +181 -177
- package/template/web-app/svelte/.svelte-kit/generated/client/app.js +28 -23
- package/template/web-app/svelte/.svelte-kit/generated/client/matchers.js +1 -1
- package/template/web-app/svelte/.svelte-kit/generated/client/nodes/0.js +1 -1
- package/template/web-app/svelte/.svelte-kit/generated/client/nodes/1.js +1 -1
- package/template/web-app/svelte/.svelte-kit/generated/client/nodes/2.js +1 -1
- package/template/web-app/svelte/.svelte-kit/generated/root.js +3 -0
- package/template/web-app/svelte/.svelte-kit/generated/root.svelte +66 -62
- package/template/web-app/svelte/.svelte-kit/generated/server/internal.js +49 -61
- package/template/web-app/svelte/.svelte-kit/non-ambient.d.ts +25 -23
- package/template/web-app/svelte/.svelte-kit/tsconfig.json +49 -32
- package/template/web-app/svelte/.svelte-kit/types/route_meta_data.json +3 -3
- package/template/web-app/svelte/.svelte-kit/types/src/routes/$types.d.ts +22 -35
- package/template/web-app/svelte/eslint.config.js +95 -0
- package/template/web-app/svelte/package.json +55 -55
- package/template/web-app/svelte/src/app.d.ts +13 -12
- package/template/web-app/svelte/src/app.html +2 -2
- package/template/web-app/svelte/src/lib/index.ts +1 -0
- package/template/web-app/svelte/src/routes/+page.svelte +2 -2
- package/template/web-app/svelte/vite.config.ts +59 -55
- package/template/web-app/vue/eslint.config.js +109 -0
- package/template/web-app/vue/package.json +70 -70
- package/template/web-app/vue/pages/home/index.ts +1 -1
- package/template/web-app/vue/pages/home/{home.mock.ts → view.mock.ts} +19 -19
- package/template/web-app/vue/pages/home/{home.vue → view.vue} +16 -16
- package/template/web-app/vue/vite.config.ts +69 -65
- package/template/web-extension/.wxt/eslint-auto-imports.mjs +28 -0
- package/template/web-extension/.wxt/tsconfig.json +28 -25
- package/template/web-extension/.wxt/types/globals.d.ts +15 -15
- package/template/web-extension/.wxt/types/i18n.d.ts +81 -87
- package/template/web-extension/.wxt/types/imports.d.ts +22 -21
- package/template/web-extension/.wxt/types/paths.d.ts +16 -15
- package/template/web-extension/.wxt/wxt.d.ts +7 -6
- package/template/web-extension/entrypoints/content/domain/app/tools/insertApp.tsx +58 -59
- package/template/web-extension/entrypoints/content/index.tsx +10 -12
- package/template/web-extension/entrypoints/popup/main.tsx +14 -14
- package/template/web-extension/entrypoints/popup/{popup.container.tsx → popup.tsx} +3 -3
- package/template/web-extension/eslint.config.js +106 -0
- package/template/web-extension/package.json +84 -86
- package/template/web-extension/shared/content/constant.ts +1 -0
- package/template/web-extension/shared/content/index.ts +2 -1
- package/template/web-extension/shared/content/message.ts +25 -15
- package/template/web-extension/shared/styles/theme.styled.ts +56 -56
- package/template/web-extension/shared/tools/message.ts +70 -80
- package/template/web-extension/tsconfig.json +32 -32
- package/template/web-extension/vite-env.d.ts +20 -19
- package/template/web-extension/wxt.config.ts +43 -50
- package/template/lib/workspace/.eslintrc +0 -111
- package/template/lib/workspace/packages/react/.eslintrc +0 -111
- package/template/lib/workspace/packages/react/.stylelintrc +0 -29
- package/template/web-app/react-rsbuild/.eslintignore +0 -4
- package/template/web-app/react-rsbuild/.eslintrc +0 -111
- package/template/web-app/react-vite/.eslintrc +0 -110
- package/template/web-app/react-webpack/.eslintignore +0 -4
- package/template/web-app/react-webpack/.eslintrc +0 -110
- package/template/web-app/svelte/.eslintignore +0 -13
- package/template/web-app/svelte/.eslintrc +0 -76
- package/template/web-app/vue/.eslintignore +0 -4
- package/template/web-app/vue/.eslintrc +0 -97
- package/template/web-extension/.eslintignore +0 -4
- package/template/web-extension/.eslintrc +0 -110
- /package/template/web-app/solid/src/pages/home/{home.css → view.css} +0 -0
|
@@ -1,65 +1,69 @@
|
|
|
1
|
-
import { defineConfig, loadEnv } from 'vite'
|
|
2
|
-
import vue from '@vitejs/plugin-vue'
|
|
3
|
-
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
4
|
-
import svgLoader from 'vite-svg-loader'
|
|
5
|
-
import mockDevServer from 'vite-plugin-mock-dev-server'
|
|
6
|
-
import stylelint from 'vite-plugin-stylelint'
|
|
7
|
-
import
|
|
8
|
-
import { visualizer } from 'rollup-plugin-visualizer'
|
|
9
|
-
import { includes } from 'lodash-es'
|
|
10
|
-
import { createChunks } from './scripts'
|
|
11
|
-
|
|
12
|
-
// https://vitejs.dev/config/
|
|
13
|
-
export default defineConfig(({ mode }) => {
|
|
14
|
-
const env = loadEnv(mode, process.cwd(), '')
|
|
15
|
-
const proxyBaseUrl = env.VITE_BASE_URL + env.VITE_API_HOST
|
|
16
|
-
const plugins: any[] = [
|
|
17
|
-
vueJsx({
|
|
18
|
-
enableObjectSlots: false
|
|
19
|
-
}),
|
|
20
|
-
stylelint({ cache: false, include: ['**/*.{css,scss,sass,less,styl,vue,svelte}'] }),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
plugins,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
1
|
+
import { defineConfig, loadEnv } from 'vite'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
4
|
+
import svgLoader from 'vite-svg-loader'
|
|
5
|
+
import mockDevServer from 'vite-plugin-mock-dev-server'
|
|
6
|
+
import stylelint from 'vite-plugin-stylelint'
|
|
7
|
+
import checker from 'vite-plugin-checker'
|
|
8
|
+
import { visualizer } from 'rollup-plugin-visualizer'
|
|
9
|
+
import { includes } from 'lodash-es'
|
|
10
|
+
import { createChunks } from './scripts'
|
|
11
|
+
|
|
12
|
+
// https://vitejs.dev/config/
|
|
13
|
+
export default defineConfig(({ mode }) => {
|
|
14
|
+
const env = loadEnv(mode, process.cwd(), '')
|
|
15
|
+
const proxyBaseUrl = env.VITE_BASE_URL + env.VITE_API_HOST
|
|
16
|
+
const plugins: any[] = [
|
|
17
|
+
vueJsx({
|
|
18
|
+
enableObjectSlots: false
|
|
19
|
+
}),
|
|
20
|
+
stylelint({ cache: false, include: ['**/*.{css,scss,sass,less,styl,vue,svelte}'] }),
|
|
21
|
+
checker({
|
|
22
|
+
enableBuild: false,
|
|
23
|
+
typescript: true,
|
|
24
|
+
eslint: { useFlatConfig: true, lintCommand: 'eslint', dev: { logLevel: ['error'] } }
|
|
25
|
+
}),
|
|
26
|
+
vue(),
|
|
27
|
+
svgLoader(),
|
|
28
|
+
mockDevServer({
|
|
29
|
+
include: ['**/*.mock.{ts,js}']
|
|
30
|
+
})
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
if (mode === 'analyse') {
|
|
34
|
+
plugins.push(visualizer({ open: true, sourcemap: true, brotliSize: true, gzipSize: true }))
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
base: env.VITE_BASE_URL,
|
|
38
|
+
plugins,
|
|
39
|
+
resolve: {
|
|
40
|
+
alias: {
|
|
41
|
+
'@': __dirname
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
esbuild: {
|
|
45
|
+
drop: includes(['production', 'analyse'], mode) ? ['console', 'debugger'] : []
|
|
46
|
+
},
|
|
47
|
+
build: {
|
|
48
|
+
sourcemap: mode === 'analyse',
|
|
49
|
+
reportCompressedSize: mode === 'analyse',
|
|
50
|
+
rollupOptions: {
|
|
51
|
+
output: {
|
|
52
|
+
manualChunks: createChunks({
|
|
53
|
+
vue: ['vue', 'vue-router']
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
server: {
|
|
59
|
+
host: '0.0.0.0',
|
|
60
|
+
proxy: {
|
|
61
|
+
[proxyBaseUrl]: {
|
|
62
|
+
target: 'http://127.0.0.1',
|
|
63
|
+
changeOrigin: true,
|
|
64
|
+
rewrite: path => path.replace(proxyBaseUrl, '')
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const globals = {
|
|
2
|
+
"ContentScriptContext": true,
|
|
3
|
+
"InvalidMatchPattern": true,
|
|
4
|
+
"MatchPattern": true,
|
|
5
|
+
"MigrationError": true,
|
|
6
|
+
"browser": true,
|
|
7
|
+
"createIframeUi": true,
|
|
8
|
+
"createIntegratedUi": true,
|
|
9
|
+
"createShadowRootUi": true,
|
|
10
|
+
"defineAppConfig": true,
|
|
11
|
+
"defineBackground": true,
|
|
12
|
+
"defineConfig": true,
|
|
13
|
+
"defineContentScript": true,
|
|
14
|
+
"defineUnlistedScript": true,
|
|
15
|
+
"defineWxtPlugin": true,
|
|
16
|
+
"fakeBrowser": true,
|
|
17
|
+
"injectScript": true,
|
|
18
|
+
"storage": true,
|
|
19
|
+
"useAppConfig": true
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
name: "wxt/auto-imports",
|
|
24
|
+
languageOptions: {
|
|
25
|
+
globals,
|
|
26
|
+
sourceType: "module",
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"noEmit": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"paths": {
|
|
13
|
+
"@": [".."],
|
|
14
|
+
"@/*": ["../*"],
|
|
15
|
+
"~": [".."],
|
|
16
|
+
"~/*": ["../*"],
|
|
17
|
+
"@@": [".."],
|
|
18
|
+
"@@/*": ["../*"],
|
|
19
|
+
"~~": [".."],
|
|
20
|
+
"~~/*": ["../*"]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"include": [
|
|
24
|
+
"../**/*",
|
|
25
|
+
"./wxt.d.ts"
|
|
26
|
+
],
|
|
27
|
+
"exclude": ["../dist"]
|
|
28
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
// Generated by wxt
|
|
2
|
-
interface ImportMetaEnv {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
interface ImportMeta {
|
|
14
|
-
|
|
15
|
-
}
|
|
1
|
+
// Generated by wxt
|
|
2
|
+
interface ImportMetaEnv {
|
|
3
|
+
readonly MANIFEST_VERSION: 2 | 3;
|
|
4
|
+
readonly BROWSER: string;
|
|
5
|
+
readonly CHROME: boolean;
|
|
6
|
+
readonly FIREFOX: boolean;
|
|
7
|
+
readonly SAFARI: boolean;
|
|
8
|
+
readonly EDGE: boolean;
|
|
9
|
+
readonly OPERA: boolean;
|
|
10
|
+
readonly COMMAND: "build" | "serve";
|
|
11
|
+
readonly ENTRYPOINT: string;
|
|
12
|
+
}
|
|
13
|
+
interface ImportMeta {
|
|
14
|
+
readonly env: ImportMetaEnv
|
|
15
|
+
}
|
|
@@ -1,87 +1,81 @@
|
|
|
1
|
-
// Generated by wxt
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
declare module
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
| '@@bidi_end_edge',
|
|
83
|
-
substitutions?: string | string[],
|
|
84
|
-
options?: GetMessageOptions
|
|
85
|
-
): string
|
|
86
|
-
}
|
|
87
|
-
}
|
|
1
|
+
// Generated by wxt
|
|
2
|
+
import "wxt/browser";
|
|
3
|
+
|
|
4
|
+
declare module "wxt/browser" {
|
|
5
|
+
/**
|
|
6
|
+
* See https://developer.chrome.com/docs/extensions/reference/i18n/#method-getMessage
|
|
7
|
+
*/
|
|
8
|
+
interface GetMessageOptions {
|
|
9
|
+
/**
|
|
10
|
+
* See https://developer.chrome.com/docs/extensions/reference/i18n/#method-getMessage
|
|
11
|
+
*/
|
|
12
|
+
escapeLt?: boolean
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface WxtI18n extends I18n.Static {
|
|
16
|
+
/**
|
|
17
|
+
* The extension or app ID; you might use this string to construct URLs for resources inside the extension. Even unlocalized extensions can use this message.
|
|
18
|
+
* Note: You can't use this message in a manifest file.
|
|
19
|
+
*
|
|
20
|
+
* "<browser.runtime.id>"
|
|
21
|
+
*/
|
|
22
|
+
getMessage(
|
|
23
|
+
messageName: "@@extension_id",
|
|
24
|
+
substitutions?: string | string[],
|
|
25
|
+
options?: GetMessageOptions,
|
|
26
|
+
): string;
|
|
27
|
+
/**
|
|
28
|
+
* "<browser.i18n.getUiLocale()>"
|
|
29
|
+
*/
|
|
30
|
+
getMessage(
|
|
31
|
+
messageName: "@@ui_locale",
|
|
32
|
+
substitutions?: string | string[],
|
|
33
|
+
options?: GetMessageOptions,
|
|
34
|
+
): string;
|
|
35
|
+
/**
|
|
36
|
+
* The text direction for the current locale, either "ltr" for left-to-right languages such as English or "rtl" for right-to-left languages such as Japanese.
|
|
37
|
+
*
|
|
38
|
+
* "<ltr|rtl>"
|
|
39
|
+
*/
|
|
40
|
+
getMessage(
|
|
41
|
+
messageName: "@@bidi_dir",
|
|
42
|
+
substitutions?: string | string[],
|
|
43
|
+
options?: GetMessageOptions,
|
|
44
|
+
): string;
|
|
45
|
+
/**
|
|
46
|
+
* If the @@bidi_dir is "ltr", then this is "rtl"; otherwise, it's "ltr".
|
|
47
|
+
*
|
|
48
|
+
* "<rtl|ltr>"
|
|
49
|
+
*/
|
|
50
|
+
getMessage(
|
|
51
|
+
messageName: "@@bidi_reversed_dir",
|
|
52
|
+
substitutions?: string | string[],
|
|
53
|
+
options?: GetMessageOptions,
|
|
54
|
+
): string;
|
|
55
|
+
/**
|
|
56
|
+
* If the @@bidi_dir is "ltr", then this is "left"; otherwise, it's "right".
|
|
57
|
+
*
|
|
58
|
+
* "<left|right>"
|
|
59
|
+
*/
|
|
60
|
+
getMessage(
|
|
61
|
+
messageName: "@@bidi_start_edge",
|
|
62
|
+
substitutions?: string | string[],
|
|
63
|
+
options?: GetMessageOptions,
|
|
64
|
+
): string;
|
|
65
|
+
/**
|
|
66
|
+
* If the @@bidi_dir is "ltr", then this is "right"; otherwise, it's "left".
|
|
67
|
+
*
|
|
68
|
+
* "<right|left>"
|
|
69
|
+
*/
|
|
70
|
+
getMessage(
|
|
71
|
+
messageName: "@@bidi_end_edge",
|
|
72
|
+
substitutions?: string | string[],
|
|
73
|
+
options?: GetMessageOptions,
|
|
74
|
+
): string;
|
|
75
|
+
getMessage(
|
|
76
|
+
messageName: "@@extension_id" | "@@ui_locale" | "@@bidi_dir" | "@@bidi_reversed_dir" | "@@bidi_start_edge" | "@@bidi_end_edge",
|
|
77
|
+
substitutions?: string | string[],
|
|
78
|
+
options?: GetMessageOptions,
|
|
79
|
+
): string;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
// Generated by wxt
|
|
2
|
-
export {}
|
|
3
|
-
declare global {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
// Generated by wxt
|
|
2
|
+
export {}
|
|
3
|
+
declare global {
|
|
4
|
+
const ContentScriptContext: typeof import('wxt/client')['ContentScriptContext']
|
|
5
|
+
const InvalidMatchPattern: typeof import('wxt/sandbox')['InvalidMatchPattern']
|
|
6
|
+
const MatchPattern: typeof import('wxt/sandbox')['MatchPattern']
|
|
7
|
+
const MigrationError: typeof import('wxt/storage')['MigrationError']
|
|
8
|
+
const browser: typeof import('wxt/browser/chrome')['browser']
|
|
9
|
+
const createIframeUi: typeof import('wxt/client')['createIframeUi']
|
|
10
|
+
const createIntegratedUi: typeof import('wxt/client')['createIntegratedUi']
|
|
11
|
+
const createShadowRootUi: typeof import('wxt/client')['createShadowRootUi']
|
|
12
|
+
const defineAppConfig: typeof import('wxt/sandbox')['defineAppConfig']
|
|
13
|
+
const defineBackground: typeof import('wxt/sandbox')['defineBackground']
|
|
14
|
+
const defineConfig: typeof import('wxt')['defineConfig']
|
|
15
|
+
const defineContentScript: typeof import('wxt/sandbox')['defineContentScript']
|
|
16
|
+
const defineUnlistedScript: typeof import('wxt/sandbox')['defineUnlistedScript']
|
|
17
|
+
const defineWxtPlugin: typeof import('wxt/sandbox')['defineWxtPlugin']
|
|
18
|
+
const fakeBrowser: typeof import('wxt/testing')['fakeBrowser']
|
|
19
|
+
const injectScript: typeof import('wxt/client')['injectScript']
|
|
20
|
+
const storage: typeof import('wxt/storage')['storage']
|
|
21
|
+
const useAppConfig: typeof import('wxt/client')['useAppConfig']
|
|
22
|
+
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
// Generated by wxt
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
declare module
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
// Generated by wxt
|
|
2
|
+
import "wxt/browser";
|
|
3
|
+
|
|
4
|
+
declare module "wxt/browser" {
|
|
5
|
+
export type PublicPath =
|
|
6
|
+
| "/"
|
|
7
|
+
| "/background.js"
|
|
8
|
+
| "/content-scripts/content.js"
|
|
9
|
+
| "/popup.html"
|
|
10
|
+
| "/vite.svg"
|
|
11
|
+
type HtmlPublicPath = Extract<PublicPath, `${string}.html`>
|
|
12
|
+
export interface WxtRuntime {
|
|
13
|
+
getURL(path: PublicPath): string;
|
|
14
|
+
getURL(path: `${HtmlPublicPath}${string}`): string;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
// Generated by wxt
|
|
2
|
-
/// <reference types="wxt/vite-builder-env" />
|
|
3
|
-
/// <reference types="./types/paths.d.ts" />
|
|
4
|
-
/// <reference types="./types/i18n.d.ts" />
|
|
5
|
-
/// <reference types="./types/globals.d.ts" />
|
|
6
|
-
/// <reference types="
|
|
1
|
+
// Generated by wxt
|
|
2
|
+
/// <reference types="wxt/vite-builder-env" />
|
|
3
|
+
/// <reference types="./types/paths.d.ts" />
|
|
4
|
+
/// <reference types="./types/i18n.d.ts" />
|
|
5
|
+
/// <reference types="./types/globals.d.ts" />
|
|
6
|
+
/// <reference types="@types/chrome" />
|
|
7
|
+
/// <reference types="./types/imports.d.ts" />
|
|
@@ -1,59 +1,58 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from 'react'
|
|
2
|
-
import { createRoot } from 'react-dom/client'
|
|
3
|
-
import { forEach, isFunction } from 'lodash-es'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
result
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
result.rootEle =
|
|
39
|
-
result.rootEle.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
result
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
result
|
|
58
|
-
|
|
59
|
-
}
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react'
|
|
2
|
+
import { createRoot } from 'react-dom/client'
|
|
3
|
+
import { forEach, isFunction } from 'lodash-es'
|
|
4
|
+
import { AppContext } from '@/shared/components'
|
|
5
|
+
import { classNameSpace } from '@/entrypoints/content/constants'
|
|
6
|
+
|
|
7
|
+
export enum insertAppStatus {
|
|
8
|
+
success,
|
|
9
|
+
target_not_exist,
|
|
10
|
+
root_existed
|
|
11
|
+
}
|
|
12
|
+
export interface insertAppResultType {
|
|
13
|
+
rootEle: HTMLElement | undefined | null
|
|
14
|
+
result: boolean
|
|
15
|
+
status: insertAppStatus
|
|
16
|
+
}
|
|
17
|
+
export function insertApp<T extends HTMLElement>(
|
|
18
|
+
target: Nullable<T>,
|
|
19
|
+
option: {
|
|
20
|
+
insert?: (rootEle: HTMLElement, target: T) => void
|
|
21
|
+
reactNode: ReactNode
|
|
22
|
+
isReplace?: boolean
|
|
23
|
+
rootId: string
|
|
24
|
+
rootStyle?: CSSProperties
|
|
25
|
+
}
|
|
26
|
+
) {
|
|
27
|
+
const result: insertAppResultType = {
|
|
28
|
+
result: false,
|
|
29
|
+
rootEle: void 0,
|
|
30
|
+
status: insertAppStatus.success
|
|
31
|
+
}
|
|
32
|
+
const rootId = `${import.meta.env.VITE_APP_ID}_${option.rootId}`
|
|
33
|
+
if (!target) {
|
|
34
|
+
result.status = insertAppStatus.target_not_exist
|
|
35
|
+
return result
|
|
36
|
+
}
|
|
37
|
+
result.rootEle = document.createElement('div')
|
|
38
|
+
result.rootEle.className = classNameSpace
|
|
39
|
+
result.rootEle.id = rootId
|
|
40
|
+
forEach(option.rootStyle, (value, key) => {
|
|
41
|
+
result.rootEle!.style[key as any] = value as never
|
|
42
|
+
})
|
|
43
|
+
const oldRootEle = target.querySelector?.(`#${rootId}`)
|
|
44
|
+
if (!option.isReplace && oldRootEle) {
|
|
45
|
+
result.status = insertAppStatus.root_existed
|
|
46
|
+
return result
|
|
47
|
+
}
|
|
48
|
+
oldRootEle?.remove()
|
|
49
|
+
if (isFunction(option.insert)) {
|
|
50
|
+
option.insert(result.rootEle, target)
|
|
51
|
+
} else {
|
|
52
|
+
target.appendChild(result.rootEle)
|
|
53
|
+
}
|
|
54
|
+
const root = createRoot(result.rootEle)
|
|
55
|
+
root.render(<AppContext>{option.reactNode}</AppContext>)
|
|
56
|
+
result.result = true
|
|
57
|
+
return result
|
|
58
|
+
}
|