@vef-framework/dev 1.0.122 → 1.0.124
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/bin/vef.js +1 -1
- package/cjs/cli.cjs +228 -0
- package/cjs/commitlint-config.cjs +14 -0
- package/cjs/config.cjs +82 -0
- package/cjs/constants.cjs +27 -0
- package/cjs/eslint-config.cjs +413 -0
- package/cjs/index.cjs +16 -0
- package/cjs/json/monaco.nls.json.cjs +7 -0
- package/cjs/json/monaco.theme.github-light.json.cjs +7 -0
- package/cjs/modules.d.cjs +4 -0
- package/cjs/plugin-app-config.cjs +37 -0
- package/cjs/plugin-conventional-config.cjs +116 -0
- package/cjs/plugin-eslint.cjs +23 -0
- package/cjs/plugin-html.cjs +85 -0
- package/cjs/plugin-icons.cjs +21 -0
- package/{lib → cjs}/plugin-initialization.cjs +26 -2
- package/cjs/plugin-injection.cjs +20 -0
- package/cjs/plugin-inspect.cjs +14 -0
- package/{lib → cjs}/plugin-monaco-nls.cjs +59 -2
- package/cjs/plugin-react-swc.cjs +13 -0
- package/cjs/plugin-router.cjs +47 -0
- package/cjs/plugin-stylelint.cjs +23 -0
- package/cjs/plugin-svgr.cjs +58 -0
- package/cjs/plugin-tailwind.cjs +11 -0
- package/cjs/plugin-tailwindcss.cjs +24 -0
- package/cjs/plugin-tsconfig-paths.cjs +13 -0
- package/cjs/plugin-visualizer.cjs +15 -0
- package/cjs/plugin-webfont.cjs +14 -0
- package/cjs/stylelint-config.cjs +67 -0
- package/cjs/tailwind-config.cjs +395 -0
- package/cjs/types.cjs +4 -0
- package/esm/cli.js +226 -0
- package/esm/commitlint-config.js +12 -0
- package/esm/config.js +80 -0
- package/esm/constants.js +15 -0
- package/esm/eslint-config.js +411 -0
- package/esm/index.js +8 -0
- package/esm/json/monaco.nls.json.js +3 -0
- package/esm/json/monaco.theme.github-light.json.js +3 -0
- package/esm/modules.d.js +2 -0
- package/esm/plugin-app-config.js +35 -0
- package/esm/plugin-conventional-config.js +114 -0
- package/esm/plugin-eslint.js +21 -0
- package/esm/plugin-html.js +83 -0
- package/esm/plugin-icons.js +18 -0
- package/{es → esm}/plugin-initialization.js +24 -2
- package/esm/plugin-injection.js +18 -0
- package/esm/plugin-inspect.js +12 -0
- package/{es → esm}/plugin-monaco-nls.js +56 -2
- package/esm/plugin-react-swc.js +11 -0
- package/esm/plugin-router.js +45 -0
- package/esm/plugin-stylelint.js +21 -0
- package/esm/plugin-svgr.js +56 -0
- package/esm/plugin-tailwind.js +9 -0
- package/esm/plugin-tailwindcss.js +22 -0
- package/esm/plugin-tsconfig-paths.js +11 -0
- package/esm/plugin-visualizer.js +13 -0
- package/esm/plugin-webfont.js +12 -0
- package/esm/stylelint-config.js +65 -0
- package/esm/tailwind-config.js +393 -0
- package/esm/types.js +2 -0
- package/package.json +19 -18
- package/template/_package.json +5 -5
- package/es/cli.js +0 -4
- package/es/commitlint-config.js +0 -1
- package/es/config.js +0 -1
- package/es/constants.js +0 -1
- package/es/eslint-config.js +0 -1
- package/es/index.js +0 -1
- package/es/json/monaco.nls.json.js +0 -15920
- package/es/json/monaco.theme.github-light.json.js +0 -349
- package/es/modules.d.js +0 -1
- package/es/plugin-app-config.js +0 -1
- package/es/plugin-conventional-config.js +0 -11
- package/es/plugin-eslint.js +0 -1
- package/es/plugin-html.js +0 -16
- package/es/plugin-icons.js +0 -1
- package/es/plugin-injection.js +0 -2
- package/es/plugin-inspect.js +0 -1
- package/es/plugin-react-swc.js +0 -1
- package/es/plugin-router.js +0 -10
- package/es/plugin-stylelint.js +0 -1
- package/es/plugin-svgr.js +0 -1
- package/es/plugin-tailwind.js +0 -1
- package/es/plugin-tailwindcss.js +0 -2
- package/es/plugin-tsconfig-paths.js +0 -1
- package/es/plugin-visualizer.js +0 -1
- package/es/plugin-webfont.js +0 -1
- package/es/stylelint-config.js +0 -1
- package/es/tailwind-config.js +0 -1
- package/lib/cli.cjs +0 -4
- package/lib/commitlint-config.cjs +0 -1
- package/lib/config.cjs +0 -1
- package/lib/constants.cjs +0 -1
- package/lib/eslint-config.cjs +0 -1
- package/lib/index.cjs +0 -1
- package/lib/json/monaco.nls.json.cjs +0 -15920
- package/lib/json/monaco.theme.github-light.json.cjs +0 -349
- package/lib/modules.d.cjs +0 -1
- package/lib/plugin-app-config.cjs +0 -1
- package/lib/plugin-conventional-config.cjs +0 -11
- package/lib/plugin-eslint.cjs +0 -1
- package/lib/plugin-html.cjs +0 -16
- package/lib/plugin-icons.cjs +0 -1
- package/lib/plugin-injection.cjs +0 -2
- package/lib/plugin-inspect.cjs +0 -1
- package/lib/plugin-react-swc.cjs +0 -1
- package/lib/plugin-router.cjs +0 -10
- package/lib/plugin-stylelint.cjs +0 -1
- package/lib/plugin-svgr.cjs +0 -1
- package/lib/plugin-tailwind.cjs +0 -1
- package/lib/plugin-tailwindcss.cjs +0 -2
- package/lib/plugin-tsconfig-paths.cjs +0 -1
- package/lib/plugin-visualizer.cjs +0 -1
- package/lib/plugin-webfont.cjs +0 -1
- package/lib/stylelint-config.cjs +0 -1
- package/lib/tailwind-config.cjs +0 -1
- package/lib/types.cjs +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var monaco_theme_github_light_default = '{\n "base": "vs",\n "inherit": true,\n "rules": [\n {\n "background": "ffffff",\n "token": ""\n },\n {\n "foreground": "6a737d",\n "token": "comment"\n },\n {\n "foreground": "6a737d",\n "token": "punctuation.definition.comment"\n },\n {\n "foreground": "6a737d",\n "token": "string.comment"\n },\n {\n "foreground": "005cc5",\n "token": "constant"\n },\n {\n "foreground": "005cc5",\n "token": "entity.name.constant"\n },\n {\n "foreground": "005cc5",\n "token": "variable.other.constant"\n },\n {\n "foreground": "005cc5",\n "token": "variable.language"\n },\n {\n "foreground": "6f42c1",\n "token": "entity"\n },\n {\n "foreground": "6f42c1",\n "token": "entity.name"\n },\n {\n "foreground": "24292e",\n "token": "variable.parameter.function"\n },\n {\n "foreground": "22863a",\n "token": "entity.name.tag"\n },\n {\n "foreground": "d73a49",\n "token": "keyword"\n },\n {\n "foreground": "d73a49",\n "token": "storage"\n },\n {\n "foreground": "d73a49",\n "token": "storage.type"\n },\n {\n "foreground": "24292e",\n "token": "storage.modifier.package"\n },\n {\n "foreground": "24292e",\n "token": "storage.modifier.import"\n },\n {\n "foreground": "24292e",\n "token": "storage.type.java"\n },\n {\n "foreground": "032f62",\n "token": "string"\n },\n {\n "foreground": "032f62",\n "token": "punctuation.definition.string"\n },\n {\n "foreground": "032f62",\n "token": "string punctuation.section.embedded source"\n },\n {\n "foreground": "005cc5",\n "token": "support"\n },\n {\n "foreground": "005cc5",\n "token": "meta.property-name"\n },\n {\n "foreground": "e36209",\n "token": "variable"\n },\n {\n "foreground": "24292e",\n "token": "variable.other"\n },\n {\n "foreground": "b31d28",\n "fontStyle": "bold italic underline",\n "token": "invalid.broken"\n },\n {\n "foreground": "b31d28",\n "fontStyle": "bold italic underline",\n "token": "invalid.deprecated"\n },\n {\n "foreground": "fafbfc",\n "background": "b31d28",\n "fontStyle": "italic underline",\n "token": "invalid.illegal"\n },\n {\n "foreground": "fafbfc",\n "background": "d73a49",\n "fontStyle": "italic underline",\n "token": "carriage-return"\n },\n {\n "foreground": "b31d28",\n "fontStyle": "bold italic underline",\n "token": "invalid.unimplemented"\n },\n {\n "foreground": "b31d28",\n "token": "message.error"\n },\n {\n "foreground": "24292e",\n "token": "string source"\n },\n {\n "foreground": "005cc5",\n "token": "string variable"\n },\n {\n "foreground": "032f62",\n "token": "source.regexp"\n },\n {\n "foreground": "032f62",\n "token": "string.regexp"\n },\n {\n "foreground": "032f62",\n "token": "string.regexp.character-class"\n },\n {\n "foreground": "032f62",\n "token": "string.regexp constant.character.escape"\n },\n {\n "foreground": "032f62",\n "token": "string.regexp source.ruby.embedded"\n },\n {\n "foreground": "032f62",\n "token": "string.regexp string.regexp.arbitrary-repitition"\n },\n {\n "foreground": "22863a",\n "fontStyle": "bold",\n "token": "string.regexp constant.character.escape"\n },\n {\n "foreground": "005cc5",\n "token": "support.constant"\n },\n {\n "foreground": "005cc5",\n "token": "support.variable"\n },\n {\n "foreground": "005cc5",\n "token": "meta.module-reference"\n },\n {\n "foreground": "735c0f",\n "token": "markup.list"\n },\n {\n "foreground": "005cc5",\n "fontStyle": "bold",\n "token": "markup.heading"\n },\n {\n "foreground": "005cc5",\n "fontStyle": "bold",\n "token": "markup.heading entity.name"\n },\n {\n "foreground": "22863a",\n "token": "markup.quote"\n },\n {\n "foreground": "24292e",\n "fontStyle": "italic",\n "token": "markup.italic"\n },\n {\n "foreground": "24292e",\n "fontStyle": "bold",\n "token": "markup.bold"\n },\n {\n "foreground": "005cc5",\n "token": "markup.raw"\n },\n {\n "foreground": "b31d28",\n "background": "ffeef0",\n "token": "markup.deleted"\n },\n {\n "foreground": "b31d28",\n "background": "ffeef0",\n "token": "meta.diff.header.from-file"\n },\n {\n "foreground": "b31d28",\n "background": "ffeef0",\n "token": "punctuation.definition.deleted"\n },\n {\n "foreground": "22863a",\n "background": "f0fff4",\n "token": "markup.inserted"\n },\n {\n "foreground": "22863a",\n "background": "f0fff4",\n "token": "meta.diff.header.to-file"\n },\n {\n "foreground": "22863a",\n "background": "f0fff4",\n "token": "punctuation.definition.inserted"\n },\n {\n "foreground": "e36209",\n "background": "ffebda",\n "token": "markup.changed"\n },\n {\n "foreground": "e36209",\n "background": "ffebda",\n "token": "punctuation.definition.changed"\n },\n {\n "foreground": "f6f8fa",\n "background": "005cc5",\n "token": "markup.ignored"\n },\n {\n "foreground": "f6f8fa",\n "background": "005cc5",\n "token": "markup.untracked"\n },\n {\n "foreground": "6f42c1",\n "fontStyle": "bold",\n "token": "meta.diff.range"\n },\n {\n "foreground": "005cc5",\n "token": "meta.diff.header"\n },\n {\n "foreground": "005cc5",\n "fontStyle": "bold",\n "token": "meta.separator"\n },\n {\n "foreground": "005cc5",\n "token": "meta.output"\n },\n {\n "foreground": "586069",\n "token": "brackethighlighter.tag"\n },\n {\n "foreground": "586069",\n "token": "brackethighlighter.curly"\n },\n {\n "foreground": "586069",\n "token": "brackethighlighter.round"\n },\n {\n "foreground": "586069",\n "token": "brackethighlighter.square"\n },\n {\n "foreground": "586069",\n "token": "brackethighlighter.angle"\n },\n {\n "foreground": "586069",\n "token": "brackethighlighter.quote"\n },\n {\n "foreground": "b31d28",\n "token": "brackethighlighter.unmatched"\n },\n {\n "foreground": "b31d28",\n "token": "sublimelinter.mark.error"\n },\n {\n "foreground": "e36209",\n "token": "sublimelinter.mark.warning"\n },\n {\n "foreground": "959da5",\n "token": "sublimelinter.gutter-mark"\n },\n {\n "foreground": "032f62",\n "fontStyle": "underline",\n "token": "constant.other.reference.link"\n },\n {\n "foreground": "032f62",\n "fontStyle": "underline",\n "token": "string.other.link"\n }\n ],\n "colors": {\n "editor.foreground": "#24292e",\n "editor.background": "#fafafa",\n "editor.selectionBackground": "#c8c8fa",\n "editor.inactiveSelectionBackground": "#fafbfc",\n "editor.lineHighlightBackground": "#fafbfc",\n "editorCursor.foreground": "#24292e",\n "editorWhitespace.foreground": "#959da5",\n "editorIndentGuide.background": "#959da5",\n "editorIndentGuide.activeBackground": "#24292e",\n "editor.selectionHighlightBorder": "#fafbfc"\n }\n}\n';
|
|
2
|
+
|
|
3
|
+
export { monaco_theme_github_light_default as default };
|
package/esm/modules.d.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { snake } from 'radashi';
|
|
3
|
+
import config from 'unplugin-config/vite';
|
|
4
|
+
import { ENV_APP_PREFIX, DEFAULT_OUTPUT_DIR, DEFAULT_APP_NAME } from './constants.js';
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
function constantCase(value) {
|
|
8
|
+
return snake(value).toUpperCase();
|
|
9
|
+
}
|
|
10
|
+
function createAppConfigPlugin({
|
|
11
|
+
basePublicPath,
|
|
12
|
+
outputDir,
|
|
13
|
+
appName = DEFAULT_APP_NAME
|
|
14
|
+
}) {
|
|
15
|
+
return config({
|
|
16
|
+
appName: `VEF_${constantCase(appName)}`,
|
|
17
|
+
baseDir: basePublicPath,
|
|
18
|
+
configFile: {
|
|
19
|
+
generate: true,
|
|
20
|
+
fileName: "app.config.js",
|
|
21
|
+
outputDir: outputDir ?? DEFAULT_OUTPUT_DIR
|
|
22
|
+
},
|
|
23
|
+
htmlInjection: {
|
|
24
|
+
enable: true,
|
|
25
|
+
position: "head-prepend",
|
|
26
|
+
templates: ["index.html"]
|
|
27
|
+
},
|
|
28
|
+
envVariables: {
|
|
29
|
+
prefix: ENV_APP_PREFIX,
|
|
30
|
+
files: ["env/.env", "env/.env.production"]
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { createAppConfigPlugin };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import { DEFAULT_SERVER_PORT, ASSETS_DIR, DEFAULT_OUTPUT_DIR, DEFAULT_APP_NAME, ENV_BUILD_PREFIX, ENV_APP_PREFIX, ENV_DIR } from './constants.js';
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
function createConventionalConfigPlugin({
|
|
7
|
+
appName,
|
|
8
|
+
appVersion,
|
|
9
|
+
basePublicPath,
|
|
10
|
+
projectDir,
|
|
11
|
+
outputDir,
|
|
12
|
+
serverPort,
|
|
13
|
+
proxies
|
|
14
|
+
}) {
|
|
15
|
+
return {
|
|
16
|
+
name: "vef-framework:conventional-config",
|
|
17
|
+
config(_, { command }) {
|
|
18
|
+
const isDev = command === "serve";
|
|
19
|
+
return {
|
|
20
|
+
appType: "spa",
|
|
21
|
+
root: projectDir,
|
|
22
|
+
base: basePublicPath,
|
|
23
|
+
publicDir: "public",
|
|
24
|
+
envDir: ENV_DIR,
|
|
25
|
+
envPrefix: [ENV_BUILD_PREFIX, ENV_APP_PREFIX],
|
|
26
|
+
define: {
|
|
27
|
+
__VEF_FRAMEWORK_VERSION__: `"${process.env.VEF_FRAMEWORK_VERSION}"`,
|
|
28
|
+
__VEF_APP_VERSION__: `"${appVersion}"`,
|
|
29
|
+
__VEF_APP_CONFIG__: isDev ? `
|
|
30
|
+
(function () {
|
|
31
|
+
const env = import.meta.env;
|
|
32
|
+
const config = Object.keys(env).filter(key => key.startsWith(${JSON.stringify(ENV_APP_PREFIX)}))
|
|
33
|
+
.reduce((acc, key) => {
|
|
34
|
+
acc[key] = env[key];
|
|
35
|
+
return acc;
|
|
36
|
+
}, {});
|
|
37
|
+
return Object.freeze(config);
|
|
38
|
+
})()
|
|
39
|
+
` : `window.__PRODUCTION__VEF_${appName ?? DEFAULT_APP_NAME}__CONF__`
|
|
40
|
+
},
|
|
41
|
+
css: {
|
|
42
|
+
modules: {
|
|
43
|
+
scopeBehaviour: "local",
|
|
44
|
+
localsConvention: "camelCase"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
optimizeDeps: {
|
|
48
|
+
exclude: [],
|
|
49
|
+
esbuildOptions: {
|
|
50
|
+
plugins: []
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
esbuild: {
|
|
54
|
+
drop: ["console", "debugger"],
|
|
55
|
+
charset: "utf8",
|
|
56
|
+
minifyIdentifiers: false,
|
|
57
|
+
minifySyntax: true,
|
|
58
|
+
minifyWhitespace: true
|
|
59
|
+
},
|
|
60
|
+
build: {
|
|
61
|
+
outDir: outputDir ?? DEFAULT_OUTPUT_DIR,
|
|
62
|
+
target: "modules",
|
|
63
|
+
assetsDir: ASSETS_DIR,
|
|
64
|
+
assetsInlineLimit: 10240,
|
|
65
|
+
reportCompressedSize: false,
|
|
66
|
+
chunkSizeWarningLimit: 2048,
|
|
67
|
+
minify: true,
|
|
68
|
+
sourcemap: false,
|
|
69
|
+
rollupOptions: {
|
|
70
|
+
input: {
|
|
71
|
+
main: "index.html"
|
|
72
|
+
},
|
|
73
|
+
output: {
|
|
74
|
+
banner: `/*! Powered by VEF Framework v${process.env.VEF_FRAMEWORK_VERSION}.${appVersion ? ` App version v${appVersion}.` : ""} Built at ${(/* @__PURE__ */ new Date()).toISOString()} */`,
|
|
75
|
+
chunkFileNames: `${ASSETS_DIR}/js/[name]-[hash].js`,
|
|
76
|
+
entryFileNames: `${ASSETS_DIR}/js/[name]-[hash].js`,
|
|
77
|
+
assetFileNames: `${ASSETS_DIR}/[ext]/[name]-[hash].[ext]`,
|
|
78
|
+
manualChunks: {
|
|
79
|
+
"react": ["react", "react-dom"],
|
|
80
|
+
"vef-shared": ["@vef-framework/shared"],
|
|
81
|
+
"vef-components": ["@vef-framework/components"],
|
|
82
|
+
"vef-hooks": ["@vef-framework/hooks"],
|
|
83
|
+
"vef-core": ["@vef-framework/core"],
|
|
84
|
+
"vef-starter": ["@vef-framework/starter"],
|
|
85
|
+
"vef-intellisense-code-editor": ["monaco-editor", "@monaco-editor/react"],
|
|
86
|
+
"vef-code-editor": [
|
|
87
|
+
"@uiw/react-codemirror",
|
|
88
|
+
"@uiw/codemirror-extensions-langs",
|
|
89
|
+
"@uiw/codemirror-theme-material",
|
|
90
|
+
"codemirror-json-schema",
|
|
91
|
+
"codemirror-json5",
|
|
92
|
+
"@codemirror/state",
|
|
93
|
+
"@codemirror/view",
|
|
94
|
+
"@codemirror/lint",
|
|
95
|
+
"@codemirror/language",
|
|
96
|
+
"@codemirror/lang-yaml",
|
|
97
|
+
"@codemirror/lang-json"
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
server: {
|
|
104
|
+
port: serverPort || DEFAULT_SERVER_PORT,
|
|
105
|
+
host: true,
|
|
106
|
+
open: true,
|
|
107
|
+
proxy: proxies
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export { createConventionalConfigPlugin };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import eslint from 'vite-plugin-eslint2';
|
|
3
|
+
|
|
4
|
+
"use strict";
|
|
5
|
+
function createEslintPlugin() {
|
|
6
|
+
return eslint({
|
|
7
|
+
fix: true,
|
|
8
|
+
test: false,
|
|
9
|
+
dev: true,
|
|
10
|
+
build: false,
|
|
11
|
+
cache: true,
|
|
12
|
+
cacheLocation: "node_modules/.cache/.eslintcache",
|
|
13
|
+
include: ["*.{js,ts,json,jsonc,yaml,toml,md}", "src/**/*.{ts,tsx,json,jsonc,yaml,toml,md}"],
|
|
14
|
+
exclude: ["node_modules", "virtual:", "vef:"],
|
|
15
|
+
emitError: true,
|
|
16
|
+
emitWarning: true,
|
|
17
|
+
emitWarningAsError: true
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { createEslintPlugin };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { minify } from 'html-minifier-terser';
|
|
3
|
+
|
|
4
|
+
"use strict";
|
|
5
|
+
const virtualModuleId = "index.html";
|
|
6
|
+
const htmlContent = `
|
|
7
|
+
<!doctype html>
|
|
8
|
+
<html lang="en">
|
|
9
|
+
<head>
|
|
10
|
+
<meta charset="UTF-8" />
|
|
11
|
+
<link rel="icon" type="image/svg+xml" href="%VEF_APP_FAVICON%" />
|
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
13
|
+
<meta name="description" content="Powered by VEF Framework" />
|
|
14
|
+
<title>%VEF_APP_TITLE%</title>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<div id="root"></div>
|
|
18
|
+
<script type="module" src="src/main.ts"><\/script>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
21
|
+
`;
|
|
22
|
+
function createHtmlPlugin() {
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
name: "vef-framework:html",
|
|
26
|
+
resolveId(source) {
|
|
27
|
+
if (source === virtualModuleId) {
|
|
28
|
+
return virtualModuleId;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
load(id) {
|
|
32
|
+
if (id === virtualModuleId) {
|
|
33
|
+
return htmlContent;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
transformIndexHtml: {
|
|
37
|
+
order: "pre",
|
|
38
|
+
handler: () => htmlContent
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "vite-plugin-vef-framework-html-minify",
|
|
43
|
+
enforce: "post",
|
|
44
|
+
async generateBundle(_, bundles) {
|
|
45
|
+
for (const bundle of Object.values(bundles)) {
|
|
46
|
+
if (bundle.type === "asset" && typeof bundle.source === "string" && bundle.fileName === virtualModuleId) {
|
|
47
|
+
bundle.source = await minify(
|
|
48
|
+
bundle.source,
|
|
49
|
+
{
|
|
50
|
+
collapseBooleanAttributes: true,
|
|
51
|
+
collapseInlineTagWhitespace: true,
|
|
52
|
+
collapseWhitespace: true,
|
|
53
|
+
conservativeCollapse: false,
|
|
54
|
+
keepClosingSlash: true,
|
|
55
|
+
minifyCSS: true,
|
|
56
|
+
minifyJS: true,
|
|
57
|
+
minifyURLs: true,
|
|
58
|
+
noNewlinesBeforeTagClose: true,
|
|
59
|
+
quoteCharacter: `"`,
|
|
60
|
+
removeAttributeQuotes: false,
|
|
61
|
+
removeComments: true,
|
|
62
|
+
removeEmptyAttributes: true,
|
|
63
|
+
removeOptionalTags: false,
|
|
64
|
+
removeRedundantAttributes: true,
|
|
65
|
+
removeScriptTypeAttributes: false,
|
|
66
|
+
removeTagWhitespace: false,
|
|
67
|
+
removeEmptyElements: false,
|
|
68
|
+
removeStyleLinkTypeAttributes: false,
|
|
69
|
+
sortAttributes: true,
|
|
70
|
+
sortClassName: true,
|
|
71
|
+
trimCustomFragments: true,
|
|
72
|
+
useShortDoctype: true,
|
|
73
|
+
html5: true
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { createHtmlPlugin };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { resolve, dirname } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import icons from 'unplugin-icons/vite';
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
function createIconsPlugin(projectDir) {
|
|
8
|
+
return icons({
|
|
9
|
+
autoInstall: false,
|
|
10
|
+
compiler: "jsx",
|
|
11
|
+
jsx: "react",
|
|
12
|
+
defaultClass: "inline-block",
|
|
13
|
+
scale: 1.2,
|
|
14
|
+
collectionsNodeResolvePath: [projectDir, resolve(dirname(fileURLToPath(import.meta.url)), "..")]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { createIconsPlugin };
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
import monaco_theme_github_light_default from './json/monaco.theme.github-light.json.js';
|
|
3
|
+
|
|
4
|
+
"use strict";
|
|
5
|
+
const virtualModuleId = "vef:initialization";
|
|
6
|
+
const resolvedVirtualModuleId = `\0${virtualModuleId}`;
|
|
7
|
+
function createInitializationPlugin() {
|
|
8
|
+
return {
|
|
9
|
+
name: "vef-framework:initialization",
|
|
10
|
+
resolveId(id) {
|
|
11
|
+
if (id === virtualModuleId) {
|
|
12
|
+
return resolvedVirtualModuleId;
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
load(id) {
|
|
16
|
+
if (id === resolvedVirtualModuleId) {
|
|
17
|
+
return `import { loader } from "@monaco-editor/react";
|
|
2
18
|
import * as monaco from "monaco-editor";
|
|
3
19
|
import EditorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker";
|
|
4
20
|
import CssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker";
|
|
@@ -131,4 +147,10 @@ export function initializeIntellisenseCodeEditor() {
|
|
|
131
147
|
});
|
|
132
148
|
loader.init();
|
|
133
149
|
}
|
|
134
|
-
|
|
150
|
+
`;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export { createInitializationPlugin };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { basename, dirname } from 'node:path';
|
|
3
|
+
|
|
4
|
+
"use strict";
|
|
5
|
+
function createInjectionPlugin() {
|
|
6
|
+
return {
|
|
7
|
+
name: "vef-framework:injection",
|
|
8
|
+
transform(code, id) {
|
|
9
|
+
if (basename(dirname(id)) === "src" && basename(id).startsWith("main.ts")) {
|
|
10
|
+
return `import "vef:tailwind.css";
|
|
11
|
+
${code}`;
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { createInjectionPlugin };
|
|
@@ -1,4 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import monaco_nls_default from './json/monaco.nls.json.js';
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
const nlsRegex = /monaco-editor[/\\]esm[/\\]vs[/\\]nls\.js/;
|
|
7
|
+
const nlsPathRegex = /monaco-editor[/\\]esm[/\\](?<path>.+)\.js/;
|
|
8
|
+
const localizeFnInvocationRegex = /localize\(/g;
|
|
9
|
+
function createMonacoNlsEsbuildPlugin() {
|
|
10
|
+
return {
|
|
11
|
+
name: "vef-framework:monaco-editor-nls",
|
|
12
|
+
setup(build) {
|
|
13
|
+
build.onLoad({ filter: nlsRegex }, () => ({
|
|
14
|
+
contents: buildNlsCode(),
|
|
15
|
+
loader: "js"
|
|
16
|
+
}));
|
|
17
|
+
build.onLoad({ filter: nlsPathRegex }, async ({ path }) => ({
|
|
18
|
+
contents: transformLocalizeFnInvocationCode(path, await readFile(path.split("?")[0], "utf8")),
|
|
19
|
+
loader: "js"
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function createMonacoNlsRollupPlugin() {
|
|
25
|
+
return {
|
|
26
|
+
name: "vef-framework:monaco-editor-nls",
|
|
27
|
+
enforce: "pre",
|
|
28
|
+
load(id) {
|
|
29
|
+
if (nlsRegex.test(id)) {
|
|
30
|
+
return buildNlsCode();
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
transform(code, id) {
|
|
34
|
+
if (!nlsRegex.test(id)) {
|
|
35
|
+
return {
|
|
36
|
+
code: transformLocalizeFnInvocationCode(id, code),
|
|
37
|
+
map: null
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function transformLocalizeFnInvocationCode(file, code) {
|
|
44
|
+
const match = nlsPathRegex.exec(file);
|
|
45
|
+
if (match) {
|
|
46
|
+
const path = match.groups.path.replace(/\\/g, "/");
|
|
47
|
+
return code.replace(localizeFnInvocationRegex, `localize('${path}', `);
|
|
48
|
+
}
|
|
49
|
+
return code;
|
|
50
|
+
}
|
|
51
|
+
function buildNlsCode() {
|
|
52
|
+
return `/*---------------------------------------------------------------------------------------------
|
|
2
53
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
54
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
55
|
*--------------------------------------------------------------------------------------------*
|
|
@@ -76,4 +127,7 @@ export function localize2(data /* | number when built */, originalMessage, ...ar
|
|
|
76
127
|
value,
|
|
77
128
|
original: originalMessage === message ? value : _format(originalMessage, args)
|
|
78
129
|
};
|
|
79
|
-
}
|
|
130
|
+
}`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export { createMonacoNlsEsbuildPlugin, createMonacoNlsRollupPlugin };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { TanStackRouterVite } from '@tanstack/router-plugin/vite';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import { SRC_DIR, ROUTER_DIR, PAGES_DIR } from './constants.js';
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
function createRouterPlugin(projectDir, history = "hash", autoCodeSplitting) {
|
|
8
|
+
return TanStackRouterVite({
|
|
9
|
+
routesDirectory: resolve(projectDir, SRC_DIR, PAGES_DIR),
|
|
10
|
+
generatedRouteTree: resolve(projectDir, SRC_DIR, ROUTER_DIR, "router.gen.ts"),
|
|
11
|
+
quoteStyle: "double",
|
|
12
|
+
semicolons: true,
|
|
13
|
+
disableTypes: false,
|
|
14
|
+
addExtensions: false,
|
|
15
|
+
disableLogging: false,
|
|
16
|
+
disableManifestGeneration: false,
|
|
17
|
+
routeFileIgnorePattern: "components",
|
|
18
|
+
indexToken: "index",
|
|
19
|
+
routeToken: "route",
|
|
20
|
+
enableRouteGeneration: true,
|
|
21
|
+
autoCodeSplitting,
|
|
22
|
+
routeTreeFileHeader: [
|
|
23
|
+
"/* eslint-disable */",
|
|
24
|
+
"// @ts-nocheck",
|
|
25
|
+
"// noinspection JSUnusedGlobalSymbols",
|
|
26
|
+
`import { createRouter } from "@vef-framework/starter";`
|
|
27
|
+
],
|
|
28
|
+
routeTreeFileFooter: [
|
|
29
|
+
`const router = createRouter({
|
|
30
|
+
routeTree,
|
|
31
|
+
history: "${history}",
|
|
32
|
+
});
|
|
33
|
+
`,
|
|
34
|
+
`declare module "@tanstack/react-router" {
|
|
35
|
+
interface Register {
|
|
36
|
+
router: typeof router;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`,
|
|
40
|
+
`export default router;`
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { createRouterPlugin };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import stylelint from 'vite-plugin-stylelint';
|
|
3
|
+
|
|
4
|
+
"use strict";
|
|
5
|
+
function createStylelintPlugin() {
|
|
6
|
+
return stylelint({
|
|
7
|
+
fix: true,
|
|
8
|
+
test: false,
|
|
9
|
+
dev: true,
|
|
10
|
+
build: false,
|
|
11
|
+
cache: true,
|
|
12
|
+
cacheLocation: "node_modules/.cache/.stylelintcache",
|
|
13
|
+
include: ["src/**/*.{scss,css}"],
|
|
14
|
+
exclude: ["node_modules", "virtual:", "vef:"],
|
|
15
|
+
emitError: true,
|
|
16
|
+
emitWarning: true,
|
|
17
|
+
emitWarningAsError: true
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { createStylelintPlugin };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import svgr from 'vite-plugin-svgr';
|
|
3
|
+
|
|
4
|
+
"use strict";
|
|
5
|
+
function createSvgrPlugin() {
|
|
6
|
+
return svgr({
|
|
7
|
+
include: "**/*.svg?react",
|
|
8
|
+
esbuildOptions: {
|
|
9
|
+
platform: "browser",
|
|
10
|
+
minify: true,
|
|
11
|
+
jsx: "automatic"
|
|
12
|
+
},
|
|
13
|
+
svgrOptions: {
|
|
14
|
+
plugins: [
|
|
15
|
+
"@svgr/plugin-svgo",
|
|
16
|
+
"@svgr/plugin-jsx"
|
|
17
|
+
],
|
|
18
|
+
icon: false,
|
|
19
|
+
dimensions: false,
|
|
20
|
+
prettier: true,
|
|
21
|
+
memo: true,
|
|
22
|
+
svgo: true,
|
|
23
|
+
ref: false,
|
|
24
|
+
typescript: true,
|
|
25
|
+
jsxRuntime: "automatic",
|
|
26
|
+
svgoConfig: {
|
|
27
|
+
multipass: true,
|
|
28
|
+
datauri: "base64",
|
|
29
|
+
js2svg: {
|
|
30
|
+
indent: 2,
|
|
31
|
+
pretty: true
|
|
32
|
+
},
|
|
33
|
+
plugins: [
|
|
34
|
+
"preset-default",
|
|
35
|
+
{
|
|
36
|
+
name: "prefixIds",
|
|
37
|
+
params: {
|
|
38
|
+
prefix: "vef"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "cleanupIds",
|
|
43
|
+
params: {
|
|
44
|
+
force: true,
|
|
45
|
+
remove: true,
|
|
46
|
+
minify: true
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
svgProps: {}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { createSvgrPlugin };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
const virtualModuleId = "vef:tailwind.css";
|
|
4
|
+
const resolvedVirtualModuleId = `\0${virtualModuleId}`;
|
|
5
|
+
function createTailwindcssPlugin() {
|
|
6
|
+
return {
|
|
7
|
+
name: "vef-framework:tailwindcss",
|
|
8
|
+
resolveId(id) {
|
|
9
|
+
if (id === virtualModuleId) {
|
|
10
|
+
return resolvedVirtualModuleId;
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
load(id) {
|
|
14
|
+
if (id === resolvedVirtualModuleId) {
|
|
15
|
+
return `@import "tailwindcss";
|
|
16
|
+
@config "./tailwind.config.js";`;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { createTailwindcssPlugin };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { visualizer } from 'rollup-plugin-visualizer';
|
|
3
|
+
|
|
4
|
+
"use strict";
|
|
5
|
+
function createVisualizerPlugin(projectDir) {
|
|
6
|
+
return visualizer({
|
|
7
|
+
filename: "dist/stats.html",
|
|
8
|
+
title: "Building Visualizer",
|
|
9
|
+
projectRoot: projectDir
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { createVisualizerPlugin };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import webfont from 'vite-plugin-webfont-dl';
|
|
3
|
+
|
|
4
|
+
"use strict";
|
|
5
|
+
function createWebfontPlugin() {
|
|
6
|
+
return webfont([
|
|
7
|
+
"https://fonts.googleapis.com/css2?family=PT+Sans+Caption:wght@400;700&family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap",
|
|
8
|
+
"https://fonts.googleapis.com/css2?family=Martian+Mono:wght@100..800&family=PT+Sans+Caption:wght@400;700&family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap"
|
|
9
|
+
]);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { createWebfontPlugin };
|