likec4 1.55.0 → 1.56.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/__app__/chunks/ColorSchemeToggle.mjs +1 -0
- package/__app__/chunks/DiagramActorProvider.mjs +10 -0
- package/__app__/chunks/Fallback.mjs +1 -0
- package/__app__/chunks/Header.mjs +13 -0
- package/__app__/chunks/IconRenderer.mjs +1 -0
- package/__app__/chunks/LikeC4Diagram.mjs +19 -0
- package/__app__/chunks/LikeC4ModelContext.mjs +1 -0
- package/__app__/chunks/LikeC4ModelContext2.mjs +1 -0
- package/__app__/chunks/LikeC4Styles.mjs +48 -0
- package/__app__/chunks/NavigationPanel.mjs +1 -0
- package/__app__/chunks/StaticLikeC4Diagram.mjs +1 -0
- package/__app__/chunks/ViewReact.mjs +1 -0
- package/__app__/chunks/__root.mjs +1 -0
- package/__app__/chunks/adhoc-editor.mjs +1 -0
- package/__app__/chunks/hooks.mjs +1 -0
- package/__app__/chunks/libs/@dagrejs/dagre.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/core.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/dom.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/react.mjs +1 -0
- package/__app__/chunks/libs/@mantine/core.mjs +41 -0
- package/__app__/chunks/libs/@mantine/hooks.mjs +1 -0
- package/__app__/chunks/libs/@nanostores/react.mjs +1 -0
- package/__app__/chunks/libs/@react-hookz/web.mjs +1 -0
- package/__app__/chunks/libs/@tabler/icons-react.mjs +15 -0
- package/__app__/chunks/libs/@tanstack/history.mjs +1 -0
- package/__app__/chunks/libs/@tanstack/react-router.mjs +3 -0
- package/__app__/chunks/libs/@tanstack/router-core.mjs +1 -0
- package/__app__/chunks/libs/@xstate/react.mjs +1 -0
- package/__app__/chunks/libs/@xstate/store.mjs +1 -0
- package/__app__/chunks/libs/@xyflow/react.mjs +7 -0
- package/__app__/chunks/libs/@zag-js/anatomy.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/collection.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/core.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/react.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/tree-view.mjs +1 -0
- package/__app__/chunks/libs/bezier-js.mjs +1 -0
- package/__app__/chunks/libs/d3-path.mjs +1 -0
- package/__app__/chunks/libs/d3-shape.mjs +1 -0
- package/__app__/chunks/libs/fast-equals.mjs +1 -0
- package/__app__/chunks/libs/framer-motion.mjs +9 -0
- package/__app__/chunks/libs/html-to-image.mjs +2 -0
- package/__app__/chunks/libs/motion-dom.mjs +1 -0
- package/__app__/chunks/libs/motion.mjs +1 -0
- package/__app__/chunks/libs/nanostores.mjs +1 -0
- package/__app__/chunks/libs/react-error-boundary.mjs +1 -0
- package/__app__/chunks/libs/react-resizable-panels.mjs +1 -0
- package/__app__/chunks/libs/remeda.mjs +1 -0
- package/__app__/chunks/libs/xstate.mjs +1 -0
- package/__app__/chunks/libs/zod.mjs +39 -0
- package/__app__/chunks/rolldown-runtime.mjs +1 -0
- package/__app__/chunks/safeCtx.mjs +1 -0
- package/__app__/chunks/searchParams.mjs +1 -0
- package/__app__/chunks/single-index.mjs +1 -0
- package/__app__/chunks/styled-system.mjs +1 -0
- package/__app__/chunks/styles.css.mjs +1 -0
- package/__app__/chunks/useLikeC4Project.mjs +1 -0
- package/__app__/chunks/useUpdateEffect.mjs +1 -0
- package/__app__/codegen/react.mjs +11 -0
- package/__app__/codegen/webcomponent.mjs +790 -0
- package/__app__/src/fonts.css +1 -1
- package/__app__/src/main.mjs +1 -0
- package/__app__/src/pages/AdHocViewEditor.mjs +1 -0
- package/__app__/src/pages/EmbedPage.mjs +1 -0
- package/__app__/src/pages/ExportPage.mjs +1 -0
- package/__app__/src/pages/ProjectsOverview.mjs +1 -0
- package/__app__/src/pages/ViewAsD2.mjs +1 -0
- package/__app__/src/pages/ViewAsDot.mjs +1 -0
- package/__app__/src/pages/ViewAsMmd.mjs +1 -0
- package/__app__/src/pages/ViewAsPuml.mjs +1 -0
- package/__app__/src/pages/ViewEditor.mjs +1 -0
- package/__app__/src/pages/ViewReact.mjs +1 -0
- package/__app__/src/routeTree.gen.mjs +1 -0
- package/__app__/src/routes/__root.mjs +1 -0
- package/__app__/src/routes/_single/adhoc.mjs +1 -0
- package/__app__/src/routes/_single/embed._viewId.mjs +1 -0
- package/__app__/src/routes/_single/export._viewId.mjs +1 -0
- package/__app__/src/routes/_single/route.mjs +1 -0
- package/__app__/src/routes/_single/single-index.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.d2.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.dot.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.index.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.mmd.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.puml.mjs +1 -0
- package/__app__/src/routes/_single/webcomponent._.mjs +33 -0
- package/__app__/src/routes/index.mjs +1 -0
- package/__app__/src/routes/project._projectId/-components.mjs +1 -0
- package/__app__/src/routes/project._projectId/adhoc.mjs +1 -0
- package/__app__/src/routes/project._projectId/embed._viewId.mjs +1 -0
- package/__app__/src/routes/project._projectId/export._viewId.mjs +1 -0
- package/__app__/src/routes/project._projectId/index.mjs +1 -0
- package/__app__/src/routes/project._projectId/route.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.index.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +1 -0
- package/__app__/src/routes/projects.mjs +1 -0
- package/__app__/src/style.css +1 -1
- package/dist/chunks/filenames.mjs +17 -0
- package/dist/{_chunks → chunks}/index.d.mts +2 -1
- package/dist/{_chunks → chunks}/index2.d.mts +71 -12
- package/dist/chunks/libs/@chevrotain/gast.mjs +1 -0
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -0
- package/dist/chunks/libs/@chevrotain/utils.mjs +1 -0
- package/dist/chunks/libs/@hono/mcp.mjs +45 -0
- package/dist/chunks/libs/@hono/node-server.mjs +1 -0
- package/dist/{_chunks → chunks}/libs/@logtape/logtape.d.mts +2 -0
- package/dist/chunks/libs/@logtape/logtape.mjs +4 -0
- package/dist/chunks/libs/@lume/kiwi.mjs +1 -0
- package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +12 -0
- package/dist/chunks/libs/ajv.mjs +1 -0
- package/dist/chunks/libs/ansi-align.mjs +2 -0
- package/dist/chunks/libs/ansi-regex.mjs +1 -0
- package/dist/chunks/libs/ansi-styles.mjs +1 -0
- package/dist/chunks/libs/atomically.mjs +1 -0
- package/dist/chunks/libs/birpc.mjs +1 -0
- package/dist/chunks/libs/boxen.mjs +22 -0
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -0
- package/dist/chunks/libs/chevrotain.mjs +58 -0
- package/dist/chunks/libs/conf.mjs +1 -0
- package/dist/chunks/libs/defu.mjs +1 -0
- package/dist/chunks/libs/destr.mjs +1 -0
- package/dist/chunks/libs/eventemitter3.mjs +1 -0
- package/dist/chunks/libs/find-up-simple.mjs +1 -0
- package/dist/chunks/libs/get-port.mjs +1 -0
- package/dist/chunks/libs/hono.mjs +1 -0
- package/dist/chunks/libs/is-docker.mjs +1 -0
- package/dist/chunks/libs/is-error-instance.mjs +1 -0
- package/dist/chunks/libs/is-inside-container.mjs +1 -0
- package/dist/chunks/libs/is-plain-obj.mjs +1 -0
- package/dist/chunks/libs/isexe.mjs +1 -0
- package/dist/chunks/libs/json5.mjs +14 -0
- package/dist/chunks/libs/khroma.mjs +1 -0
- package/dist/chunks/libs/ky.mjs +3 -0
- package/dist/{_chunks → chunks}/libs/langium.d.mts +4 -4
- package/dist/chunks/libs/langium.mjs +32 -0
- package/dist/chunks/libs/merge-error-cause.mjs +2 -0
- package/dist/chunks/libs/p-debounce.mjs +1 -0
- package/dist/chunks/libs/p-limit.mjs +1 -0
- package/dist/chunks/libs/p-queue.mjs +1 -0
- package/dist/chunks/libs/p-timeout.mjs +1 -0
- package/dist/chunks/libs/package-manager-detector.mjs +1 -0
- package/dist/chunks/libs/package-up.mjs +1 -0
- package/dist/chunks/libs/pako.mjs +1 -0
- package/dist/chunks/libs/parse-ms.mjs +1 -0
- package/dist/chunks/libs/pathe.mjs +1 -0
- package/dist/chunks/libs/picomatch.mjs +1 -0
- package/dist/chunks/libs/pretty-ms.mjs +1 -0
- package/dist/chunks/libs/remeda.mjs +1 -0
- package/dist/chunks/libs/safe-stringify.mjs +1 -0
- package/dist/chunks/libs/strip-indent.mjs +1 -0
- package/dist/chunks/libs/tinyrainbow.mjs +1 -0
- package/dist/{_chunks → chunks}/libs/ts-graphviz.d.mts +2 -0
- package/dist/chunks/libs/ts-graphviz.mjs +4 -0
- package/dist/chunks/libs/ufo.mjs +1 -0
- package/dist/chunks/libs/unstorage.mjs +1 -0
- package/dist/chunks/libs/which.mjs +1 -0
- package/dist/chunks/libs/word-wrap.mjs +12 -0
- package/dist/{_chunks → chunks}/libs/zod.d.mts +2 -0
- package/dist/chunks/node.mjs +76 -0
- package/dist/chunks/plugin.mjs +400 -0
- package/dist/chunks/rolldown-runtime.mjs +1 -0
- package/dist/chunks/sequence-view.mjs +1 -0
- package/dist/cli/index.mjs +262 -123
- package/dist/config/index.d.mts +1 -2
- package/dist/config/index.mjs +1 -1
- package/dist/index.d.mts +4 -8
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +2 -1
- package/dist/model/index.mjs +1 -1
- package/dist/vite-plugin/index.d.mts +38 -8
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/{_chunks → vite-plugin/internal/chunks}/libs/@nanostores/react.d.mts +2 -56
- package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/nanostores.d.mts +59 -0
- package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +1 -0
- package/dist/vite-plugin/{internal.d.mts → internal/index.d.mts} +12 -3
- package/dist/vite-plugin/internal/index.mjs +1 -0
- package/package.json +37 -57
- package/react/index.d.mts +2 -28
- package/react/index.mjs +50520 -53827
- package/vite-plugin/internal/package.json +2 -2
- package/vite-plugin-modules.d.ts +14 -0
- package/__app__/react/likec4.tsx +0 -25
- package/__app__/src/ProjectsOverview.js +0 -16
- package/__app__/src/const.js +0 -19
- package/__app__/src/likec4.js +0 -21225
- package/__app__/src/main.js +0 -7
- package/__app__/src/routes/index.js +0 -324
- package/__app__/src/routes/projects.js +0 -189
- package/__app__/src/routes/single.js +0 -1924
- package/__app__/src/vendors.js +0 -52672
- package/__app__/src/webcomponent.js +0 -68
- package/dist/THIRD-PARTY-LICENSES.md +0 -1609
- package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +0 -30
- package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +0 -9
- package/dist/_chunks/libs/@chevrotain/types.d.mts +0 -1
- package/dist/_chunks/libs/@chevrotain/utils.mjs +0 -1
- package/dist/_chunks/libs/@hono/mcp.mjs +0 -45
- package/dist/_chunks/libs/@hono/node-server.mjs +0 -1
- package/dist/_chunks/libs/@logtape/logtape.mjs +0 -4
- package/dist/_chunks/libs/@lume/kiwi.mjs +0 -1
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
- package/dist/_chunks/libs/@nanostores/react.mjs +0 -1
- package/dist/_chunks/libs/ajv.mjs +0 -1
- package/dist/_chunks/libs/ansi-align.mjs +0 -2
- package/dist/_chunks/libs/ansi-regex.mjs +0 -1
- package/dist/_chunks/libs/ansi-styles.mjs +0 -1
- package/dist/_chunks/libs/atomically.mjs +0 -1
- package/dist/_chunks/libs/birpc.mjs +0 -1
- package/dist/_chunks/libs/boxen.mjs +0 -22
- package/dist/_chunks/libs/chevrotain-allstar.mjs +0 -2
- package/dist/_chunks/libs/chevrotain.mjs +0 -58
- package/dist/_chunks/libs/conf.mjs +0 -1
- package/dist/_chunks/libs/defu.mjs +0 -1
- package/dist/_chunks/libs/destr.mjs +0 -1
- package/dist/_chunks/libs/esm-env.mjs +0 -1
- package/dist/_chunks/libs/eventemitter3.mjs +0 -1
- package/dist/_chunks/libs/fast-equals.mjs +0 -1
- package/dist/_chunks/libs/find-up-simple.mjs +0 -1
- package/dist/_chunks/libs/get-port.mjs +0 -1
- package/dist/_chunks/libs/is-docker.mjs +0 -1
- package/dist/_chunks/libs/is-error-instance.mjs +0 -1
- package/dist/_chunks/libs/is-inside-container.mjs +0 -1
- package/dist/_chunks/libs/is-plain-obj.mjs +0 -1
- package/dist/_chunks/libs/isexe.mjs +0 -1
- package/dist/_chunks/libs/json5.mjs +0 -14
- package/dist/_chunks/libs/khroma.mjs +0 -1
- package/dist/_chunks/libs/ky.mjs +0 -3
- package/dist/_chunks/libs/langium.mjs +0 -33
- package/dist/_chunks/libs/merge-error-cause.mjs +0 -2
- package/dist/_chunks/libs/p-limit.mjs +0 -1
- package/dist/_chunks/libs/p-queue.mjs +0 -1
- package/dist/_chunks/libs/p-timeout.mjs +0 -1
- package/dist/_chunks/libs/package-manager-detector.mjs +0 -1
- package/dist/_chunks/libs/package-up.mjs +0 -1
- package/dist/_chunks/libs/pako.mjs +0 -1
- package/dist/_chunks/libs/parse-ms.mjs +0 -1
- package/dist/_chunks/libs/pathe.mjs +0 -1
- package/dist/_chunks/libs/picomatch.mjs +0 -1
- package/dist/_chunks/libs/pretty-ms.mjs +0 -1
- package/dist/_chunks/libs/remeda.mjs +0 -2
- package/dist/_chunks/libs/safe-stringify.mjs +0 -1
- package/dist/_chunks/libs/strip-indent.mjs +0 -1
- package/dist/_chunks/libs/tinyrainbow.mjs +0 -1
- package/dist/_chunks/libs/ts-graphviz.mjs +0 -4
- package/dist/_chunks/libs/ufo.mjs +0 -1
- package/dist/_chunks/libs/unstorage.mjs +0 -1
- package/dist/_chunks/libs/which.mjs +0 -1
- package/dist/_chunks/libs/word-wrap.mjs +0 -12
- package/dist/_chunks/node.mjs +0 -76
- package/dist/_chunks/rolldown-runtime.mjs +0 -1
- package/dist/_chunks/sequence.mjs +0 -1
- package/dist/_chunks/src.mjs +0 -17
- package/dist/_chunks/src2.mjs +0 -499
- package/dist/vite-plugin/internal.mjs +0 -1
- /package/dist/{_chunks → chunks}/libs/vscode-languageserver.mjs +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import"./rolldown-runtime.mjs";import{t as e}from"./libs/json5.mjs";import{Y as t}from"./libs/@hono/mcp.mjs";import{BorderStyles as n,ElementShapes as r,IconPositions as i,RelationshipArrowTypes as a,Sizes as o,ThemeColors as s,computeColorValues as c}from"@likec4/core/styles";import{exact as l}from"@likec4/core/types";const u=/^@[A-Za-z0-9_-]*$/,d=/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,f=t.string().min(1,`Image alias key cannot be empty`).regex(u,`Image alias key must match /^@\\w+$/`),p=t.string().min(1,`Image alias value cannot be empty`).regex(d,`Image alias value must be a relative path (no leading slash or protocol)`),m=t.record(f,p).meta({id:`ImageAliases`,description:`Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash).`}),h=t.string().min(1,`Include path cannot be empty`).regex(/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,`Include path must be a relative path (no leading slash, drive letter, or protocol)`),g=t.strictObject({paths:t.array(h).meta({description:[`Additional relative directory paths to include LikeC4 source files from, searched recursively.`,`Paths are relative to the project folder (the folder containing this config file).`,`Example: ["../shared", "../common/specs"]`].join(`
|
|
2
|
+
`)}),maxDepth:t.number().int().min(1).max(20).default(3).meta({description:[`Maximum directory depth to scan when searching for .c4 files in include paths.`,`Prevents excessive scanning of deeply nested directories.`,`Default: 3`].join(`
|
|
3
|
+
`)}),fileThreshold:t.number().int().min(1).max(1e4).default(30).meta({description:[`Maximum number of files to load from include paths before warning.`,`Helps identify performance issues from accidentally including large directories.`,`Default: 30`].join(`
|
|
4
|
+
`)})}).meta({id:`include-config`,description:[`Configuration for including additional LikeC4 source files from other directories.`,`Example: { "paths": ["../shared", "../common/specs"], "maxDepth": 5, "fileThreshold": 50 }`].join(`
|
|
5
|
+
`)}),_=t.int().min(0,`Opacity must be between 0 and 100`).max(100,`Opacity must be between 0 and 100`).meta({id:`Opacity`,description:`Opacity 0-100%`}),v=t.enum(r).meta({id:`ElementShape`}),y=t.enum(n).meta({id:`BorderStyle`}),b=t.enum(o).meta({id:`ElementSize`}),x=t.enum(i).meta({id:`IconPosition`}),S=t.enum(a).meta({id:`ArrowType`}),C=t.enum([`dashed`,`solid`,`dotted`]).meta({id:`LineType`}),w=t.enum(s).meta({id:`ThemeColorName`}),T=t.custom().refine(e=>typeof e==`string`,`Custom color name must be a string`).transform(e=>e).meta({id:`CustomColorName`}),E=w.or(T).transform(e=>e).meta({id:`ColorName`}),D=t.string().min(1,`Color value cannot be empty`).meta({id:`ColorLiteral`}),O=t.strictObject({fill:D.meta({description:`Background color`}),stroke:D.meta({description:`Stroke color (border, paths above background)`}),hiContrast:D.meta({description:`High contrast text color (title)`}),loContrast:D.meta({description:`Low contrast text color (description)`})}).meta({id:`ElementColorValues`}).transform(e=>e),k=t.strictObject({line:D.meta({description:`Line color`}),label:D.meta({description:`Label text color`}),labelBg:D.optional().default(`rgba(0, 0, 0, 0.5)`).meta({description:`Label background color`})}).meta({id:`RelationshipColorValues`}).transform(e=>e),A=t.strictObject({elements:O.or(D.transform(e=>c(e).elements)).meta({description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`}),relationships:k.or(D.transform(e=>c(e).relationships)).meta({description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`})}).transform(e=>e).meta({id:`StrictThemeColorValues`,description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color value`}).or(D.transform(e=>c(e))).transform(e=>e).meta({id:`ThemeColorValues`,description:`Exact value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`}),j=t.partialRecord(E,A).transform(e=>e),M=t.strictObject({width:t.number().min(50),height:t.number().min(50)}).meta({id:`Dimensions`,description:`Defines dimensions for theme size`}),N=t.partialRecord(b,M),P=t.strictObject({colors:j.optional().meta({description:`Override theme colors`}),sizes:N.optional().meta({description:`Override theme sizes`})}).meta({id:`ThemeCustomization`,description:`Customize theme colors and sizes`}).transform(({colors:e,sizes:t})=>l({colors:e?l(e):void 0,sizes:t?l(t):void 0})),F=t.strictObject({color:E.optional().meta({description:`Default color for groups
|
|
6
|
+
(must be a valid color name from the theme)`}),opacity:_.optional().meta({description:`Default opacity for groups`}),border:y.optional().meta({description:`Default border for groups`})}).meta({id:`GroupDefaultStyleValues`}),I=t.strictObject({color:E.optional().meta({description:`Default color for relationships
|
|
7
|
+
(must be a valid color name from the theme)`}),line:C.optional().meta({description:`Default line style for relationships`}),arrow:S.optional().meta({description:`Default arrow style for relationships`})}).meta({id:`RelationshipDefaultStyleValues`,description:`Override default values for relationship style properties
|
|
8
|
+
These values will be used if such property is not defined`}),L=t.strictObject({color:E.optional().meta({description:`Default color for elements
|
|
9
|
+
(must be a valid color name from the theme)`}),opacity:_.optional().meta({description:`Default opacity (0-100%) for elements when displayed as a group (like a container)`}),border:y.optional().meta({description:`Default border style for elements when displayed as a group (like a container)`}),size:b.optional().meta({description:`Default size for elements`}),shape:v.optional().meta({description:`Default shape for elements`}),iconPosition:x.optional().meta({description:`Default icon position for elements`}),group:F.optional().meta({description:`Override default values for group style properties
|
|
10
|
+
These values will be used if such property is not defined`}),relationship:I.optional().meta({description:`Override default values for relationship style properties
|
|
11
|
+
These values will be used if such property is not defined`})}).meta({id:`DefaultStyleValues`}),R=t.union([t.string().min(1,`Custom CSS file path cannot be empty`),t.array(t.string().min(1,`Custom CSS file path cannot be empty`))]).meta({id:`CustomStylesheets`}),z=t.strictObject({theme:P.optional().meta({description:`Project theme customization`}),defaults:L.optional().meta({description:`Override default values for style properties
|
|
12
|
+
These values will be used if such property is not defined`}),customCss:R.optional().meta({description:`Custom CSS (or list of CSS files) to be included in the generated diagrams`})}).transform(({theme:e,defaults:t,customCss:n})=>l({defaults:normalizeDefaults(t),customCss:normalizeStylesheets(n),theme:e}));function normalizeDefaults(e){if(!e)return;let{relationship:t,group:n,...r}=e;return l({...r,relationship:t&&l(t),group:n&&l(n)})}function normalizeStylesheets(e){if(!e)return;let t=(Array.isArray(e)?e:[e]).filter(Boolean);if(t.length!==0)return{paths:t,content:``}}const B=t.strictObject({outDir:t.string().default(`.likec4`).meta({description:[`Path to the directory where manual layouts will be stored,`,`relative to the folder containing the project config. `,``,`Defaults to '.likec4'.`].join(`
|
|
13
|
+
`)})}).meta({id:`ManualLayoutsConfig`,description:`Configuration for manual layouts`}),V=t.union([t.strictObject({redirect:t.literal(!0)}),t.strictObject({include:t.array(t.string().nonempty().refine(e=>e!==`#`,{message:`selector cannot be "#"`})).nonempty(`include list cannot be empty`)}),t.strictObject({exclude:t.array(t.string().nonempty().refine(e=>e!==`#`,{message:`selector cannot be "#"`})).nonempty(`exclude list cannot be empty`)})]).meta({id:`LandingPageConfig`,description:`Configure the landing page. Use redirect to go to the index view, or include/exclude to filter the view grid.`}),H=t.object({name:t.string().nonempty(`Project name cannot be empty`).refine(e=>e!==`default`,{abort:!0,error:`Project name cannot be "default"`}).refine(e=>!e.includes(`.`)&&!e.includes(`@`)&&!e.includes(`#`),{abort:!0,error:`Project name cannot contain ".", "@" or "#", try to use A-z, 0-9, _ and -`}).meta({description:`Project name, must be unique in the workspace`}),extends:t.union([t.string().min(1,`Extend path cannot be empty`),t.array(t.string().min(1,`Extend path cannot be empty`)).min(1,`Extend list cannot be empty`)]).optional().meta({description:`Extend styles from other config files`}),title:t.string().nonempty(`Project title cannot be empty if specified`).optional().meta({description:`A human readable title for the project`}),contactPerson:t.string().nonempty(`Contact person cannot be empty if specified`).optional().meta({description:`A person who has been involved in creating or maintaining this project`}),metadata:t.record(t.string(),t.any()).optional().meta({description:`Arbitrary metadata as key-value pairs for custom project information`}),styles:z.optional().meta({description:`Project styles customization`}),imageAliases:m.optional(),include:g.optional(),exclude:t.array(t.string()).optional().meta({description:`List of file patterns to exclude from the project, default is ["**/node_modules/**"]`}),manualLayouts:B.optional(),inferTechnologyFromIcon:t.boolean().optional().meta({description:[`Automatically derive element technology from icon name when technology is not set explicitly.`,`Applies to aws:, azure:, gcp:, and tech: icons. Bootstrap icons are excluded.`,`Defaults to true.`].join(`
|
|
14
|
+
`)}),implicitViews:t.boolean().optional().meta({description:`Auto-generate scoped views for elements without explicit views. Defaults to false.`}),landingPage:V.optional()}).meta({id:`LikeC4ProjectConfig`,description:`LikeC4 Project Configuration`}),U=t.instanceof(Function),W=t.record(t.string(),U),G=H.extend({generators:W.optional()});function validateProjectConfig(e){let n=e.landingPage,r=null;if(n!=null){let e=V.safeParse(n);if(!e.success)throw Error(`Config validation failed:
|
|
15
|
+
`+t.prettifyError(e.error));r=e.data}let i=H.safeParse(e);if(!i.success)throw Error(`Config validation failed:
|
|
16
|
+
`+t.prettifyError(i.error));let a=i.data;r!==null&&(a={...a,landingPage:r});let o=e.generators;if(typeof o==`object`&&o&&!Array.isArray(o)){let e=W.safeParse(o);if(!e.success)throw Error(`Config validation failed (generators):
|
|
17
|
+
`+t.prettifyError(e.error));return{...a,generators:e.data}}return a}function parseProjectConfigJSON(t){return validateProjectConfig(e.parse(t.trim()||`{}`))}const K={parse:parseProjectConfigJSON,validate:validateProjectConfig,normalizeInclude:e=>{let t=g.safeParse(e);return t.success?t.data:{paths:[],maxDepth:3,fileThreshold:30}}};function trimTrailingSlashes(e){let t=e.length;for(;t>0&&(e[t-1]===`/`||e[t-1]===`\\`);)t--;return e.slice(0,t)}function splitPath(e){return e.split(`/`).flatMap(e=>e.split(`\\`))}function basename(e){let t=trimTrailingSlashes(e),n=splitPath(t);return n[n.length-1]||t}const q=[`.likec4rc`,`.likec4.config.json`,`likec4.config.json`],J=[`likec4.config.js`,`likec4.config.cjs`,`likec4.config.mjs`,`likec4.config.ts`,`likec4.config.cts`,`likec4.config.mts`];[...q,...J];function isLikeC4JsonConfig(e){return q.includes(basename(e))}function isLikeC4NonJsonConfig(e){return J.includes(basename(e))}function isLikeC4Config(e){return isLikeC4JsonConfig(e)||isLikeC4NonJsonConfig(e)}export{K as a,validateProjectConfig as c,A as d,W as i,P as l,isLikeC4JsonConfig as n,G as o,isLikeC4NonJsonConfig as r,H as s,isLikeC4Config as t,z as u};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { i as __name } from "./rolldown-runtime.mjs";
|
|
1
2
|
import { _ as input, a as ZodDefault, b as $strict, c as ZodLiteral, d as ZodOptional, f as ZodPipe, g as ZodUnion, h as ZodTransform, i as ZodCustom, l as ZodNumber, m as ZodString, n as ZodArray, o as ZodEnum, p as ZodRecord, r as ZodBoolean, s as ZodInt, t as ZodAny, u as ZodObject, v as output, x as $strip, y as $partial } from "./libs/zod.mjs";
|
|
2
|
-
import { DeploymentElementModel, DeploymentRelationModel, ElementModel, LikeC4Model, LikeC4ViewModel, RelationshipModel } from "@likec4/core/model";
|
|
3
3
|
import { LikeC4ProjectStylesConfig, LikeC4ProjectTheme, ProjectId, ThemeColorValues as ThemeColorValues$1, aux } from "@likec4/core/types";
|
|
4
|
+
import { DeploymentElementModel, DeploymentRelationModel, ElementModel, LikeC4Model, LikeC4ViewModel, RelationshipModel } from "@likec4/core/model";
|
|
4
5
|
|
|
5
6
|
//#region ../config/dist/index.d.mts
|
|
6
7
|
//#region src/schema.include.d.ts
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { i as __name } from "./rolldown-runtime.mjs";
|
|
1
2
|
import { a as LikeC4ProjectConfig, i as IncludeConfig, o as LikeC4ProjectConfigInput } from "./index.mjs";
|
|
2
3
|
import { $ as FileSystemProvider, A as DefaultValueConverter, B as AsyncDisposable, C as CodeLensParams, D as ValidationOptions, E as DefaultDocumentValidator, F as JSDocDocumentationProvider, G as Reference, H as AstNode, I as DefaultIndexManager, J as LangiumDocument, K as ReferenceInfo, L as ReferenceDescription, M as MaybePromise, N as DefaultScopeProvider, O as DiagnosticInfo, P as Scope, Q as FileSystemNode, R as DefaultNameProvider, S as CodeActionParams, T as DocumentSymbolParams, U as AstNodeDescription, V as Disposable$1, W as CstNode, X as PrecomputedScopes, Y as LangiumDocumentFactory, Z as Stream, _ as CodeLensProvider, _t as SymbolKind, a as LangiumServices, at as CodeAction, b as FileSelector, c as AbstractSemanticTokenProvider, ct as CompletionItemKind, d as AbstractFormatter, dt as DocumentLink, et as Keyword, f as FormattingRegion, ft as DocumentSymbol, g as DefaultDocumentHighlightProvider, gt as Range, h as DocumentLinkProvider, ht as Location, i as NextFeature, it as RequestType, j as ValueType, k as DefaultScopeComputation, l as SemanticTokenAcceptor, lt as Diagnostic, m as NodeKindProvider, mt as Hover, n as CompletionContext, nt as CancellationToken$1, o as LangiumSharedServices, ot as CodeLens, p as DocumentSymbolProvider, pt as FormattingOptions, q as DefaultLangiumDocuments, r as DefaultCompletionProvider, rt as NotificationType, s as DefaultWorkspaceSymbolProvider, st as Command, t as CompletionAcceptor, tt as URI, u as AstNodeHoverProvider, ut as DocumentHighlight, v as CodeActionProvider, vt as TextEdit, w as DocumentLinkParams, x as BuildOptions, y as DefaultWorkspaceManager, yt as WorkspaceFolder, z as WorkspaceCache } from "./libs/langium.mjs";
|
|
3
4
|
import { t as $keywords } from "./libs/ts-graphviz.mjs";
|
|
4
|
-
import { ElementModel, LikeC4Model } from "@likec4/core/model";
|
|
5
5
|
import * as c4 from "@likec4/core";
|
|
6
6
|
import { AnyAux, ComputedView, DeploymentFqn, DiagramView, EdgeId, Fqn, LayoutType, LayoutedView, LikeC4Styles, NonEmptyArray, NonEmptyReadonlyArray, ProjectId, RelationId, Tag, UnknownComputed, UnknownLayouted, UnknownParsed, ViewChange, ViewId, aux } from "@likec4/core";
|
|
7
7
|
import { LikeC4Styles as LikeC4Styles$1 } from "@likec4/core/styles";
|
|
8
8
|
import { Fqn as Fqn$1, GuardedBy, LayoutedView as LayoutedView$1, ProjectId as ProjectId$1, ViewId as ViewId$1 } from "@likec4/core/types";
|
|
9
9
|
import { DefaultWeakMap, MultiMap } from "@likec4/core/utils";
|
|
10
|
+
import { ElementModel, LikeC4Model } from "@likec4/core/model";
|
|
10
11
|
import { AdhocViewPredicate, ComputedProjectsView, LayoutedProjectsView } from "@likec4/core/compute-view";
|
|
11
12
|
import * as type_fest0 from "type-fest";
|
|
12
13
|
import { ConditionalPick, MergeExclusive, Simplify, Tagged, ValueOf, Writable } from "type-fest";
|
|
@@ -379,6 +380,7 @@ declare class LikeC4DocumentationProvider extends JSDocDocumentationProvider {
|
|
|
379
380
|
getDocumentation(node: AstNode): string | undefined;
|
|
380
381
|
} //#endregion
|
|
381
382
|
//#region src/workspace/ProjectsManager.d.ts
|
|
383
|
+
type NormalizedUri = Tagged<string, 'NormalizedUri'>;
|
|
382
384
|
type DocOrUri = LangiumDocument | string | URI;
|
|
383
385
|
/**
|
|
384
386
|
* A tagged string that represents a project folder URI (with trailing slash).
|
|
@@ -429,6 +431,11 @@ declare class ProjectsManager {
|
|
|
429
431
|
*/
|
|
430
432
|
static readonly DefaultProjectId: ProjectId$1;
|
|
431
433
|
constructor(services: LikeC4SharedServices);
|
|
434
|
+
/**
|
|
435
|
+
* Checks if a document is excluded by workspace-level patterns.
|
|
436
|
+
* These patterns come from VS Code settings and take precedence over project-level excludes.
|
|
437
|
+
*/
|
|
438
|
+
isExcludedByWorkspace(uri: NormalizedUri | URI): boolean;
|
|
432
439
|
/**
|
|
433
440
|
* Updates the workspace-level exclude patterns from VS Code settings.
|
|
434
441
|
* Called during initial server startup; dynamic changes restart the server.
|
|
@@ -449,7 +456,7 @@ declare class ProjectsManager {
|
|
|
449
456
|
/**
|
|
450
457
|
* Returns all projects that overlap with the specified folder (is parent or child)
|
|
451
458
|
*/
|
|
452
|
-
findOverlaped(folder: URI | string): ProjectData
|
|
459
|
+
findOverlaped(folder: URI | string): ReadonlyArray<ProjectData>;
|
|
453
460
|
/**
|
|
454
461
|
* Validates and ensures the project ID.
|
|
455
462
|
* If no project ID is specified, returns default project ID
|
|
@@ -457,14 +464,22 @@ declare class ProjectsManager {
|
|
|
457
464
|
*/
|
|
458
465
|
ensureProjectId(projectId?: ProjectId$1 | undefined): ProjectId$1;
|
|
459
466
|
/**
|
|
460
|
-
* Validates and ensures the project.
|
|
467
|
+
* Validates and ensures the project data.
|
|
468
|
+
* If projectId is not specified, returns default project
|
|
469
|
+
*
|
|
470
|
+
* If there are multiple projects and default project is not set, throws an error
|
|
471
|
+
*
|
|
472
|
+
* @see ensureProjectId - to validate project ID only
|
|
461
473
|
*/
|
|
462
474
|
ensureProject(projectId?: ProjectId$1 | undefined): ProjectData;
|
|
463
475
|
hasMultipleProjects(): boolean;
|
|
464
476
|
/**
|
|
465
|
-
* Checks if
|
|
477
|
+
* Checks if given document (or URI) must be excluded from processing.
|
|
466
478
|
*/
|
|
467
479
|
isExcluded(document: DocOrUri): boolean;
|
|
480
|
+
/**
|
|
481
|
+
* Checks if given document (or URI) must be excluded in the context of the project.
|
|
482
|
+
*/
|
|
468
483
|
isExcluded(projectId: ProjectId$1, document: DocOrUri): boolean;
|
|
469
484
|
/**
|
|
470
485
|
* Checks if the specified document is included by the project:
|
|
@@ -486,6 +501,16 @@ declare class ProjectsManager {
|
|
|
486
501
|
* If the document does not belong to any project, returns the default project ID.
|
|
487
502
|
*/
|
|
488
503
|
ownerProjectId(document: LangiumDocument | URI | string): ProjectId$1;
|
|
504
|
+
/**
|
|
505
|
+
* Returns path to the document relative to the project folder.
|
|
506
|
+
* If the document does not belong to any project, returns the document URI as string.
|
|
507
|
+
*/
|
|
508
|
+
relativePath(document: LangiumDocument | URI | string): string;
|
|
509
|
+
/**
|
|
510
|
+
* Returns true if the manager is currently initializing or reloading projects.
|
|
511
|
+
* This is used to prevent duplicate reload operations.
|
|
512
|
+
*/
|
|
513
|
+
protected get isInitiatingOrReloading(): boolean;
|
|
489
514
|
reloadProjects(cancelToken?: CancellationToken$1): Promise<void>;
|
|
490
515
|
protected _reloadProjects(cancelToken?: CancellationToken$1): Promise<void>;
|
|
491
516
|
protected uniqueProjectId(name: string): ProjectId$1;
|
|
@@ -528,7 +553,8 @@ interface FileSystemProvider$1 extends FileSystemProvider {
|
|
|
528
553
|
*/
|
|
529
554
|
loadProjectConfig(filepath: URI): Promise<LikeC4ProjectConfig>;
|
|
530
555
|
/**
|
|
531
|
-
* Reads the directory
|
|
556
|
+
* Reads the directory and returns LikeC4 files.
|
|
557
|
+
*
|
|
532
558
|
* @param options.recursive If true, recursively reads the directory,
|
|
533
559
|
* @param options.maxDepth Maximum depth to traverse when recursive is true (default: Infinity)
|
|
534
560
|
*/
|
|
@@ -539,7 +565,7 @@ interface FileSystemProvider$1 extends FileSystemProvider {
|
|
|
539
565
|
/**
|
|
540
566
|
* Finds all files in the given directory, matching the given filter.
|
|
541
567
|
*/
|
|
542
|
-
scanDirectory(directory: URI, filter: (filepath: string) => boolean): Promise<FileNode[]>;
|
|
568
|
+
scanDirectory(directory: URI, filter: (filepath: string, isDirectory: boolean) => boolean): Promise<FileNode[]>;
|
|
543
569
|
/**
|
|
544
570
|
* Writes the content to the file system.
|
|
545
571
|
* Used by manual layouts.
|
|
@@ -700,7 +726,7 @@ type FqnReferenceable = Element | ExtendDeployment | ExtendElement | Referenceab
|
|
|
700
726
|
declare const FqnReferenceable = "FqnReferenceable";
|
|
701
727
|
type IconId = string;
|
|
702
728
|
type IconPositionValue = 'bottom' | 'left' | 'right' | 'top';
|
|
703
|
-
type Id = 'deployment' | 'element' | 'group' | 'instance' | 'model' | 'node' | ArrowType | DynamicViewDisplayVariantValue | ElementShape | IconPositionValue | LineOptions | Participant | RankValue | SizeValue | ThemeColor | string;
|
|
729
|
+
type Id = 'deployment' | 'element' | 'group' | 'instance' | 'model' | 'node' | 'relationship' | ArrowType | DynamicViewDisplayVariantValue | ElementShape | IconPositionValue | LineOptions | Participant | RankValue | SizeValue | ThemeColor | string;
|
|
704
730
|
type LikeC4View = DeploymentView | DynamicView | ElementView;
|
|
705
731
|
declare const LikeC4View = "LikeC4View";
|
|
706
732
|
type LineOptions = 'dashed' | 'dotted' | 'solid';
|
|
@@ -2184,20 +2210,24 @@ declare class LikeC4WorkspaceManager extends DefaultWorkspaceManager {
|
|
|
2184
2210
|
initialBuildOptions: BuildOptions;
|
|
2185
2211
|
constructor(services: LikeC4SharedServices);
|
|
2186
2212
|
/**
|
|
2187
|
-
*
|
|
2213
|
+
* Whether the workspace is ready, use {@link ready} promise to wait for it
|
|
2188
2214
|
*/
|
|
2189
|
-
|
|
2215
|
+
get isReady(): boolean;
|
|
2190
2216
|
/**
|
|
2191
|
-
*
|
|
2192
|
-
* Uses a timeout fallback for third-party IDEs that may not support workspace/configuration.
|
|
2217
|
+
* First load all project config files, then load all documents in the workspace.
|
|
2193
2218
|
*/
|
|
2194
|
-
|
|
2219
|
+
protected performStartup(folders: WorkspaceFolder[]): Promise<LangiumDocument[]>;
|
|
2195
2220
|
/**
|
|
2196
2221
|
* Load all additional documents that shall be visible in the context of the given workspace
|
|
2197
2222
|
* folders and add them to the collector. This can be used to include built-in libraries of
|
|
2198
2223
|
* your language, which can be either loaded from provided files or constructed in memory.
|
|
2199
2224
|
*/
|
|
2200
2225
|
protected loadAdditionalDocuments(folders: WorkspaceFolder[], collector: (document: LangiumDocument) => void): Promise<void>;
|
|
2226
|
+
/**
|
|
2227
|
+
* Traverse the file system folder identified by the given URI and its subfolders. All
|
|
2228
|
+
* contained files that match the file extensions are added to the collector.
|
|
2229
|
+
*/
|
|
2230
|
+
protected traverseFolder(workspaceFolder: WorkspaceFolder, folderPath: URI, selector: FileSelector, collector: (document: LangiumDocument) => void): Promise<void>;
|
|
2201
2231
|
/**
|
|
2202
2232
|
* Determine whether the given folder entry shall be included while indexing the workspace.
|
|
2203
2233
|
*/
|
|
@@ -2214,6 +2244,11 @@ declare class LikeC4WorkspaceManager extends DefaultWorkspaceManager {
|
|
|
2214
2244
|
* Register a listener to be called when caches are force cleaned
|
|
2215
2245
|
*/
|
|
2216
2246
|
onForceCleanCache(listener: () => void): Disposable$1;
|
|
2247
|
+
/**
|
|
2248
|
+
* Read workspace exclude patterns from configuration before workspace scan.
|
|
2249
|
+
* Uses a timeout fallback for third-party IDEs that may not support workspace/configuration.
|
|
2250
|
+
*/
|
|
2251
|
+
private readExcludeConfig;
|
|
2217
2252
|
} //#endregion
|
|
2218
2253
|
//#region src/references/scope-provider.d.ts
|
|
2219
2254
|
declare class LikeC4ScopeProvider extends DefaultScopeProvider {
|
|
@@ -2589,6 +2624,10 @@ declare class BaseParser {
|
|
|
2589
2624
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
2590
2625
|
readonly project: Project;
|
|
2591
2626
|
isValid: IsValidFn;
|
|
2627
|
+
/** Full URI of the document */
|
|
2628
|
+
docUri: string;
|
|
2629
|
+
/** Path of the document relative to the project root */
|
|
2630
|
+
docPathInProject: string;
|
|
2592
2631
|
constructor(services: LikeC4Services, doc: ParsedLikeC4LangiumDocument, project: Project);
|
|
2593
2632
|
logError(error: unknown, astNode?: AstNode | Reference<AstNode>, level?: ParserLevel): void;
|
|
2594
2633
|
tryParse<N extends AstNode, T>(level: ParserLevel, node: N | undefined, fn: (node: NoInfer<N>) => T | undefined): T | undefined;
|
|
@@ -2693,6 +2732,8 @@ declare const DocumentParserFromMixins: {
|
|
|
2693
2732
|
parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
|
|
2694
2733
|
wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
|
|
2695
2734
|
isValid: IsValidFn;
|
|
2735
|
+
docUri: string;
|
|
2736
|
+
docPathInProject: string;
|
|
2696
2737
|
readonly services: LikeC4Services;
|
|
2697
2738
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
2698
2739
|
readonly project: Project;
|
|
@@ -2796,6 +2837,8 @@ declare const DocumentParserFromMixins: {
|
|
|
2796
2837
|
parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
|
|
2797
2838
|
wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
|
|
2798
2839
|
isValid: IsValidFn;
|
|
2840
|
+
docUri: string;
|
|
2841
|
+
docPathInProject: string;
|
|
2799
2842
|
readonly services: LikeC4Services;
|
|
2800
2843
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
2801
2844
|
readonly project: Project;
|
|
@@ -2854,6 +2897,8 @@ declare const DocumentParserFromMixins: {
|
|
|
2854
2897
|
parseElementSpecificationNode(specAst: SpecificationElementKind): {};
|
|
2855
2898
|
parseElementSpecificationNode(specAst: SpecificationDeploymentNodeKind): {};
|
|
2856
2899
|
isValid: IsValidFn;
|
|
2900
|
+
docUri: string;
|
|
2901
|
+
docPathInProject: string;
|
|
2857
2902
|
readonly services: LikeC4Services;
|
|
2858
2903
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
2859
2904
|
readonly project: Project;
|
|
@@ -2927,6 +2972,8 @@ declare const DocumentParserFromMixins: {
|
|
|
2927
2972
|
parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
|
|
2928
2973
|
wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
|
|
2929
2974
|
isValid: IsValidFn;
|
|
2975
|
+
docUri: string;
|
|
2976
|
+
docPathInProject: string;
|
|
2930
2977
|
readonly services: LikeC4Services;
|
|
2931
2978
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
2932
2979
|
readonly project: Project;
|
|
@@ -2993,6 +3040,8 @@ declare const DocumentParserFromMixins: {
|
|
|
2993
3040
|
parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
|
|
2994
3041
|
wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
|
|
2995
3042
|
isValid: IsValidFn;
|
|
3043
|
+
docUri: string;
|
|
3044
|
+
docPathInProject: string;
|
|
2996
3045
|
readonly services: LikeC4Services;
|
|
2997
3046
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
2998
3047
|
readonly project: Project;
|
|
@@ -3067,6 +3116,8 @@ declare const DocumentParserFromMixins: {
|
|
|
3067
3116
|
parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
|
|
3068
3117
|
wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
|
|
3069
3118
|
isValid: IsValidFn;
|
|
3119
|
+
docUri: string;
|
|
3120
|
+
docPathInProject: string;
|
|
3070
3121
|
readonly services: LikeC4Services;
|
|
3071
3122
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
3072
3123
|
readonly project: Project;
|
|
@@ -3135,6 +3186,8 @@ declare const DocumentParserFromMixins: {
|
|
|
3135
3186
|
parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
|
|
3136
3187
|
wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
|
|
3137
3188
|
isValid: IsValidFn;
|
|
3189
|
+
docUri: string;
|
|
3190
|
+
docPathInProject: string;
|
|
3138
3191
|
readonly services: LikeC4Services;
|
|
3139
3192
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
3140
3193
|
readonly project: Project;
|
|
@@ -3181,6 +3234,8 @@ declare const DocumentParserFromMixins: {
|
|
|
3181
3234
|
new (...args: any[]): {
|
|
3182
3235
|
parseImports(): void;
|
|
3183
3236
|
isValid: IsValidFn;
|
|
3237
|
+
docUri: string;
|
|
3238
|
+
docPathInProject: string;
|
|
3184
3239
|
readonly services: LikeC4Services;
|
|
3185
3240
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
3186
3241
|
readonly project: Project;
|
|
@@ -3243,6 +3298,8 @@ declare const DocumentParserFromMixins: {
|
|
|
3243
3298
|
parseInlineKindCondition(astNode: OutgoingRelationExpr): ProjectId | null;
|
|
3244
3299
|
wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
|
|
3245
3300
|
isValid: IsValidFn;
|
|
3301
|
+
docUri: string;
|
|
3302
|
+
docPathInProject: string;
|
|
3246
3303
|
readonly services: LikeC4Services;
|
|
3247
3304
|
readonly doc: ParsedLikeC4LangiumDocument;
|
|
3248
3305
|
readonly project: Project;
|
|
@@ -3316,12 +3373,14 @@ declare class LikeC4ModelChanges {
|
|
|
3316
3373
|
modifiedRange: Range;
|
|
3317
3374
|
edits: TextEdit[];
|
|
3318
3375
|
};
|
|
3376
|
+
protected applyTextEdits(doc: ParsedLikeC4LangiumDocument, edits: TextEdit[]): Promise<boolean>;
|
|
3319
3377
|
} //#endregion
|
|
3320
3378
|
//#region src/LikeC4LanguageServices.d.ts
|
|
3321
3379
|
interface LikeC4LanguageServices {
|
|
3322
3380
|
readonly views: LikeC4Views;
|
|
3323
3381
|
readonly builder: LikeC4ModelBuilder;
|
|
3324
3382
|
readonly workspaceUri: URI;
|
|
3383
|
+
readonly workspacePath: string;
|
|
3325
3384
|
readonly projectsManager: ProjectsManager;
|
|
3326
3385
|
readonly editor: LikeC4ModelChanges;
|
|
3327
3386
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../rolldown-runtime.mjs";var e=typeof global==`object`&&global&&global.Object===Object&&global,t=typeof self==`object`&&self&&self.Object===Object&&self,n=e||t||Function(`return this`)(),r=n.Symbol,i=Object.prototype,a=i.hasOwnProperty,o=i.toString,s=r?r.toStringTag:void 0;function getRawTag(e){var t=a.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch{}var i=o.call(e);return r&&(t?e[s]=n:delete e[s]),i}var c=Object.prototype.toString;function objectToString(e){return c.call(e)}var l=`[object Null]`,u=`[object Undefined]`,d=r?r.toStringTag:void 0;function baseGetTag(e){return e==null?e===void 0?u:l:d&&d in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return typeof e==`object`&&!!e}var f=`[object Symbol]`;function isSymbol(e){return typeof e==`symbol`||isObjectLike(e)&&baseGetTag(e)==f}function arrayMap(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var p=Array.isArray,m=1/0,h=r?r.prototype:void 0,g=h?h.toString:void 0;function baseToString(e){if(typeof e==`string`)return e;if(p(e))return arrayMap(e,baseToString)+``;if(isSymbol(e))return g?g.call(e):``;var t=e+``;return t==`0`&&1/e==-m?`-0`:t}var _=/\s/;function trimmedEndIndex(e){for(var t=e.length;t--&&_.test(e.charAt(t)););return t}var v=/^\s+/;function baseTrim(e){return e&&e.slice(0,trimmedEndIndex(e)+1).replace(v,``)}function isObject(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var y=NaN,ee=/^[-+]0x[0-9a-f]+$/i,te=/^0b[01]+$/i,ne=/^0o[0-7]+$/i,re=parseInt;function toNumber(e){if(typeof e==`number`)return e;if(isSymbol(e))return y;if(isObject(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=isObject(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=baseTrim(e);var n=te.test(e);return n||ne.test(e)?re(e.slice(2),n?2:8):ee.test(e)?y:+e}var b=1/0,ie=17976931348623157e292;function toFinite(e){return e?(e=toNumber(e),e===b||e===-b?(e<0?-1:1)*ie:e===e?e:0):e===0?e:0}function toInteger(e){var t=toFinite(e),n=t%1;return t===t?n?t-n:t:0}function identity(e){return e}var ae=`[object AsyncFunction]`,oe=`[object Function]`,se=`[object GeneratorFunction]`,ce=`[object Proxy]`;function isFunction(e){if(!isObject(e))return!1;var t=baseGetTag(e);return t==oe||t==se||t==ae||t==ce}var x=n[`__core-js_shared__`],le=function(){var e=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function isMasked(e){return!!le&&le in e}var ue=Function.prototype.toString;function toSource(e){if(e!=null){try{return ue.call(e)}catch{}try{return e+``}catch{}}return``}var de=/[\\^$.*+?()[\]{}|]/g,fe=/^\[object .+?Constructor\]$/,pe=Function.prototype,me=Object.prototype,he=pe.toString,ge=me.hasOwnProperty,_e=RegExp(`^`+he.call(ge).replace(de,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function baseIsNative(e){return!isObject(e)||isMasked(e)?!1:(isFunction(e)?_e:fe).test(toSource(e))}function getValue(e,t){return e?.[t]}function getNative(e,t){var n=getValue(e,t);return baseIsNative(n)?n:void 0}var S=getNative(n,`WeakMap`);function apply(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var ve=800,ye=16,be=Date.now;function shortOut(e){var t=0,n=0;return function(){var r=be(),i=ye-(r-n);if(n=r,i>0){if(++t>=ve)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function constant(e){return function(){return e}}var C=function(){try{var e=getNative(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),xe=shortOut(C?function(e,t){return C(e,`toString`,{configurable:!0,enumerable:!1,value:constant(t),writable:!0})}:identity);function arrayEach(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}function baseFindIndex(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function baseIsNaN(e){return e!==e}function strictIndexOf(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function baseIndexOf(e,t,n){return t===t?strictIndexOf(e,t,n):baseFindIndex(e,baseIsNaN,n)}var Se=9007199254740991,Ce=/^(?:0|[1-9]\d*)$/;function isIndex(e,t){var n=typeof e;return t??=Se,!!t&&(n==`number`||n!=`symbol`&&Ce.test(e))&&e>-1&&e%1==0&&e<t}function baseAssignValue(e,t,n){t==`__proto__`&&C?C(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function eq(e,t){return e===t||e!==e&&t!==t}var we=Object.prototype.hasOwnProperty;function assignValue(e,t,n){var r=e[t];(!(we.call(e,t)&&eq(r,n))||n===void 0&&!(t in e))&&baseAssignValue(e,t,n)}function copyObject(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?baseAssignValue(n,s,c):assignValue(n,s,c)}return n}var w=Math.max;function overRest(e,t,n){return t=w(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=w(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),apply(e,this,s)}}function baseRest(e,t){return xe(overRest(e,t,identity),e+``)}var Te=9007199254740991;function isLength(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=Te}function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction(e)}function isIterateeCall(e,t,n){if(!isObject(n))return!1;var r=typeof t;return(r==`number`?isArrayLike(n)&&isIndex(t,n.length):r==`string`&&t in n)?eq(n[t],e):!1}function createAssigner(e){return baseRest(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&isIterateeCall(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var Ee=Object.prototype;function isPrototype(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||Ee)}function baseTimes(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var De=`[object Arguments]`;function baseIsArguments(e){return isObjectLike(e)&&baseGetTag(e)==De}var T=Object.prototype,Oe=T.hasOwnProperty,ke=T.propertyIsEnumerable,E=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&Oe.call(e,`callee`)&&!ke.call(e,`callee`)};function stubFalse(){return!1}var D=typeof exports==`object`&&exports&&!exports.nodeType&&exports,Ae=D&&typeof module==`object`&&module&&!module.nodeType&&module,je=Ae&&Ae.exports===D?n.Buffer:void 0,O=(je?je.isBuffer:void 0)||stubFalse,Me=`[object Arguments]`,Ne=`[object Array]`,Pe=`[object Boolean]`,Fe=`[object Date]`,Ie=`[object Error]`,Le=`[object Function]`,Re=`[object Map]`,ze=`[object Number]`,Be=`[object Object]`,Ve=`[object RegExp]`,He=`[object Set]`,Ue=`[object String]`,We=`[object WeakMap]`,Ge=`[object ArrayBuffer]`,Ke=`[object DataView]`,qe=`[object Float32Array]`,Je=`[object Float64Array]`,Ye=`[object Int8Array]`,Xe=`[object Int16Array]`,Ze=`[object Int32Array]`,Qe=`[object Uint8Array]`,$e=`[object Uint8ClampedArray]`,et=`[object Uint16Array]`,tt=`[object Uint32Array]`,k={};k[qe]=k[Je]=k[Ye]=k[Xe]=k[Ze]=k[Qe]=k[$e]=k[et]=k[tt]=!0,k[Me]=k[Ne]=k[Ge]=k[Pe]=k[Ke]=k[Fe]=k[Ie]=k[Le]=k[Re]=k[ze]=k[Be]=k[Ve]=k[He]=k[Ue]=k[We]=!1;function baseIsTypedArray(e){return isObjectLike(e)&&isLength(e.length)&&!!k[baseGetTag(e)]}function baseUnary(e){return function(t){return e(t)}}var A=typeof exports==`object`&&exports&&!exports.nodeType&&exports,j=A&&typeof module==`object`&&module&&!module.nodeType&&module,M=j&&j.exports===A&&e.process,N=function(){try{return j&&j.require&&j.require(`util`).types||M&&M.binding&&M.binding(`util`)}catch{}}(),P=N&&N.isTypedArray,F=P?baseUnary(P):baseIsTypedArray,nt=Object.prototype.hasOwnProperty;function arrayLikeKeys(e,t){var n=p(e),r=!n&&E(e),i=!n&&!r&&O(e),a=!n&&!r&&!i&&F(e),o=n||r||i||a,s=o?baseTimes(e.length,String):[],c=s.length;for(var l in e)(t||nt.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||isIndex(l,c)))&&s.push(l);return s}function overArg(e,t){return function(n){return e(t(n))}}var rt=overArg(Object.keys,Object),it=Object.prototype.hasOwnProperty;function baseKeys(e){if(!isPrototype(e))return rt(e);var t=[];for(var n in Object(e))it.call(e,n)&&n!=`constructor`&&t.push(n);return t}function keys(e){return isArrayLike(e)?arrayLikeKeys(e):baseKeys(e)}var at=Object.prototype.hasOwnProperty,I=createAssigner(function(e,t){if(isPrototype(t)||isArrayLike(t)){copyObject(t,keys(t),e);return}for(var n in t)at.call(t,n)&&assignValue(e,n,t[n])});function nativeKeysIn(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var ot=Object.prototype.hasOwnProperty;function baseKeysIn(e){if(!isObject(e))return nativeKeysIn(e);var t=isPrototype(e),n=[];for(var r in e)r==`constructor`&&(t||!ot.call(e,r))||n.push(r);return n}function keysIn(e){return isArrayLike(e)?arrayLikeKeys(e,!0):baseKeysIn(e)}var st=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ct=/^\w*$/;function isKey(e,t){if(p(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||isSymbol(e)?!0:ct.test(e)||!st.test(e)||t!=null&&e in Object(t)}var L=getNative(Object,`create`);function hashClear(){this.__data__=L?L(null):{},this.size=0}function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var lt=`__lodash_hash_undefined__`,ut=Object.prototype.hasOwnProperty;function hashGet(e){var t=this.__data__;if(L){var n=t[e];return n===lt?void 0:n}return ut.call(t,e)?t[e]:void 0}var dt=Object.prototype.hasOwnProperty;function hashHas(e){var t=this.__data__;return L?t[e]!==void 0:dt.call(t,e)}var ft=`__lodash_hash_undefined__`;function hashSet(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=L&&t===void 0?ft:t,this}function Hash(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;function listCacheClear(){this.__data__=[],this.size=0}function assocIndexOf(e,t){for(var n=e.length;n--;)if(eq(e[n][0],t))return n;return-1}var pt=Array.prototype.splice;function listCacheDelete(e){var t=this.__data__,n=assocIndexOf(t,e);return n<0?!1:(n==t.length-1?t.pop():pt.call(t,n,1),--this.size,!0)}function listCacheGet(e){var t=this.__data__,n=assocIndexOf(t,e);return n<0?void 0:t[n][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var n=this.__data__,r=assocIndexOf(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function ListCache(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var R=getNative(n,`Map`);function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(R||ListCache),string:new Hash}}function isKeyable(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function getMapData(e,t){var n=e.__data__;return isKeyable(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function mapCacheDelete(e){var t=getMapData(this,e).delete(e);return this.size-=+!!t,t}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,t){var n=getMapData(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function MapCache(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var mt=`Expected a function`;function memoize(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(mt);var memoized=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=memoized.cache;if(i.has(r))return i.get(r);var a=e.apply(this,n);return memoized.cache=i.set(r,a)||i,a};return memoized.cache=new(memoize.Cache||MapCache),memoized}memoize.Cache=MapCache;var ht=500;function memoizeCapped(e){var t=memoize(e,function(e){return n.size===ht&&n.clear(),e}),n=t.cache;return t}var gt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_t=/\\(\\)?/g,vt=memoizeCapped(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(gt,function(e,n,r,i){t.push(r?i.replace(_t,`$1`):n||e)}),t});function toString(e){return e==null?``:baseToString(e)}function castPath(e,t){return p(e)?e:isKey(e,t)?[e]:vt(toString(e))}var yt=1/0;function toKey(e){if(typeof e==`string`||isSymbol(e))return e;var t=e+``;return t==`0`&&1/e==-yt?`-0`:t}function baseGet(e,t){t=castPath(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[toKey(t[n++])];return n&&n==r?e:void 0}function get(e,t,n){var r=e==null?void 0:baseGet(e,t);return r===void 0?n:r}function arrayPush(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var bt=overArg(Object.getPrototypeOf,Object);function stackClear(){this.__data__=new ListCache,this.size=0}function stackDelete(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function stackGet(e){return this.__data__.get(e)}function stackHas(e){return this.__data__.has(e)}var xt=200;function stackSet(e,t){var n=this.__data__;if(n instanceof ListCache){var r=n.__data__;if(!R||r.length<xt-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new MapCache(r)}return n.set(e,t),this.size=n.size,this}function Stack(e){var t=this.__data__=new ListCache(e);this.size=t.size}Stack.prototype.clear=stackClear,Stack.prototype.delete=stackDelete,Stack.prototype.get=stackGet,Stack.prototype.has=stackHas,Stack.prototype.set=stackSet;function arrayFilter(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function stubArray(){return[]}var St=Object.prototype.propertyIsEnumerable,Ct=Object.getOwnPropertySymbols,z=Ct?function(e){return e==null?[]:(e=Object(e),arrayFilter(Ct(e),function(t){return St.call(e,t)}))}:stubArray,B=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)arrayPush(t,z(e)),e=bt(e);return t}:stubArray;function baseGetAllKeys(e,t,n){var r=t(e);return p(e)?r:arrayPush(r,n(e))}function getAllKeys(e){return baseGetAllKeys(e,keys,z)}function getAllKeysIn(e){return baseGetAllKeys(e,keysIn,B)}var V=getNative(n,`DataView`),H=getNative(n,`Promise`),U=getNative(n,`Set`),W=`[object Map]`,wt=`[object Object]`,G=`[object Promise]`,K=`[object Set]`,q=`[object WeakMap]`,J=`[object DataView]`,Tt=toSource(V),Et=toSource(R),Dt=toSource(H),Ot=toSource(U),kt=toSource(S),getTag=baseGetTag;(V&&getTag(new V(new ArrayBuffer(1)))!=J||R&&getTag(new R)!=W||H&&getTag(H.resolve())!=G||U&&getTag(new U)!=K||S&&getTag(new S)!=q)&&(getTag=function(e){var t=baseGetTag(e),n=t==wt?e.constructor:void 0,r=n?toSource(n):``;if(r)switch(r){case Tt:return J;case Et:return W;case Dt:return G;case Ot:return K;case kt:return q}return t});var Y=getTag,X=n.Uint8Array,At=`__lodash_hash_undefined__`;function setCacheAdd(e){return this.__data__.set(e,At),this}function setCacheHas(e){return this.__data__.has(e)}function SetCache(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new MapCache;++t<n;)this.add(e[t])}SetCache.prototype.add=SetCache.prototype.push=setCacheAdd,SetCache.prototype.has=setCacheHas;function arraySome(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function cacheHas(e,t){return e.has(t)}var jt=1,Mt=2;function equalArrays(e,t,n,r,i,a){var o=n&jt,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=a.get(e),u=a.get(t);if(l&&u)return l==t&&u==e;var d=-1,f=!0,p=n&Mt?new SetCache:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],h=t[d];if(r)var g=o?r(h,m,d,t,e,a):r(m,h,d,e,t,a);if(g!==void 0){if(g)continue;f=!1;break}if(p){if(!arraySome(t,function(e,t){if(!cacheHas(p,t)&&(m===e||i(m,e,n,r,a)))return p.push(t)})){f=!1;break}}else if(!(m===h||i(m,h,n,r,a))){f=!1;break}}return a.delete(e),a.delete(t),f}function mapToArray(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function setToArray(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var Nt=1,Pt=2,Ft=`[object Boolean]`,It=`[object Date]`,Lt=`[object Error]`,Rt=`[object Map]`,zt=`[object Number]`,Bt=`[object RegExp]`,Vt=`[object Set]`,Ht=`[object String]`,Ut=`[object Symbol]`,Wt=`[object ArrayBuffer]`,Gt=`[object DataView]`,Kt=r?r.prototype:void 0,Z=Kt?Kt.valueOf:void 0;function equalByTag(e,t,n,r,i,a,o){switch(n){case Gt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Wt:return!(e.byteLength!=t.byteLength||!a(new X(e),new X(t)));case Ft:case It:case zt:return eq(+e,+t);case Lt:return e.name==t.name&&e.message==t.message;case Bt:case Ht:return e==t+``;case Rt:var s=mapToArray;case Vt:var c=r&Nt;if(s||=setToArray,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=Pt,o.set(e,t);var u=equalArrays(s(e),s(t),r,i,a,o);return o.delete(e),u;case Ut:if(Z)return Z.call(e)==Z.call(t)}return!1}var qt=1,Jt=Object.prototype.hasOwnProperty;function equalObjects(e,t,n,r,i,a){var o=n&qt,s=getAllKeys(e),c=s.length;if(c!=getAllKeys(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:Jt.call(t,u)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=o;++l<c;){u=s[l];var h=e[u],g=t[u];if(r)var _=o?r(g,h,u,t,e,a):r(h,g,u,e,t,a);if(!(_===void 0?h===g||i(h,g,n,r,a):_)){p=!1;break}m||=u==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v!=y&&`constructor`in e&&`constructor`in t&&!(typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y)&&(p=!1)}return a.delete(e),a.delete(t),p}var Yt=1,Xt=`[object Arguments]`,Zt=`[object Array]`,Q=`[object Object]`,Qt=Object.prototype.hasOwnProperty;function baseIsEqualDeep(e,t,n,r,i,a){var o=p(e),s=p(t),c=o?Zt:Y(e),l=s?Zt:Y(t);c=c==Xt?Q:c,l=l==Xt?Q:l;var u=c==Q,d=l==Q,f=c==l;if(f&&O(e)){if(!O(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new Stack,o||F(e)?equalArrays(e,t,n,r,i,a):equalByTag(e,t,c,n,r,i,a);if(!(n&Yt)){var m=u&&Qt.call(e,`__wrapped__`),h=d&&Qt.call(t,`__wrapped__`);if(m||h){var g=m?e.value():e,_=h?t.value():t;return a||=new Stack,i(g,_,n,r,a)}}return f?(a||=new Stack,equalObjects(e,t,n,r,i,a)):!1}function baseIsEqual(e,t,n,r,i){return e===t?!0:e==null||t==null||!isObjectLike(e)&&!isObjectLike(t)?e!==e&&t!==t:baseIsEqualDeep(e,t,n,r,baseIsEqual,i)}var $t=1,en=2;function baseIsMatch(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=n[i];var c=s[0],l=e[c],u=s[1];if(o&&s[2]){if(l===void 0&&!(c in e))return!1}else{var d=new Stack;if(r)var f=r(l,u,c,e,t,d);if(!(f===void 0?baseIsEqual(u,l,$t|en,r,d):f))return!1}}return!0}function isStrictComparable(e){return e===e&&!isObject(e)}function getMatchData(e){for(var t=keys(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,isStrictComparable(i)]}return t}function matchesStrictComparable(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function baseMatches(e){var t=getMatchData(e);return t.length==1&&t[0][2]?matchesStrictComparable(t[0][0],t[0][1]):function(n){return n===e||baseIsMatch(n,e,t)}}function baseHasIn(e,t){return e!=null&&t in Object(e)}function hasPath(e,t,n){t=castPath(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=toKey(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&isLength(i)&&isIndex(o,i)&&(p(e)||E(e)))}function hasIn(e,t){return e!=null&&hasPath(e,t,baseHasIn)}var tn=1,nn=2;function baseMatchesProperty(e,t){return isKey(e)&&isStrictComparable(t)?matchesStrictComparable(toKey(e),t):function(n){var r=get(n,e);return r===void 0&&r===t?hasIn(n,e):baseIsEqual(t,r,tn|nn)}}function baseProperty(e){return function(t){return t?.[e]}}function basePropertyDeep(e){return function(t){return baseGet(t,e)}}function property(e){return isKey(e)?baseProperty(toKey(e)):basePropertyDeep(e)}function baseIteratee(e){return typeof e==`function`?e:e==null?identity:typeof e==`object`?p(e)?baseMatchesProperty(e[0],e[1]):baseMatches(e):property(e)}function createBaseFor(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var rn=createBaseFor();function baseForOwn(e,t){return e&&rn(e,t,keys)}function createBaseEach(e,t){return function(n,r){if(n==null)return n;if(!isArrayLike(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var $=createBaseEach(baseForOwn);function castFunction(e){return typeof e==`function`?e:identity}function forEach(e,t){return(p(e)?arrayEach:$)(e,castFunction(t))}function arrayEvery(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function baseEvery(e,t){var n=!0;return $(e,function(e,r,i){return n=!!t(e,r,i),n}),n}function every(e,t,n){var r=p(e)?arrayEvery:baseEvery;return n&&isIterateeCall(e,t,n)&&(t=void 0),r(e,baseIteratee(t,3))}function baseMap(e,t){var n=-1,r=isArrayLike(e)?Array(e.length):[];return $(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function map(e,t){return(p(e)?arrayMap:baseMap)(e,baseIteratee(t,3))}var an=`[object String]`;function isString(e){return typeof e==`string`||!p(e)&&isObjectLike(e)&&baseGetTag(e)==an}function baseValues(e,t){return arrayMap(t,function(t){return e[t]})}function values(e){return e==null?[]:baseValues(e,keys(e))}var on=Math.max;function includes(e,t,n,r){e=isArrayLike(e)?e:values(e),n=n&&!r?toInteger(n):0;var i=e.length;return n<0&&(n=on(i+n,0)),isString(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&baseIndexOf(e,t,n)>-1}var sn=`[object RegExp]`;function baseIsRegExp(e){return isObjectLike(e)&&baseGetTag(e)==sn}var cn=N&&N.isRegExp,ln=cn?baseUnary(cn):baseIsRegExp;function baseSet(e,t,n,r){if(!isObject(e))return e;t=castPath(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=toKey(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=isObject(u)?u:isIndex(t[i+1])?[]:{})}assignValue(s,c,l),s=s[c]}return e}function basePickBy(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=baseGet(e,o);n(s,o)&&baseSet(a,castPath(o,e),s)}return a}function pickBy(e,t){if(e==null)return{};var n=arrayMap(getAllKeysIn(e),function(e){return[e]});return t=baseIteratee(t),basePickBy(e,n,function(e,n){return t(e,n[0])})}function baseSome(e,t){var n;return $(e,function(e,r,i){return n=t(e,r,i),!n}),!!n}function some(e,t,n){var r=p(e)?arraySome:baseSome;return n&&isIterateeCall(e,t,n)&&(t=void 0),r(e,baseIteratee(t,3))}function tokenLabel(e){return hasTokenLabel(e)?e.LABEL:e.name}function hasTokenLabel(e){return isString(e.LABEL)&&e.LABEL!==``}var AbstractProduction=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),forEach(this.definition,t=>{t.accept(e)})}},NonTerminal=class extends AbstractProduction{constructor(e){super([]),this.idx=1,I(this,pickBy(e,e=>e!==void 0))}set definition(e){}get definition(){return this.referencedRule===void 0?[]:this.referencedRule.definition}accept(e){e.visit(this)}},Rule=class extends AbstractProduction{constructor(e){super(e.definition),this.orgText=``,I(this,pickBy(e,e=>e!==void 0))}},Alternative=class extends AbstractProduction{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,I(this,pickBy(e,e=>e!==void 0))}},Option=class extends AbstractProduction{constructor(e){super(e.definition),this.idx=1,I(this,pickBy(e,e=>e!==void 0))}},RepetitionMandatory=class extends AbstractProduction{constructor(e){super(e.definition),this.idx=1,I(this,pickBy(e,e=>e!==void 0))}},RepetitionMandatoryWithSeparator=class extends AbstractProduction{constructor(e){super(e.definition),this.idx=1,I(this,pickBy(e,e=>e!==void 0))}},Repetition=class extends AbstractProduction{constructor(e){super(e.definition),this.idx=1,I(this,pickBy(e,e=>e!==void 0))}},RepetitionWithSeparator=class extends AbstractProduction{constructor(e){super(e.definition),this.idx=1,I(this,pickBy(e,e=>e!==void 0))}},Alternation=class extends AbstractProduction{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,I(this,pickBy(e,e=>e!==void 0))}},Terminal=class{constructor(e){this.idx=1,I(this,pickBy(e,e=>e!==void 0))}accept(e){e.visit(this)}};function serializeGrammar(e){return map(e,serializeProduction)}function serializeProduction(e){function convertDefinition(e){return map(e,serializeProduction)}if(e instanceof NonTerminal){let t={type:`NonTerminal`,name:e.nonTerminalName,idx:e.idx};return isString(e.label)&&(t.label=e.label),t}else if(e instanceof Alternative)return{type:`Alternative`,definition:convertDefinition(e.definition)};else if(e instanceof Option)return{type:`Option`,idx:e.idx,definition:convertDefinition(e.definition)};else if(e instanceof RepetitionMandatory)return{type:`RepetitionMandatory`,idx:e.idx,definition:convertDefinition(e.definition)};else if(e instanceof RepetitionMandatoryWithSeparator)return{type:`RepetitionMandatoryWithSeparator`,idx:e.idx,separator:serializeProduction(new Terminal({terminalType:e.separator})),definition:convertDefinition(e.definition)};else if(e instanceof RepetitionWithSeparator)return{type:`RepetitionWithSeparator`,idx:e.idx,separator:serializeProduction(new Terminal({terminalType:e.separator})),definition:convertDefinition(e.definition)};else if(e instanceof Repetition)return{type:`Repetition`,idx:e.idx,definition:convertDefinition(e.definition)};else if(e instanceof Alternation)return{type:`Alternation`,idx:e.idx,definition:convertDefinition(e.definition)};else if(e instanceof Terminal){let t={type:`Terminal`,name:e.terminalType.name,label:tokenLabel(e.terminalType),idx:e.idx};isString(e.label)&&(t.terminalLabel=e.label);let n=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=ln(n)?n.source:n),t}else if(e instanceof Rule)return{type:`Rule`,name:e.name,orgText:e.orgText,definition:convertDefinition(e.definition)};else throw Error(`non exhaustive match`)}var GAstVisitor=class{visit(e){let t=e;switch(t.constructor){case NonTerminal:return this.visitNonTerminal(t);case Alternative:return this.visitAlternative(t);case Option:return this.visitOption(t);case RepetitionMandatory:return this.visitRepetitionMandatory(t);case RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(t);case RepetitionWithSeparator:return this.visitRepetitionWithSeparator(t);case Repetition:return this.visitRepetition(t);case Alternation:return this.visitAlternation(t);case Terminal:return this.visitTerminal(t);case Rule:return this.visitRule(t);default:throw Error(`non exhaustive match`)}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function isSequenceProd(e){return e instanceof Alternative||e instanceof Option||e instanceof Repetition||e instanceof RepetitionMandatory||e instanceof RepetitionMandatoryWithSeparator||e instanceof RepetitionWithSeparator||e instanceof Terminal||e instanceof Rule}function isOptionalProd(e,t=[]){return e instanceof Option||e instanceof Repetition||e instanceof RepetitionWithSeparator?!0:e instanceof Alternation?some(e.definition,e=>isOptionalProd(e,t)):e instanceof NonTerminal&&includes(t,e)?!1:e instanceof AbstractProduction?(e instanceof NonTerminal&&t.push(e),every(e.definition,e=>isOptionalProd(e,t))):!1}function isBranchingProd(e){return e instanceof Alternation}function getProductionDslName(e){if(e instanceof NonTerminal)return`SUBRULE`;if(e instanceof Option)return`OPTION`;if(e instanceof Alternation)return`OR`;if(e instanceof RepetitionMandatory)return`AT_LEAST_ONE`;if(e instanceof RepetitionMandatoryWithSeparator)return`AT_LEAST_ONE_SEP`;if(e instanceof RepetitionWithSeparator)return`MANY_SEP`;if(e instanceof Repetition)return`MANY`;if(e instanceof Terminal)return`CONSUME`;throw Error(`non exhaustive match`)}export{isIterateeCall as $,cacheHas as A,Stack as B,map as C,baseIteratee as D,$ as E,getAllKeysIn as F,keys as G,arrayPush as H,getAllKeys as I,N as J,baseKeys as K,B as L,X as M,Y as N,hasPath as O,U as P,isPrototype as Q,z as R,isString as S,forEach as T,keysIn as U,bt as V,I as W,O as X,baseUnary as Y,E as Z,some as _,r as _t,GAstVisitor as a,baseAssignValue as at,includes as b,NonTerminal as c,arrayEach as ct,RepetitionMandatory as d,toInteger as dt,isArrayLike as et,RepetitionMandatoryWithSeparator as f,isObject as ft,serializeGrammar as g,isObjectLike as gt,Terminal as h,isSymbol as ht,isSequenceProd as i,eq as it,SetCache as j,setToArray as k,Option as l,isFunction as lt,Rule as m,arrayMap as mt,isBranchingProd as n,copyObject as nt,Alternation as o,baseIndexOf as ot,RepetitionWithSeparator as p,p as pt,F as q,isOptionalProd as r,assignValue as rt,Alternative as s,baseFindIndex as st,getProductionDslName as t,baseRest as tt,Repetition as u,identity as ut,pickBy as v,n as vt,every as w,values as x,ln as y,arrayFilter as z};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import"../../rolldown-runtime.mjs";function cc(e){return e.charCodeAt(0)}function insertToSet(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function addFlag(e,t){if(e[t]===!0)throw`duplicate flag `+t;e[t],e[t]=!0}function ASSERT_EXISTS(e){if(e===void 0)throw Error(`Internal Error - Should never get here!`);return!0}function ASSERT_NEVER_REACH_HERE(){throw Error(`Internal Error - Should never get here!`)}function isCharacter(e){return e.type===`Character`}const e=[];for(let t=cc(`0`);t<=cc(`9`);t++)e.push(t);const t=[cc(`_`)].concat(e);for(let e=cc(`a`);e<=cc(`z`);e++)t.push(e);for(let e=cc(`A`);e<=cc(`Z`);e++)t.push(e);const n=[cc(` `),cc(`\f`),cc(`
|
|
2
|
+
`),cc(`\r`),cc(` `),cc(`\v`),cc(` `),cc(`\xA0`),cc(` `),cc(` `),cc(` `),cc(` `),cc(` `),cc(` `),cc(` `),cc(` `),cc(` `),cc(` `),cc(` `),cc(` `),cc(`\u2028`),cc(`\u2029`),cc(` `),cc(` `),cc(` `),cc(``)],r=/[0-9a-fA-F]/,i=/[0-9]/,a=/[1-9]/;var RegExpParser=class{constructor(){this.idx=0,this.input=``,this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar(`/`);let t=this.disjunction();this.consumeChar(`/`);let n={type:`Flags`,loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case`g`:addFlag(n,`global`);break;case`i`:addFlag(n,`ignoreCase`);break;case`m`:addFlag(n,`multiLine`);break;case`u`:addFlag(n,`unicode`);break;case`y`:addFlag(n,`sticky`);break}if(this.idx!==this.input.length)throw Error(`Redundant input: `+this.input.substring(this.idx));return{type:`Pattern`,flags:n,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()===`|`;)this.consumeChar(`|`),e.push(this.alternative());return{type:`Disjunction`,value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:`Alternative`,value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case`^`:return{type:`StartAnchor`,loc:this.loc(e)};case`$`:return{type:`EndAnchor`,loc:this.loc(e)};case`\\`:switch(this.popChar()){case`b`:return{type:`WordBoundary`,loc:this.loc(e)};case`B`:return{type:`NonWordBoundary`,loc:this.loc(e)}}throw Error(`Invalid Assertion Escape`);case`(`:this.consumeChar(`?`);let t;switch(this.popChar()){case`=`:t=`Lookahead`;break;case`!`:t=`NegativeLookahead`;break}ASSERT_EXISTS(t);let n=this.disjunction();return this.consumeChar(`)`),{type:t,value:n,loc:this.loc(e)}}return ASSERT_NEVER_REACH_HERE()}quantifier(e=!1){let t,n=this.idx;switch(this.popChar()){case`*`:t={atLeast:0,atMost:1/0};break;case`+`:t={atLeast:1,atMost:1/0};break;case`?`:t={atLeast:0,atMost:1};break;case`{`:let n=this.integerIncludingZero();switch(this.popChar()){case`}`:t={atLeast:n,atMost:n};break;case`,`:let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:n,atMost:e}):t={atLeast:n,atMost:1/0},this.consumeChar(`}`);break}if(e===!0&&t===void 0)return;ASSERT_EXISTS(t);break}if(!(e===!0&&t===void 0)&&ASSERT_EXISTS(t))return this.peekChar(0)===`?`?(this.consumeChar(`?`),t.greedy=!1):t.greedy=!0,t.type=`Quantifier`,t.loc=this.loc(n),t}atom(){let e,t=this.idx;switch(this.peekChar()){case`.`:e=this.dotAll();break;case`\\`:e=this.atomEscape();break;case`[`:e=this.characterClass();break;case`(`:e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),ASSERT_EXISTS(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):ASSERT_NEVER_REACH_HERE()}dotAll(){return this.consumeChar(`.`),{type:`Set`,complement:!0,value:[cc(`
|
|
3
|
+
`),cc(`\r`),cc(`\u2028`),cc(`\u2029`)]}}atomEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:return this.decimalEscapeAtom();case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:`GroupBackReference`,value:this.positiveInteger()}}characterClassEscape(){let r,i=!1;switch(this.popChar()){case`d`:r=e;break;case`D`:r=e,i=!0;break;case`s`:r=n;break;case`S`:r=n,i=!0;break;case`w`:r=t;break;case`W`:r=t,i=!0;break}return ASSERT_EXISTS(r)?{type:`Set`,value:r,complement:i}:ASSERT_NEVER_REACH_HERE()}controlEscapeAtom(){let e;switch(this.popChar()){case`f`:e=cc(`\f`);break;case`n`:e=cc(`
|
|
4
|
+
`);break;case`r`:e=cc(`\r`);break;case`t`:e=cc(` `);break;case`v`:e=cc(`\v`);break}return ASSERT_EXISTS(e)?{type:`Character`,value:e}:ASSERT_NEVER_REACH_HERE()}controlLetterEscapeAtom(){this.consumeChar(`c`);let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error(`Invalid `);return{type:`Character`,value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar(`0`),{type:`Character`,value:cc(`\0`)}}hexEscapeSequenceAtom(){return this.consumeChar(`x`),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar(`u`),this.parseHexDigits(4)}identityEscapeAtom(){return{type:`Character`,value:cc(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
5
|
+
`:case`\r`:case`\u2028`:case`\u2029`:case`\\`:case`]`:throw Error(`TBD`);default:return{type:`Character`,value:cc(this.popChar())}}}characterClass(){let e=[],t=!1;for(this.consumeChar(`[`),this.peekChar(0)===`^`&&(this.consumeChar(`^`),t=!0);this.isClassAtom();){let t=this.classAtom();if(t.type,isCharacter(t)&&this.isRangeDash()){this.consumeChar(`-`);let n=this.classAtom();if(n.type,isCharacter(n)){if(n.value<t.value)throw Error(`Range out of order in character class`);e.push({from:t.value,to:n.value})}else insertToSet(t.value,e),e.push(cc(`-`)),insertToSet(n.value,e)}else insertToSet(t.value,e)}return this.consumeChar(`]`),{type:`Set`,complement:t,value:e}}classAtom(){switch(this.peekChar()){case`]`:case`
|
|
6
|
+
`:case`\r`:case`\u2028`:case`\u2029`:throw Error(`TBD`);case`\\`:return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`b`:return this.consumeChar(`b`),{type:`Character`,value:cc(`\b`)};case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar(`(`),this.peekChar(0)){case`?`:this.consumeChar(`?`),this.consumeChar(`:`),e=!1;break;default:this.groupIdx++;break}let t=this.disjunction();this.consumeChar(`)`);let n={type:`Group`,capturing:e,value:t};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(a.test(e)===!1)throw Error(`Expecting a positive integer`);for(;i.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(i.test(e)===!1)throw Error(`Expecting an integer`);for(;i.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
|
|
7
|
+
`:case`\r`:case`\u2028`:case`\u2029`:case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:throw Error(`TBD`);default:return{type:`Character`,value:cc(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case`g`:case`i`:case`m`:case`u`:case`y`:return!0;default:return!1}}isRangeDash(){return this.peekChar()===`-`&&this.isClassAtom(1)}isDigit(){return i.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case`]`:case`
|
|
8
|
+
`:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case`.`:case`\\`:case`[`:case`(`:return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case`^`:case`$`:return!0;case`\\`:switch(this.peekChar(1)){case`b`:case`B`:return!0;default:return!1}case`(`:return this.peekChar(1)===`?`&&(this.peekChar(2)===`=`||this.peekChar(2)===`!`);default:return!1}}isQuantifier(){let e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:case`/`:case`
|
|
9
|
+
`:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}parseHexDigits(e){let t=``;for(let n=0;n<e;n++){let e=this.popChar();if(r.test(e)===!1)throw Error(`Expecting a HexDecimal digits`);t+=e}return{type:`Character`,value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error(`Expected: '`+e+`' but found: '`+this.input[this.idx]+`' at offset: `+this.idx);if(this.idx>=this.input.length)throw Error(`Unexpected end of input`);this.idx++}loc(e){return{begin:e,end:this.idx}}},BaseRegExpVisitor=class{visitChildren(e){for(let t in e){let n=e[t];e.hasOwnProperty(t)&&(n.type===void 0?Array.isArray(n)&&n.forEach(e=>{this.visit(e)},this):this.visit(n))}}visit(e){switch(e.type){case`Pattern`:this.visitPattern(e);break;case`Flags`:this.visitFlags(e);break;case`Disjunction`:this.visitDisjunction(e);break;case`Alternative`:this.visitAlternative(e);break;case`StartAnchor`:this.visitStartAnchor(e);break;case`EndAnchor`:this.visitEndAnchor(e);break;case`WordBoundary`:this.visitWordBoundary(e);break;case`NonWordBoundary`:this.visitNonWordBoundary(e);break;case`Lookahead`:this.visitLookahead(e);break;case`NegativeLookahead`:this.visitNegativeLookahead(e);break;case`Character`:this.visitCharacter(e);break;case`Set`:this.visitSet(e);break;case`Group`:this.visitGroup(e);break;case`GroupBackReference`:this.visitGroupBackReference(e);break;case`Quantifier`:this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}};export{RegExpParser as n,BaseRegExpVisitor as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../rolldown-runtime.mjs";function PRINT_ERROR(e){console&&console.error&&console.error(`Error: ${e}`)}function PRINT_WARNING(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function timer(e){let t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}function toFastProperties(e){function FakeConstructor(){}FakeConstructor.prototype=e;let t=new FakeConstructor;function fakeAccess(){return typeof t.bar}return fakeAccess(),fakeAccess(),e}export{PRINT_WARNING as i,timer as n,PRINT_ERROR as r,toFastProperties as t};
|