likec4 1.48.0 → 1.50.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/README.md +11 -1
- package/__app__/src/likec4.js +5941 -4496
- package/__app__/src/routes/index.js +3 -153
- package/__app__/src/routes/projects.js +21 -1087
- package/__app__/src/routes/single.js +1228 -16
- package/__app__/src/style.css +1 -1
- package/__app__/src/vendors.js +4649 -1897
- package/__app__/src/webcomponent.js +1 -1
- package/config/schema.json +169 -141
- package/dist/THIRD-PARTY-LICENSES.md +1769 -0
- package/dist/_chunks/LikeC4.mjs +1154 -202
- package/dist/_chunks/binary.mjs +72 -0
- package/dist/_chunks/index.d.mts +234 -140
- package/dist/_chunks/index2.d.mts +2043 -1828
- package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +30 -0
- package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -785
- package/dist/_chunks/libs/@chevrotain/utils.mjs +1 -37
- package/dist/_chunks/libs/@hono/mcp.mjs +34 -0
- package/dist/_chunks/libs/@hono/node-server.mjs +1 -436
- package/dist/_chunks/libs/@logtape/logtape.d.mts +741 -0
- package/dist/_chunks/libs/@logtape/logtape.mjs +6 -1354
- package/dist/_chunks/libs/@lume/kiwi.mjs +1 -1355
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +114 -14
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +12 -25105
- package/dist/_chunks/libs/@msgpack/msgpack.mjs +1 -1503
- package/dist/_chunks/libs/@nanostores/react.d.mts +61 -1
- package/dist/_chunks/libs/@nanostores/react.mjs +1 -30
- package/dist/_chunks/libs/@smithy/is-array-buffer.mjs +1 -10
- package/dist/_chunks/libs/@smithy/util-base64.mjs +1 -100
- package/dist/_chunks/libs/ajv.mjs +1 -777
- package/dist/_chunks/libs/atomically.mjs +1 -362
- package/dist/_chunks/libs/birpc.mjs +1 -201
- package/dist/_chunks/libs/chevrotain-allstar.mjs +2 -850
- package/dist/_chunks/libs/chevrotain.mjs +55 -6229
- package/dist/_chunks/libs/conf.mjs +1 -2258
- package/dist/_chunks/libs/defu.mjs +1 -42
- package/dist/_chunks/libs/esm-env.mjs +1 -5
- package/dist/_chunks/libs/eventemitter3.mjs +1 -243
- package/dist/_chunks/libs/fast-equals.mjs +1 -446
- package/dist/_chunks/libs/find-up-simple.mjs +1 -24
- package/dist/_chunks/libs/get-port.mjs +1 -107
- package/dist/_chunks/libs/is-docker.mjs +1 -26
- package/dist/_chunks/libs/is-error-instance.mjs +1 -26
- package/dist/_chunks/libs/is-inside-container.mjs +1 -20
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
- package/dist/_chunks/libs/isexe.mjs +1 -127
- package/dist/_chunks/libs/json5.mjs +14 -959
- package/dist/_chunks/libs/khroma.mjs +1 -605
- package/dist/_chunks/libs/ky.mjs +2 -807
- package/dist/_chunks/libs/langium.d.mts +2913 -2876
- package/dist/_chunks/libs/langium.mjs +33 -20351
- package/dist/_chunks/libs/merge-error-cause.mjs +2 -746
- package/dist/_chunks/libs/p-limit.mjs +1 -120
- package/dist/_chunks/libs/p-queue.mjs +1 -449
- package/dist/_chunks/libs/package-manager-detector.mjs +1 -559
- package/dist/_chunks/libs/package-up.mjs +1 -10
- package/dist/_chunks/libs/pako.mjs +1 -0
- package/dist/_chunks/libs/parse-ms.mjs +1 -36
- package/dist/_chunks/libs/pathe.mjs +1 -0
- package/dist/_chunks/libs/picomatch.mjs +1 -1673
- package/dist/_chunks/libs/pretty-ms.mjs +1 -80
- package/dist/_chunks/libs/remeda.mjs +2 -690
- package/dist/_chunks/libs/safe-stringify.mjs +1 -21
- package/dist/_chunks/libs/strip-indent.mjs +1 -15
- package/dist/_chunks/libs/tinyrainbow.mjs +1 -88
- package/dist/_chunks/libs/ts-graphviz.mjs +4 -725
- package/dist/_chunks/libs/ufo.mjs +1 -240
- package/dist/_chunks/libs/which.mjs +1 -84
- package/dist/_chunks/libs/word-wrap.mjs +12 -43
- package/dist/_chunks/rolldown-runtime.mjs +1 -48
- package/dist/_chunks/sequence.mjs +1 -0
- package/dist/_chunks/src.mjs +15 -0
- package/dist/_chunks/src2.mjs +499 -0
- package/dist/cli/index.mjs +77 -1952
- package/dist/config/index.d.mts +2 -2
- package/dist/config/index.mjs +1 -6
- package/dist/index.d.mts +150 -7
- package/dist/index.mjs +1 -21
- package/dist/model/builder.mjs +1 -3
- package/dist/model/index.d.mts +57 -3
- package/dist/model/index.mjs +1 -5
- package/dist/vite-plugin/index.d.mts +7 -3
- package/dist/vite-plugin/index.mjs +1 -22
- package/dist/vite-plugin/internal.d.mts +6 -7
- package/dist/vite-plugin/internal.mjs +1 -68
- package/package.json +64 -45
- package/react/{index.d.ts → index.d.mts} +114 -72
- package/react/{index.js → index.mjs} +21320 -22041
- package/react/package.json +2 -5
- package/vite-plugin-modules.d.ts +10 -5
- package/dist/_chunks/LikeC4.d.mts +0 -121
- package/dist/_chunks/config-app.prod.d.mts +0 -18
- package/dist/_chunks/config-app.prod.mjs +0 -188
- package/dist/_chunks/config-webcomponent.prod.mjs +0 -71
- package/dist/_chunks/define-config.mjs +0 -409
- package/dist/_chunks/index3.d.mts +0 -60
- package/dist/_chunks/libs/@chevrotain/gast.mjs +0 -3969
- package/dist/_chunks/libs/hono.mjs +0 -1829
- package/dist/_chunks/libs/nanoid.mjs +0 -29
- package/dist/_chunks/libs/nanostores.d.mts +0 -63
- package/dist/_chunks/libs/nanostores.mjs +0 -198
- package/dist/_chunks/model.mjs +0 -12
- package/dist/_chunks/module.d.mts +0 -71
- package/dist/_chunks/module.mjs +0 -18657
- package/dist/_chunks/plugin.mjs +0 -996
- package/dist/_chunks/sequence-view.mjs +0 -575
- package/dist/_chunks/vite-build.mjs +0 -69
- package/dist/_chunks/vite-dev.mjs +0 -79
- package/dist/_chunks/vite-preview.mjs +0 -27
- package/dist/language/module.d.mts +0 -5
- package/dist/language/module.mjs +0 -20
- package/dist/vite/vite-build.d.mts +0 -26
- package/dist/vite/vite-build.mjs +0 -27
- package/dist/vite/vite-dev.d.mts +0 -34
- package/dist/vite/vite-dev.mjs +0 -29
- package/dist/vite/vite-preview.d.mts +0 -20
- package/dist/vite/vite-preview.mjs +0 -26
- /package/dist/_chunks/{index4.d.mts → libs/@chevrotain/types.d.mts} +0 -0
package/react/package.json
CHANGED
package/vite-plugin-modules.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ declare module 'likec4:icons' {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export type ElementIconRenderer = (props: ElementIconRendererProps) => ReactNode
|
|
31
|
-
export
|
|
31
|
+
export function getProjectIcons(projectId: string): ElementIconRenderer
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
declare module 'likec4:model' {
|
|
@@ -54,8 +54,8 @@ declare module 'likec4:single-project' {
|
|
|
54
54
|
types,
|
|
55
55
|
UnknownLayouted,
|
|
56
56
|
} from 'likec4/model'
|
|
57
|
-
import type { ElementIconRenderer } from 'likec4:icons'
|
|
58
57
|
import type { Atom } from 'likec4/vite-plugin/internal'
|
|
58
|
+
import type { ElementIconRenderer } from 'likec4:icons'
|
|
59
59
|
|
|
60
60
|
export const $likec4data: Atom<LayoutedLikeC4ModelData>
|
|
61
61
|
export const $likec4model: Atom<LikeC4Model<UnknownLayouted>>
|
|
@@ -109,6 +109,11 @@ declare module 'likec4:puml' {
|
|
|
109
109
|
pumlSource(this: void, viewId: string): string
|
|
110
110
|
}>
|
|
111
111
|
}
|
|
112
|
+
declare module 'likec4:drawio' {
|
|
113
|
+
export function loadDrawioSources(projectId: string): Promise<{
|
|
114
|
+
drawioEditUrl(this: void, viewId: string): string
|
|
115
|
+
}>
|
|
116
|
+
}
|
|
112
117
|
|
|
113
118
|
// Per project
|
|
114
119
|
|
|
@@ -117,7 +122,7 @@ declare module 'likec4:model/*' {
|
|
|
117
122
|
import type { Atom } from 'likec4:model'
|
|
118
123
|
|
|
119
124
|
// This will be used later for augmenting the types
|
|
120
|
-
|
|
125
|
+
interface Types extends UnknownLayouted {
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
export type LikeC4ViewId = aux.ViewId<Types>
|
|
@@ -165,7 +170,7 @@ declare module 'likec4:rpc' {
|
|
|
165
170
|
import type { LikeC4VitePluginRpc } from 'likec4/vite-plugin/internal'
|
|
166
171
|
|
|
167
172
|
export type { LikeC4VitePluginRpc }
|
|
168
|
-
export
|
|
173
|
+
export const likec4rpc: LikeC4VitePluginRpc
|
|
169
174
|
|
|
170
|
-
export
|
|
175
|
+
export const isRpcAvailable: boolean
|
|
171
176
|
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { i as ProjectsManager, r as LikeC4Views, t as LikeC4LanguageServices } from "./index2.mjs";
|
|
2
|
-
import { a as createLanguageServices, o as Logger } from "./module.mjs";
|
|
3
|
-
import { M as index_d_exports, v as LikeC4Model } from "./index3.mjs";
|
|
4
|
-
import { NonEmptyArray, ProjectId } from "@likec4/core";
|
|
5
|
-
|
|
6
|
-
//#region src/LikeC4.d.ts
|
|
7
|
-
type LikeC4Langium = ReturnType<typeof createLanguageServices>;
|
|
8
|
-
type LikeC4Options = {
|
|
9
|
-
/**
|
|
10
|
-
* By default, if LikeC4 model is invalid, errors are printed to the console.
|
|
11
|
-
* Disable this behavior by setting this option to false.
|
|
12
|
-
*
|
|
13
|
-
* @default true
|
|
14
|
-
*/
|
|
15
|
-
printErrors?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* If true, initialization will return rejected promise with the LikeC4 instance.
|
|
18
|
-
* Use `likec4.getErrors()` to get the errors.
|
|
19
|
-
* @default false
|
|
20
|
-
*/
|
|
21
|
-
throwIfInvalid?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Logger to use for the language service.
|
|
24
|
-
* false - no output
|
|
25
|
-
* @default 'default'
|
|
26
|
-
*/
|
|
27
|
-
logger?: Logger | 'vite' | 'default' | false;
|
|
28
|
-
/**
|
|
29
|
-
* Whether to use the `dot` binary for layouting or the WebAssembly version.
|
|
30
|
-
* @default 'wasm'
|
|
31
|
-
*/
|
|
32
|
-
graphviz?: 'wasm' | 'binary';
|
|
33
|
-
/**
|
|
34
|
-
* Whether to start MCP server
|
|
35
|
-
* @default false
|
|
36
|
-
*/
|
|
37
|
-
mcp?: false | 'stdio' | {
|
|
38
|
-
port: number;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Whether to watch for changes in the workspace.
|
|
42
|
-
* @default false
|
|
43
|
-
*/
|
|
44
|
-
watch?: boolean;
|
|
45
|
-
};
|
|
46
|
-
declare class LikeC4 {
|
|
47
|
-
readonly workspace: string;
|
|
48
|
-
readonly langium: LikeC4Langium;
|
|
49
|
-
static fromSource(likec4SourceCode: string, opts?: LikeC4Options): Promise<LikeC4>;
|
|
50
|
-
/**
|
|
51
|
-
* Prevents multiple instances of LikeC4 for the same workspace
|
|
52
|
-
*/
|
|
53
|
-
private static likec4Instances;
|
|
54
|
-
/**
|
|
55
|
-
* Initializes a LikeC4 instance from the specified workspace path.
|
|
56
|
-
* By default in current folder
|
|
57
|
-
*/
|
|
58
|
-
static fromWorkspace(path?: string, opts?: LikeC4Options): Promise<LikeC4>;
|
|
59
|
-
private logger;
|
|
60
|
-
private constructor();
|
|
61
|
-
get languageServices(): LikeC4LanguageServices;
|
|
62
|
-
get projectsManager(): ProjectsManager;
|
|
63
|
-
get viewsService(): LikeC4Views;
|
|
64
|
-
private get LangiumDocuments();
|
|
65
|
-
ensureSingleProject(): void;
|
|
66
|
-
/**
|
|
67
|
-
* Diagram is a computed view, layouted using Graphviz
|
|
68
|
-
* If diagram has manual layout, it will be used.
|
|
69
|
-
* Used in React components
|
|
70
|
-
*/
|
|
71
|
-
diagrams(projectId?: ProjectId | undefined): Promise<index_d_exports.DiagramView[]>;
|
|
72
|
-
/**
|
|
73
|
-
* Builds LikeC4Model from all documents
|
|
74
|
-
* Only computes view predicates {@link ComputedView} - i.e. no layout
|
|
75
|
-
* Not ready for rendering, but enough to traverse
|
|
76
|
-
*
|
|
77
|
-
* Sync version does not read manual layouts
|
|
78
|
-
* Use {@link computedModel} for a version that includes manual layouts
|
|
79
|
-
*/
|
|
80
|
-
syncComputedModel(project?: ProjectId | undefined): LikeC4Model.Computed;
|
|
81
|
-
/**
|
|
82
|
-
* Builds LikeC4Model from all documents
|
|
83
|
-
* Only computes view predicates {@link ComputedView} - i.e. no layout
|
|
84
|
-
* Not ready for rendering, but enough to traverse
|
|
85
|
-
*/
|
|
86
|
-
computedModel(project?: ProjectId | undefined): Promise<LikeC4Model.Computed>;
|
|
87
|
-
projects(): NonEmptyArray<ProjectId>;
|
|
88
|
-
/**
|
|
89
|
-
* Same as {@link computedModel()}, but also applies layout
|
|
90
|
-
* Ready for rendering
|
|
91
|
-
*/
|
|
92
|
-
layoutedModel(project?: ProjectId | undefined): Promise<LikeC4Model.Layouted>;
|
|
93
|
-
getErrors(): Array<{
|
|
94
|
-
message: string;
|
|
95
|
-
line: number;
|
|
96
|
-
range: {
|
|
97
|
-
start: {
|
|
98
|
-
line: number;
|
|
99
|
-
character: number;
|
|
100
|
-
};
|
|
101
|
-
end: {
|
|
102
|
-
line: number;
|
|
103
|
-
character: number;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
sourceFsPath: string;
|
|
107
|
-
}>;
|
|
108
|
-
hasErrors(): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* @returns true if there are errors
|
|
111
|
-
*/
|
|
112
|
-
printErrors(): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* @returns a function to dispose the listener
|
|
115
|
-
*/
|
|
116
|
-
onModelUpdate(listener: () => void): () => void;
|
|
117
|
-
dispose(): Promise<void>;
|
|
118
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
119
|
-
}
|
|
120
|
-
//#endregion
|
|
121
|
-
export { LikeC4Options as n, LikeC4 as t };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { s as ViteLogger } from "./module.mjs";
|
|
2
|
-
import { t as LikeC4 } from "./LikeC4.mjs";
|
|
3
|
-
import "vite";
|
|
4
|
-
|
|
5
|
-
//#region src/vite/config-app.prod.d.ts
|
|
6
|
-
type LikeC4ViteConfig = {
|
|
7
|
-
customLogger?: ViteLogger;
|
|
8
|
-
languageServices: LikeC4;
|
|
9
|
-
outputDir?: string | undefined;
|
|
10
|
-
base?: string | undefined;
|
|
11
|
-
title?: string | undefined;
|
|
12
|
-
webcomponentPrefix?: string | undefined;
|
|
13
|
-
useHashHistory?: boolean | undefined;
|
|
14
|
-
likec4AssetsDir: string;
|
|
15
|
-
outputSingleFile?: boolean | undefined;
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
18
|
-
export { LikeC4ViteConfig as t };
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { H as r } from "./libs/remeda.mjs";
|
|
2
|
-
import { t as u } from "./libs/tinyrainbow.mjs";
|
|
3
|
-
import { d as logger, i as createLikeC4Logger } from "./module.mjs";
|
|
4
|
-
import { c as withLeadingSlash, r as hasProtocol, u as withTrailingSlash } from "./libs/ufo.mjs";
|
|
5
|
-
import { t as packageUpSync } from "./libs/package-up.mjs";
|
|
6
|
-
import { t as LikeC4VitePlugin } from "./plugin.mjs";
|
|
7
|
-
import { existsSync } from "node:fs";
|
|
8
|
-
import { dirname, join, resolve } from "node:path";
|
|
9
|
-
import { fileURLToPath } from "node:url";
|
|
10
|
-
import { mkdtemp, writeFile } from "node:fs/promises";
|
|
11
|
-
import { tmpdir } from "node:os";
|
|
12
|
-
import react from "@vitejs/plugin-react";
|
|
13
|
-
import { viteSingleFile } from "vite-plugin-singlefile";
|
|
14
|
-
|
|
15
|
-
//#region src/vite/utils.ts
|
|
16
|
-
const viteLogger = createLikeC4Logger("vite");
|
|
17
|
-
const _dirname = dirname(fileURLToPath(import.meta.url));
|
|
18
|
-
const banner = `
|
|
19
|
-
/* prettier-ignore-start */
|
|
20
|
-
/* eslint-disable */
|
|
21
|
-
|
|
22
|
-
/******************************************************************************
|
|
23
|
-
* This file was generated
|
|
24
|
-
* DO NOT EDIT MANUALLY!
|
|
25
|
-
******************************************************************************/
|
|
26
|
-
|
|
27
|
-
`.trimStart();
|
|
28
|
-
const footer = `
|
|
29
|
-
|
|
30
|
-
/* prettier-ignore-end */
|
|
31
|
-
`;
|
|
32
|
-
const JsBanners = {
|
|
33
|
-
banner,
|
|
34
|
-
footer
|
|
35
|
-
};
|
|
36
|
-
function findPkgRoot() {
|
|
37
|
-
const pkgRoot = packageUpSync({ cwd: _dirname });
|
|
38
|
-
if (!pkgRoot) throw new Error(`likec4 package folder not found`);
|
|
39
|
-
return dirname(pkgRoot);
|
|
40
|
-
}
|
|
41
|
-
function viteAppRoot() {
|
|
42
|
-
const roots = [
|
|
43
|
-
resolve(findPkgRoot(), "__app__"),
|
|
44
|
-
resolve(_dirname, "../__app__"),
|
|
45
|
-
resolve(_dirname, "../../__app__"),
|
|
46
|
-
resolve(_dirname, "../../dist/__app__")
|
|
47
|
-
];
|
|
48
|
-
const root = r(roots, existsSync);
|
|
49
|
-
if (!root) {
|
|
50
|
-
logger.error(`likec4 app root does not exist, tried:\n${roots.join("\n")}`);
|
|
51
|
-
throw new Error(`likec4 app root does not exist`);
|
|
52
|
-
}
|
|
53
|
-
return root;
|
|
54
|
-
}
|
|
55
|
-
async function mkTempPublicDir() {
|
|
56
|
-
const publicDir = await mkdtemp(join(tmpdir(), ".likec4-public-"));
|
|
57
|
-
await writeFile(join(publicDir, "likec4-views.js"), "// generated by likec4\n");
|
|
58
|
-
return publicDir;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Adjust chunk size warning limit (in kB).
|
|
62
|
-
*/
|
|
63
|
-
const chunkSizeWarningLimit = 1e4;
|
|
64
|
-
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region src/vite/aliases.prod.ts
|
|
67
|
-
function viteAliases() {
|
|
68
|
-
const pkg = findPkgRoot();
|
|
69
|
-
return {
|
|
70
|
-
"likec4/icons": "@likec4/icons",
|
|
71
|
-
"likec4/react": resolve(pkg, "react/index.js"),
|
|
72
|
-
"likec4/model": resolve(pkg, "dist/model/index.mjs"),
|
|
73
|
-
"likec4/vite-plugin/internal": resolve(pkg, "dist/vite-plugin/internal.mjs")
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region src/vite/config-app.prod.ts
|
|
79
|
-
const viteConfig = async ({ languageServices, likec4AssetsDir, ...cfg }) => {
|
|
80
|
-
const customLogger = cfg.customLogger ?? viteLogger;
|
|
81
|
-
const root = viteAppRoot();
|
|
82
|
-
customLogger.info(`${u.cyan("likec4 app root")} ${u.dim(root)}`);
|
|
83
|
-
const outDir = cfg.outputDir ?? resolve(languageServices.workspace, "dist");
|
|
84
|
-
customLogger.info(u.cyan("outDir") + " " + u.dim(outDir));
|
|
85
|
-
let base = "/";
|
|
86
|
-
if (cfg.base) {
|
|
87
|
-
base = withTrailingSlash(cfg.base);
|
|
88
|
-
if (!hasProtocol(base) && base !== "./") base = withLeadingSlash(base);
|
|
89
|
-
}
|
|
90
|
-
if (base !== "/") customLogger.info(`${u.green("app base url")} ${u.dim(base)}`);
|
|
91
|
-
const webcomponentPrefix = cfg.webcomponentPrefix ?? "likec4";
|
|
92
|
-
const title = cfg.title ?? "LikeC4";
|
|
93
|
-
const isSingleFile = cfg.outputSingleFile ?? false;
|
|
94
|
-
return {
|
|
95
|
-
isDev: false,
|
|
96
|
-
likec4AssetsDir,
|
|
97
|
-
webcomponentPrefix,
|
|
98
|
-
title,
|
|
99
|
-
root,
|
|
100
|
-
languageServices,
|
|
101
|
-
clearScreen: false,
|
|
102
|
-
base,
|
|
103
|
-
resolve: {
|
|
104
|
-
conditions: ["production"],
|
|
105
|
-
dedupe: [
|
|
106
|
-
"react",
|
|
107
|
-
"react-dom",
|
|
108
|
-
"react/jsx-runtime",
|
|
109
|
-
"react/jsx-dev-runtime",
|
|
110
|
-
"react-dom/client"
|
|
111
|
-
],
|
|
112
|
-
alias: {
|
|
113
|
-
...viteAliases(),
|
|
114
|
-
"likec4/previews": likec4AssetsDir
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
configFile: false,
|
|
118
|
-
mode: "production",
|
|
119
|
-
optimizeDeps: {
|
|
120
|
-
include: [
|
|
121
|
-
"react",
|
|
122
|
-
"react-dom",
|
|
123
|
-
"react/jsx-runtime",
|
|
124
|
-
"react/jsx-dev-runtime",
|
|
125
|
-
"react-dom/client",
|
|
126
|
-
"@likec4/core/types",
|
|
127
|
-
"@likec4/core/model",
|
|
128
|
-
"@likec4/core/styles",
|
|
129
|
-
"@likec4/core/utils",
|
|
130
|
-
"@likec4/core",
|
|
131
|
-
"likec4/model",
|
|
132
|
-
"likec4/react",
|
|
133
|
-
"likec4/vite-plugin/internal"
|
|
134
|
-
],
|
|
135
|
-
noDiscovery: true
|
|
136
|
-
},
|
|
137
|
-
esbuild: { tsconfigRaw: { compilerOptions: {
|
|
138
|
-
target: "ESNext",
|
|
139
|
-
jsx: "react-jsx"
|
|
140
|
-
} } },
|
|
141
|
-
define: {
|
|
142
|
-
WEBCOMPONENT_PREFIX: JSON.stringify(webcomponentPrefix),
|
|
143
|
-
PAGE_TITLE: JSON.stringify(title),
|
|
144
|
-
__USE_HASH_HISTORY__: cfg?.useHashHistory === true ? "true" : "false",
|
|
145
|
-
"process.env.NODE_ENV": "\"production\""
|
|
146
|
-
},
|
|
147
|
-
build: {
|
|
148
|
-
outDir,
|
|
149
|
-
emptyOutDir: false,
|
|
150
|
-
sourcemap: false,
|
|
151
|
-
cssMinify: false,
|
|
152
|
-
minify: true,
|
|
153
|
-
copyPublicDir: true,
|
|
154
|
-
chunkSizeWarningLimit,
|
|
155
|
-
assetsInlineLimit: 1e5,
|
|
156
|
-
rollupOptions: {
|
|
157
|
-
treeshake: { preset: "recommended" },
|
|
158
|
-
...!isSingleFile && {
|
|
159
|
-
input: [
|
|
160
|
-
resolve(root, "index.html"),
|
|
161
|
-
resolve(root, "src", "main.js"),
|
|
162
|
-
resolve(root, "src", "fonts.css"),
|
|
163
|
-
resolve(root, "src", "style.css")
|
|
164
|
-
],
|
|
165
|
-
output: { manualChunks: (id) => {
|
|
166
|
-
if (id.endsWith(".css") || id.endsWith(".html") || id.includes("likec4/icons")) return;
|
|
167
|
-
if (id.includes("__app__")) {
|
|
168
|
-
let match = id.match(/__app__\/src\/([\w]+)\.js/)?.[1];
|
|
169
|
-
if (match) return match[1];
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
if (id.includes("node_modules/likec4") || id.includes("node_modules/@likec4")) return "likec4";
|
|
173
|
-
if (id.includes("node_modules")) return "vendors";
|
|
174
|
-
} }
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
customLogger,
|
|
179
|
-
plugins: [
|
|
180
|
-
react(),
|
|
181
|
-
LikeC4VitePlugin({ languageServices: languageServices.languageServices }),
|
|
182
|
-
isSingleFile ? viteSingleFile() : void 0
|
|
183
|
-
]
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
//#endregion
|
|
188
|
-
export { mkTempPublicDir as a, chunkSizeWarningLimit as i, viteAliases as n, viteAppRoot as o, JsBanners as r, viteConfig as t };
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { t as u } from "./libs/tinyrainbow.mjs";
|
|
2
|
-
import { i as createLikeC4Logger } from "./module.mjs";
|
|
3
|
-
import { i as chunkSizeWarningLimit, n as viteAliases, o as viteAppRoot, r as JsBanners } from "./config-app.prod.mjs";
|
|
4
|
-
import { t as LikeC4VitePlugin } from "./plugin.mjs";
|
|
5
|
-
import react from "@vitejs/plugin-react";
|
|
6
|
-
|
|
7
|
-
//#region src/vite/config-webcomponent.prod.ts
|
|
8
|
-
async function viteWebcomponentConfig({ languageServices, outDir, base, webcomponentPrefix = "likec4", filename = "likec4-views.js" }) {
|
|
9
|
-
const customLogger = createLikeC4Logger(["vite", "webcomponent"]);
|
|
10
|
-
const root = viteAppRoot();
|
|
11
|
-
customLogger.info(u.cyan("outDir") + " " + u.dim(outDir));
|
|
12
|
-
return {
|
|
13
|
-
root,
|
|
14
|
-
clearScreen: false,
|
|
15
|
-
base,
|
|
16
|
-
configFile: false,
|
|
17
|
-
publicDir: false,
|
|
18
|
-
mode: "production",
|
|
19
|
-
resolve: {
|
|
20
|
-
conditions: ["production"],
|
|
21
|
-
alias: viteAliases(),
|
|
22
|
-
dedupe: [
|
|
23
|
-
"react",
|
|
24
|
-
"react-dom",
|
|
25
|
-
"react/jsx-runtime",
|
|
26
|
-
"react/jsx-dev-runtime",
|
|
27
|
-
"react-dom/client"
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
define: {
|
|
31
|
-
WEBCOMPONENT_PREFIX: JSON.stringify(webcomponentPrefix),
|
|
32
|
-
"process.env.NODE_ENV": "\"production\""
|
|
33
|
-
},
|
|
34
|
-
esbuild: {
|
|
35
|
-
...JsBanners,
|
|
36
|
-
tsconfigRaw: { compilerOptions: {
|
|
37
|
-
target: "ESNext",
|
|
38
|
-
jsx: "react-jsx"
|
|
39
|
-
} }
|
|
40
|
-
},
|
|
41
|
-
build: {
|
|
42
|
-
outDir,
|
|
43
|
-
emptyOutDir: false,
|
|
44
|
-
sourcemap: false,
|
|
45
|
-
minify: true,
|
|
46
|
-
assetsInlineLimit: 1024 * 1024,
|
|
47
|
-
chunkSizeWarningLimit,
|
|
48
|
-
lib: {
|
|
49
|
-
entry: "src/webcomponent.js",
|
|
50
|
-
fileName(_format, _entryName) {
|
|
51
|
-
return filename;
|
|
52
|
-
},
|
|
53
|
-
formats: ["iife"],
|
|
54
|
-
name: "LikeC4Views"
|
|
55
|
-
},
|
|
56
|
-
rollupOptions: {
|
|
57
|
-
treeshake: { preset: "recommended" },
|
|
58
|
-
output: {
|
|
59
|
-
format: "iife",
|
|
60
|
-
hoistTransitiveImports: false,
|
|
61
|
-
compact: true
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
customLogger,
|
|
66
|
-
plugins: [react(), LikeC4VitePlugin({ languageServices: languageServices.languageServices })]
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
export { viteWebcomponentConfig as t };
|