@lbdudc/linea-core 0.1.1 → 0.2.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 +132 -260
- package/dist/analysis/analyze.d.ts +0 -54
- package/dist/analysis/analyze.js +1 -70
- package/dist/analysis/analyze.js.map +1 -1
- package/dist/analysis/runtime.d.ts +4 -73
- package/dist/analysis/runtime.js +7 -100
- package/dist/analysis/runtime.js.map +1 -1
- package/dist/analysis/uvl-text.d.ts +8 -0
- package/dist/analysis/uvl-text.js +70 -0
- package/dist/analysis/uvl-text.js.map +1 -0
- package/dist/assets.d.ts +0 -12
- package/dist/assets.js +0 -25
- package/dist/assets.js.map +1 -1
- package/dist/ci/annotations.d.ts +6 -0
- package/dist/ci/annotations.js +12 -0
- package/dist/ci/annotations.js.map +1 -0
- package/dist/ci/leftovers.d.ts +25 -0
- package/dist/ci/leftovers.js +50 -0
- package/dist/ci/leftovers.js.map +1 -0
- package/dist/ci/pairwise.d.ts +11 -0
- package/dist/ci/pairwise.js +35 -0
- package/dist/ci/pairwise.js.map +1 -0
- package/dist/ci/pipeline.d.ts +18 -0
- package/dist/ci/pipeline.js +26 -0
- package/dist/ci/pipeline.js.map +1 -0
- package/dist/ci/select.d.ts +28 -0
- package/dist/ci/select.js +43 -0
- package/dist/ci/select.js.map +1 -0
- package/dist/ci/validate-specs.d.ts +52 -0
- package/dist/ci/validate-specs.js +212 -0
- package/dist/ci/validate-specs.js.map +1 -0
- package/dist/constants.d.ts +1 -60
- package/dist/constants.js +1 -58
- package/dist/constants.js.map +1 -1
- package/dist/derivation/derive.d.ts +0 -56
- package/dist/derivation/derive.js +21 -72
- package/dist/derivation/derive.js.map +1 -1
- package/dist/derivation/engine.d.ts +10 -42
- package/dist/derivation/engine.js +37 -68
- package/dist/derivation/engine.js.map +1 -1
- package/dist/derivation/selection-error.d.ts +7 -0
- package/dist/derivation/selection-error.js +13 -0
- package/dist/derivation/selection-error.js.map +1 -0
- package/dist/errors.d.ts +19 -47
- package/dist/errors.js +28 -47
- package/dist/errors.js.map +1 -1
- package/dist/feature-model/uvl.d.ts +52 -0
- package/dist/feature-model/uvl.js +191 -0
- package/dist/feature-model/uvl.js.map +1 -0
- package/dist/fs/archive.d.ts +0 -16
- package/dist/fs/archive.js +0 -36
- package/dist/fs/archive.js.map +1 -1
- package/dist/fs/diff.d.ts +0 -30
- package/dist/fs/diff.js +4 -65
- package/dist/fs/diff.js.map +1 -1
- package/dist/fs/format.d.ts +0 -16
- package/dist/fs/format.js +0 -52
- package/dist/fs/format.js.map +1 -1
- package/dist/fs/workspace.d.ts +0 -52
- package/dist/fs/workspace.js +0 -56
- package/dist/fs/workspace.js.map +1 -1
- package/dist/index.d.ts +23 -29
- package/dist/index.js +15 -35
- package/dist/index.js.map +1 -1
- package/dist/internal/guards.d.ts +0 -13
- package/dist/internal/guards.js +0 -13
- package/dist/internal/guards.js.map +1 -1
- package/dist/line/deletion.d.ts +33 -0
- package/dist/line/deletion.js +23 -0
- package/dist/line/deletion.js.map +1 -0
- package/dist/line/platform-files.d.ts +15 -64
- package/dist/line/platform-files.js +18 -94
- package/dist/line/platform-files.js.map +1 -1
- package/dist/line/restoration.d.ts +27 -0
- package/dist/line/restoration.js +27 -0
- package/dist/line/restoration.js.map +1 -0
- package/dist/line/scaffold.d.ts +26 -57
- package/dist/line/scaffold.js +32 -93
- package/dist/line/scaffold.js.map +1 -1
- package/dist/line/templates/core/transformation.js +17 -5
- package/dist/line/templates/pipeline/github-ci.yml +50 -0
- package/dist/line/templates/pipeline/spl-gitlab-ci.yml +182 -0
- package/dist/modules/configuration/configure.d.ts +52 -0
- package/dist/modules/configuration/configure.js +101 -0
- package/dist/modules/configuration/configure.js.map +1 -0
- package/dist/modules/configuration/constants.d.ts +17 -0
- package/dist/modules/configuration/constants.js +14 -0
- package/dist/modules/configuration/constants.js.map +1 -0
- package/dist/modules/configuration/index.d.ts +6 -0
- package/dist/modules/configuration/index.js +5 -0
- package/dist/modules/configuration/index.js.map +1 -0
- package/dist/modules/configuration/names.d.ts +9 -0
- package/dist/modules/configuration/names.js +7 -0
- package/dist/modules/configuration/names.js.map +1 -0
- package/dist/modules/configuration/selection.d.ts +32 -0
- package/dist/modules/configuration/selection.js +49 -0
- package/dist/modules/configuration/selection.js.map +1 -0
- package/dist/modules/diagnostics.d.ts +2 -0
- package/dist/modules/diagnostics.js +2 -0
- package/dist/modules/diagnostics.js.map +1 -0
- package/dist/modules/index.d.ts +18 -0
- package/dist/modules/index.js +18 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/metamodels/engine.d.ts +93 -0
- package/dist/modules/metamodels/engine.js +10 -0
- package/dist/modules/metamodels/engine.js.map +1 -0
- package/dist/modules/metamodels/files.d.ts +40 -0
- package/dist/modules/metamodels/files.js +58 -0
- package/dist/modules/metamodels/files.js.map +1 -0
- package/dist/modules/metamodels/index.d.ts +8 -0
- package/dist/modules/metamodels/index.js +5 -0
- package/dist/modules/metamodels/index.js.map +1 -0
- package/dist/modules/metamodels/layout.d.ts +23 -0
- package/dist/modules/metamodels/layout.js +29 -0
- package/dist/modules/metamodels/layout.js.map +1 -0
- package/dist/modules/metamodels/offered.d.ts +15 -0
- package/dist/modules/metamodels/offered.js +14 -0
- package/dist/modules/metamodels/offered.js.map +1 -0
- package/dist/modules/metamodels/prepare.d.ts +20 -0
- package/dist/modules/metamodels/prepare.js +155 -0
- package/dist/modules/metamodels/prepare.js.map +1 -0
- package/dist/modules/packages/index.d.ts +4 -0
- package/dist/modules/packages/index.js +4 -0
- package/dist/modules/packages/index.js.map +1 -0
- package/dist/modules/packages/location.d.ts +21 -0
- package/dist/modules/packages/location.js +34 -0
- package/dist/modules/packages/location.js.map +1 -0
- package/dist/modules/packages/manifests.d.ts +33 -0
- package/dist/modules/packages/manifests.js +231 -0
- package/dist/modules/packages/manifests.js.map +1 -0
- package/dist/modules/packages/source.d.ts +34 -0
- package/dist/modules/packages/source.js +128 -0
- package/dist/modules/packages/source.js.map +1 -0
- package/dist/modules/products/check.d.ts +28 -0
- package/dist/modules/products/check.js +61 -0
- package/dist/modules/products/check.js.map +1 -0
- package/dist/modules/products/derive.d.ts +30 -0
- package/dist/modules/products/derive.js +56 -0
- package/dist/modules/products/derive.js.map +1 -0
- package/dist/modules/products/index.d.ts +5 -0
- package/dist/modules/products/index.js +4 -0
- package/dist/modules/products/index.js.map +1 -0
- package/dist/modules/products/seed.d.ts +18 -0
- package/dist/modules/products/seed.js +23 -0
- package/dist/modules/products/seed.js.map +1 -0
- package/dist/modules/registry/catalog.d.ts +64 -0
- package/dist/modules/registry/catalog.js +91 -0
- package/dist/modules/registry/catalog.js.map +1 -0
- package/dist/modules/registry/index.d.ts +5 -0
- package/dist/modules/registry/index.js +4 -0
- package/dist/modules/registry/index.js.map +1 -0
- package/dist/modules/registry/registry.d.ts +34 -0
- package/dist/modules/registry/registry.js +37 -0
- package/dist/modules/registry/registry.js.map +1 -0
- package/dist/modules/registry/routing.d.ts +8 -0
- package/dist/modules/registry/routing.js +23 -0
- package/dist/modules/registry/routing.js.map +1 -0
- package/dist/modules/resolution/closure.d.ts +28 -0
- package/dist/modules/resolution/closure.js +105 -0
- package/dist/modules/resolution/closure.js.map +1 -0
- package/dist/modules/resolution/index.d.ts +4 -0
- package/dist/modules/resolution/index.js +3 -0
- package/dist/modules/resolution/index.js.map +1 -0
- package/dist/modules/resolution/resolve.d.ts +33 -0
- package/dist/modules/resolution/resolve.js +59 -0
- package/dist/modules/resolution/resolve.js.map +1 -0
- package/dist/modules/resolution/resolvers.d.ts +23 -0
- package/dist/modules/resolution/resolvers.js +34 -0
- package/dist/modules/resolution/resolvers.js.map +1 -0
- package/dist/modules/spl/check.d.ts +25 -0
- package/dist/modules/spl/check.js +21 -0
- package/dist/modules/spl/check.js.map +1 -0
- package/dist/modules/spl/cip.d.ts +67 -0
- package/dist/modules/spl/cip.js +98 -0
- package/dist/modules/spl/cip.js.map +1 -0
- package/dist/modules/spl/feature-model.d.ts +39 -0
- package/dist/modules/spl/feature-model.js +106 -0
- package/dist/modules/spl/feature-model.js.map +1 -0
- package/dist/modules/spl/index.d.ts +6 -0
- package/dist/modules/spl/index.js +4 -0
- package/dist/modules/spl/index.js.map +1 -0
- package/dist/modules/spl/platform.d.ts +49 -0
- package/dist/modules/spl/platform.js +316 -0
- package/dist/modules/spl/platform.js.map +1 -0
- package/dist/modules/types.d.ts +132 -0
- package/dist/modules/types.js +2 -0
- package/dist/modules/types.js.map +1 -0
- package/dist/product/engine-spec.d.ts +0 -16
- package/dist/product/engine-spec.js +4 -50
- package/dist/product/engine-spec.js.map +1 -1
- package/dist/product/spec.d.ts +0 -82
- package/dist/product/spec.js +0 -79
- package/dist/product/spec.js.map +1 -1
- package/dist/product/version.d.ts +0 -23
- package/dist/product/version.js +0 -28
- package/dist/product/version.js.map +1 -1
- package/dist/products-index/products-index.d.ts +0 -165
- package/dist/products-index/products-index.js +0 -176
- package/dist/products-index/products-index.js.map +1 -1
- package/dist/workspace/context.d.ts +25 -0
- package/dist/workspace/context.js +43 -0
- package/dist/workspace/context.js.map +1 -0
- package/dist/workspace/gitExclude.d.ts +2 -0
- package/dist/workspace/gitExclude.js +19 -0
- package/dist/workspace/gitExclude.js.map +1 -0
- package/dist/workspace/host.d.ts +14 -0
- package/dist/workspace/host.js +13 -0
- package/dist/workspace/host.js.map +1 -0
- package/dist/workspace/index.d.ts +12 -0
- package/dist/workspace/index.js +12 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/local.d.ts +81 -0
- package/dist/workspace/local.js +287 -0
- package/dist/workspace/local.js.map +1 -0
- package/dist/workspace/modular.d.ts +95 -0
- package/dist/workspace/modular.js +301 -0
- package/dist/workspace/modular.js.map +1 -0
- package/dist/workspace/operations.d.ts +35 -0
- package/dist/workspace/operations.js +57 -0
- package/dist/workspace/operations.js.map +1 -0
- package/dist/workspace/origin.d.ts +20 -0
- package/dist/workspace/origin.js +19 -0
- package/dist/workspace/origin.js.map +1 -0
- package/package.json +22 -7
- package/dist/feature-model/convert.d.ts +0 -35
- package/dist/feature-model/convert.js +0 -47
- package/dist/feature-model/convert.js.map +0 -1
- package/dist/feature-model/engine.d.ts +0 -60
- package/dist/feature-model/engine.js +0 -139
- package/dist/feature-model/engine.js.map +0 -1
- package/dist/feature-model/inspect.d.ts +0 -67
- package/dist/feature-model/inspect.js +0 -113
- package/dist/feature-model/inspect.js.map +0 -1
- package/dist/feature-model/io.d.ts +0 -66
- package/dist/feature-model/io.js +0 -92
- package/dist/feature-model/io.js.map +0 -1
- package/dist/feature-model/parse.d.ts +0 -30
- package/dist/feature-model/parse.js +0 -36
- package/dist/feature-model/parse.js.map +0 -1
- package/dist/feature-model/text.d.ts +0 -54
- package/dist/feature-model/text.js +0 -126
- package/dist/feature-model/text.js.map +0 -1
- package/dist/line/templates/metamodels/dataModel/extra.js +0 -328
- package/dist/line/templates/metamodels/dataModel/transformation.js +0 -211
- package/dist/line/templates/metamodels/sensor/extra.js +0 -36
- package/dist/line/templates/metamodels/sensor/transformation.js +0 -47
- package/dist/selection/selection.d.ts +0 -126
- package/dist/selection/selection.js +0 -152
- package/dist/selection/selection.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.js","sourceRoot":"","sources":["../../src/derivation/derive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"derive.js","sourceRoot":"","sources":["../../src/derivation/derive.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAwB,MAAM,aAAa,CAAA;AAExF,MAAM,YAAY,GAAG,CAAC,IAAiB,EAAqB,EAAE,CAC5D,eAAe,CAAC,EAAE,IAAI,EAAE,CAAiC,CAAA;AAE3D,MAAM,aAAa,GA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C,GAAgB,CAAC,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAA;IACxF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAC7C,CAAC;AACH,CAAC,CAAA","sourcesContent":["import type { ProductSpec as EngineProductSpec } from 'spl-js-engine'\nimport { InvalidArgumentError } from '../errors.js'\nimport { ensureDir } from '../fs/workspace.js'\nimport { buildEngineSpec } from '../product/engine-spec.js'\nimport type { ProductSpec } from '../product/spec.js'\nimport { createEngine, rethrowDerivationError, type DerivationStage } from './engine.js'\n\nconst toEngineSpec = (spec: ProductSpec): EngineProductSpec =>\n buildEngineSpec({ spec }) as unknown as EngineProductSpec\n\nconst assertLineDir = (lineDir: unknown): string => {\n if (typeof lineDir !== 'string' || lineDir.trim() === '') {\n throw new InvalidArgumentError('\"lineDir\" must be a non-empty path.')\n }\n return lineDir\n}\n\nconst assertSpec = (spec: unknown): ProductSpec => {\n if (typeof spec !== 'object' || spec === null || Array.isArray(spec)) {\n throw new InvalidArgumentError('\"spec\" must be an object.')\n }\n return spec as ProductSpec\n}\n\nexport const deriveProduct = async ({\n lineDir,\n spec,\n outputDir\n}: {\n lineDir: string\n spec: ProductSpec\n outputDir: string\n}): Promise<{ outputDir: string }> => {\n assertLineDir(lineDir)\n const checkedSpec = assertSpec(spec)\n if (typeof outputDir !== 'string' || outputDir.trim() === '') {\n throw new InvalidArgumentError('\"outputDir\" must be a non-empty path.')\n }\n\n const target = ensureDir({ dirPath: outputDir })\n\n let stage: DerivationStage = 'setup'\n try {\n const engine = await createEngine(lineDir)\n stage = 'generate'\n await engine.generateProduct(target, toEngineSpec(checkedSpec))\n } catch (error) {\n rethrowDerivationError(error, stage)\n }\n\n return { outputDir: target }\n}\n\ninterface EngineZip {\n files: Record<string, { name: string, dir: boolean }>\n generateAsync: (options: { type: 'nodebuffer' }) => Promise<Buffer>\n}\n\nconst withPortableNames = (archive: EngineZip): EngineZip => {\n for (const name of Object.keys(archive.files)) {\n if (!name.includes('\\\\')) continue\n const portable = name.replace(/\\\\/g, '/')\n const entry = archive.files[name]\n delete archive.files[name]\n if (entry === undefined || (entry.dir && portable in archive.files)) continue\n entry.name = portable\n archive.files[portable] = entry\n }\n return archive\n}\n\nexport const deriveProductToZip = async ({\n lineDir,\n spec\n}: {\n lineDir: string\n spec: ProductSpec\n}): Promise<Buffer> => {\n assertLineDir(lineDir)\n const checkedSpec = assertSpec(spec)\n\n let stage: DerivationStage = 'setup'\n try {\n const engine = await createEngine(lineDir)\n stage = 'generate'\n const zip = await engine.generateZip(toEngineSpec(checkedSpec))\n return await withPortableNames(zip as EngineZip).generateAsync({ type: 'nodebuffer' })\n } catch (error) {\n return rethrowDerivationError(error, stage)\n }\n}\n"]}
|
|
@@ -1,48 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The slice of the engine this module actually drives.
|
|
3
|
-
*
|
|
4
|
-
* Declared locally rather than importing `DerivationEngineInstance`, for the
|
|
5
|
-
* same reason as `SolvingType` in `analysis/runtime.ts`: `spl-js-engine` ships
|
|
6
|
-
* no declarations of its own, and our ambient ones under `src/types/` are never
|
|
7
|
-
* published. A third-party type on an exported signature therefore ends up as a
|
|
8
|
-
* dangling reference in `dist/**\/*.d.ts` and breaks any consumer building with
|
|
9
|
-
* `skipLibCheck: false`. This one was NOT yet reachable from `index.d.ts`, so it
|
|
10
|
-
* did not fail anything — it was a latent version of the bug that did.
|
|
11
|
-
* `npm run check:consumer` now compiles every emitted declaration, so a
|
|
12
|
-
* regression here fails immediately instead of waiting for the day something
|
|
13
|
-
* public happens to expose it.
|
|
14
|
-
*/
|
|
15
1
|
interface DerivationEngineHandle {
|
|
16
2
|
generateProduct: (outputDir: string, spec: unknown) => Promise<unknown>;
|
|
17
3
|
generateZip: (spec: unknown) => Promise<unknown>;
|
|
18
4
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Builds a `DerivationEngine` for a line working directory.
|
|
21
|
-
*
|
|
22
|
-
* Remember the engine's constructor RETURNS A PROMISE — `new DerivationEngine()`
|
|
23
|
-
* evaluates to a promise and must be awaited. The positional argument order
|
|
24
|
-
* mirrors `utils.js:engine()`.
|
|
25
|
-
*/
|
|
26
5
|
export declare const createEngine: (lineDir: string) => Promise<DerivationEngineHandle>;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* then throws `LinePlatformNotFoundError` anyway.
|
|
38
|
-
* - anything else becomes `LinePlatformNotFoundError`.
|
|
39
|
-
*
|
|
40
|
-
* PARITY NOTE: in the monolith BOTH the ReferenceError branch and the catch-all
|
|
41
|
-
* throw `LinePlatformNotFoundError`; only the LOG MESSAGE differs. linea-core
|
|
42
|
-
* takes no log callback (generation logs are out of scope), so the distinction
|
|
43
|
-
* is preserved where it survives: the i18n key travels in the error MESSAGE
|
|
44
|
-
* instead of a log line, and the original error is attached as `cause`. The
|
|
45
|
-
* thrown TYPE is identical to the monolith's in every branch.
|
|
46
|
-
*/
|
|
47
|
-
export declare const rethrowDerivationError: (error: unknown) => never;
|
|
6
|
+
type CodeFileCallback = (filePath: string, ...rest: unknown[]) => unknown;
|
|
7
|
+
export interface EngineWithInput {
|
|
8
|
+
input?: {
|
|
9
|
+
forEachCodeFile?: (cb: CodeFileCallback) => unknown;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare const namingFailedTemplates: (engine: EngineWithInput) => void;
|
|
13
|
+
/** `setup`: building the engine from the platform files; `generate`: running the templates for a product. */
|
|
14
|
+
export type DerivationStage = 'setup' | 'generate';
|
|
15
|
+
export declare const rethrowDerivationError: (error: unknown, stage?: DerivationStage) => never;
|
|
48
16
|
export {};
|
|
@@ -1,52 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* INTERNAL adapter that builds a configured `DerivationEngine` from a line
|
|
3
|
-
* working directory, and classifies whatever the engine throws.
|
|
4
|
-
*
|
|
5
|
-
* Migrated from `linea/server/src/model/services/utils.js:engine` and
|
|
6
|
-
* `getEngineModel` (~18-36). Not exported from `src/index.ts`.
|
|
7
|
-
*/
|
|
8
1
|
import fs from 'node:fs';
|
|
9
2
|
import { DerivationEngine } from 'spl-js-engine';
|
|
10
3
|
import { PLATFORM_PATHS } from '../constants.js';
|
|
11
|
-
import { FeatureSelectionInvalidError, LinePlatformNotFoundError } from '../errors.js';
|
|
12
|
-
import { describeSelectionFailure, isFeatureSelectionError } from '
|
|
4
|
+
import { FeatureModelEmptyError, FeatureSelectionInvalidError, LinePlatformNotFoundError, TemplateError } from '../errors.js';
|
|
5
|
+
import { describeSelectionFailure, isFeatureSelectionError } from './selection-error.js';
|
|
13
6
|
import { fileExists, readTextFile, resolveLinePaths } from '../fs/workspace.js';
|
|
14
|
-
/**
|
|
15
|
-
* The `featureModel` argument for `DerivationEngine`.
|
|
16
|
-
*
|
|
17
|
-
* PARITY QUIRK, forced by the engine rather than chosen. `setFeatureModel`
|
|
18
|
-
* sniffs the notation with `featureModel.endsWith('uvl')` over the ARGUMENT, so:
|
|
19
|
-
*
|
|
20
|
-
* - for UVL it must be handed the FILE PATH — the path ends in `.uvl`, the
|
|
21
|
-
* check passes and `FeatureModel.fromUVL` reads the file. Passing UVL *text*
|
|
22
|
-
* would fail the `endsWith` test and the engine would try `fromXml` on it.
|
|
23
|
-
* - for XML it must be handed the CONTENT — a path not ending in `uvl` would go
|
|
24
|
-
* to `fromXml`, which would then try to parse the path itself as a document.
|
|
25
|
-
*
|
|
26
|
-
* That is exactly what `getEngineModel` does, and why it looks inconsistent.
|
|
27
|
-
*
|
|
28
|
-
* Note this bypasses `parseFeatureModel`, so the `asUvlContent` guard (which
|
|
29
|
-
* appends a newline to stop `fromUVL` reading a file) is NOT in play here: for
|
|
30
|
-
* UVL we deliberately WANT the file to be read, and the argument is a path we
|
|
31
|
-
* built ourselves from `lineDir`, never caller-supplied content.
|
|
32
|
-
*/
|
|
7
|
+
/** The feature model the derivation engine reads: the one composed from the SPL's feature model and its modules' (UVL). */
|
|
33
8
|
const resolveEngineModel = (lineDir) => {
|
|
34
9
|
const paths = resolveLinePaths({ lineDir });
|
|
35
|
-
if (fileExists({ filePath: paths.model }))
|
|
36
|
-
|
|
37
|
-
const xmlPath = paths.model.replace(/\.uvl$/, '.xml');
|
|
38
|
-
if (!fileExists({ filePath: xmlPath })) {
|
|
39
|
-
throw new LinePlatformNotFoundError(`No feature model in "${lineDir}": expected "${PLATFORM_PATHS.model}" or "${PLATFORM_PATHS.modelXml}".`);
|
|
10
|
+
if (!fileExists({ filePath: paths.model })) {
|
|
11
|
+
throw new LinePlatformNotFoundError(`No feature model in "${lineDir}": expected "${PLATFORM_PATHS.model}".`);
|
|
40
12
|
}
|
|
41
|
-
return
|
|
13
|
+
return paths.model;
|
|
42
14
|
};
|
|
43
|
-
/**
|
|
44
|
-
* Builds a `DerivationEngine` for a line working directory.
|
|
45
|
-
*
|
|
46
|
-
* Remember the engine's constructor RETURNS A PROMISE — `new DerivationEngine()`
|
|
47
|
-
* evaluates to a promise and must be awaited. The positional argument order
|
|
48
|
-
* mirrors `utils.js:engine()`.
|
|
49
|
-
*/
|
|
50
15
|
export const createEngine = async (lineDir) => {
|
|
51
16
|
const paths = resolveLinePaths({ lineDir });
|
|
52
17
|
const featureModel = resolveEngineModel(lineDir);
|
|
@@ -56,35 +21,34 @@ export const createEngine = async (lineDir) => {
|
|
|
56
21
|
const config = JSON.parse(readTextFile({ filePath: paths.config }));
|
|
57
22
|
const extraJs = readTextFile({ filePath: paths.extraJs });
|
|
58
23
|
const transformation = readTextFile({ filePath: paths.transformation });
|
|
59
|
-
// The cast is the price of not leaking `DerivationEngineInstance` into the
|
|
60
|
-
// published declarations: the engine's own parameter types are narrower than
|
|
61
|
-
// the structural handle, and function parameters are contravariant. Widening
|
|
62
|
-
// is safe here because this module is the only caller and it always passes the
|
|
63
|
-
// output of `buildEngineSpec`.
|
|
64
24
|
const engine = await new DerivationEngine(paths.code, featureModel, config, extraJs, transformation);
|
|
25
|
+
namingFailedTemplates(engine);
|
|
65
26
|
return engine;
|
|
66
27
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
export const rethrowDerivationError = (error) => {
|
|
28
|
+
const named = new WeakSet();
|
|
29
|
+
export const namingFailedTemplates = (engine) => {
|
|
30
|
+
const input = engine.input;
|
|
31
|
+
const forEach = input?.forEachCodeFile;
|
|
32
|
+
if (!input || typeof forEach !== 'function')
|
|
33
|
+
return;
|
|
34
|
+
input.forEachCodeFile = (cb) => forEach.call(input, (filePath, ...rest) => {
|
|
35
|
+
try {
|
|
36
|
+
return cb(filePath, ...rest);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if (error instanceof Error && !named.has(error)) {
|
|
40
|
+
named.add(error);
|
|
41
|
+
error.message = `${error.message} (${String(filePath).split('\\').join('/')})`;
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const ROOT_WITHOUT_FEATURES = 'abstract feature cannot be leaf';
|
|
48
|
+
export const rethrowDerivationError = (error, stage = 'setup') => {
|
|
49
|
+
if (error === ROOT_WITHOUT_FEATURES) {
|
|
50
|
+
throw new FeatureModelEmptyError('error_messages.feature_model_empty', { cause: error });
|
|
51
|
+
}
|
|
88
52
|
if (isFeatureSelectionError(error)) {
|
|
89
53
|
throw new FeatureSelectionInvalidError(describeSelectionFailure(error).message, { cause: error });
|
|
90
54
|
}
|
|
@@ -93,6 +57,11 @@ export const rethrowDerivationError = (error) => {
|
|
|
93
57
|
if (error instanceof ReferenceError) {
|
|
94
58
|
throw new LinePlatformNotFoundError('error_messages.missing_function_error', { cause: error });
|
|
95
59
|
}
|
|
96
|
-
|
|
60
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
61
|
+
// anything else that came out of the templates while generating (a TypeError on a missing section, a bad
|
|
62
|
+
// expression...): the platform exists, so it is not "platform not found" -- report the template failure it is
|
|
63
|
+
if (stage === 'generate')
|
|
64
|
+
throw new TemplateError(message, { cause: error });
|
|
65
|
+
throw new LinePlatformNotFoundError(message, { cause: error });
|
|
97
66
|
};
|
|
98
67
|
//# sourceMappingURL=engine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/derivation/engine.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/derivation/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,gBAAgB,EAA+B,MAAM,eAAe,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC7H,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AACxF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE/E,2HAA2H;AAC3H,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAU,EAAE;IACrD,MAAM,KAAK,GAAG,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;IAC3C,IAAI,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC;QAC3C,MAAM,I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AAA;IAC3D,IAAI,KAAK,YAAY,cAAc,EAAE,CAAC;QACpC,MAAM,IAAI,yBAAyB,CAAC,uCAAuC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;IAChG,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACtE,yGAAyG;IACzG,8GAA8G;IAC9G,IAAI,KAAK,KAAK,UAAU;QAAE,MAAM,IAAI,aAAa,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;IAC5E,MAAM,IAAI,yBAAyB,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;AAChE,CAAC,CAAA","sourcesContent":["import fs from 'node:fs'\nimport { DerivationEngine, type DerivationEngineConfig } from 'spl-js-engine'\nimport { PLATFORM_PATHS } from '../constants.js'\nimport { FeatureModelEmptyError, FeatureSelectionInvalidError, LinePlatformNotFoundError, TemplateError } from '../errors.js'\nimport { describeSelectionFailure, isFeatureSelectionError } from './selection-error.js'\nimport { fileExists, readTextFile, resolveLinePaths } from '../fs/workspace.js'\n\n/** The feature model the derivation engine reads: the one composed from the SPL's feature model and its modules' (UVL). */\nconst resolveEngineModel = (lineDir: string): string => {\n const paths = resolveLinePaths({ lineDir })\n if (!fileExists({ filePath: paths.model })) {\n throw new LinePlatformNotFoundError(`No feature model in \"${lineDir}\": expected \"${PLATFORM_PATHS.model}\".`)\n }\n return paths.model\n}\n\ninterface DerivationEngineHandle {\n generateProduct: (outputDir: string, spec: unknown) => Promise<unknown>\n generateZip: (spec: unknown) => Promise<unknown>\n}\n\nexport const createEngine = async (lineDir: string): Promise<DerivationEngineHandle> => {\n const paths = resolveLinePaths({ lineDir })\n const featureModel = resolveEngineModel(lineDir)\n\n if (!fs.existsSync(paths.code)) {\n throw new LinePlatformNotFoundError(\n `No annotated code in \"${lineDir}\": expected \"${PLATFORM_PATHS.code}\".`\n )\n }\n\n const config = JSON.parse(readTextFile({ filePath: paths.config })) as DerivationEngineConfig\n const extraJs = readTextFile({ filePath: paths.extraJs })\n const transformation = readTextFile({ filePath: paths.transformation })\n\n const engine = await new DerivationEngine(\n paths.code, featureModel, config, extraJs, transformation\n )\n namingFailedTemplates(engine as unknown as EngineWithInput)\n return engine as unknown as DerivationEngineHandle\n}\n\ntype CodeFileCallback = (filePath: string, ...rest: unknown[]) => unknown\nexport interface EngineWithInput { input?: { forEachCodeFile?: (cb: CodeFileCallback) => unknown } }\n\nconst named = new WeakSet<Error>()\n\nexport const namingFailedTemplates = (engine: EngineWithInput): void => {\n const input = engine.input\n const forEach = input?.forEachCodeFile\n if (!input || typeof forEach !== 'function') return\n input.forEachCodeFile = (cb) => forEach.call(input, (filePath: string, ...rest: unknown[]) => {\n try {\n return cb(filePath, ...rest)\n } catch (error) {\n if (error instanceof Error && !named.has(error)) {\n named.add(error)\n error.message = `${error.message} (${String(filePath).split('\\\\').join('/')})`\n }\n throw error\n }\n })\n}\n\nconst ROOT_WITHOUT_FEATURES = 'abstract feature cannot be leaf'\n\n/** `setup`: building the engine from the platform files; `generate`: running the templates for a product. */\nexport type DerivationStage = 'setup' | 'generate'\n\nexport const rethrowDerivationError = (error: unknown, stage: DerivationStage = 'setup'): never => {\n if (error === ROOT_WITHOUT_FEATURES) {\n throw new FeatureModelEmptyError('error_messages.feature_model_empty', { cause: error })\n }\n if (isFeatureSelectionError(error)) {\n throw new FeatureSelectionInvalidError(describeSelectionFailure(error).message, { cause: error })\n }\n if (error instanceof LinePlatformNotFoundError) throw error\n if (error instanceof ReferenceError) {\n throw new LinePlatformNotFoundError('error_messages.missing_function_error', { cause: error })\n }\n const message = error instanceof Error ? error.message : String(error)\n // anything else that came out of the templates while generating (a TypeError on a missing section, a bad\n // expression...): the platform exists, so it is not \"platform not found\" -- report the template failure it is\n if (stage === 'generate') throw new TemplateError(message, { cause: error })\n throw new LinePlatformNotFoundError(message, { cause: error })\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface SelectionFailure {
|
|
2
|
+
readonly message: string;
|
|
3
|
+
readonly errorType: string | null;
|
|
4
|
+
}
|
|
5
|
+
/** Whether the derivation engine refused a product because its feature selection does not fit the feature model. */
|
|
6
|
+
export declare const isFeatureSelectionError: (error: unknown) => boolean;
|
|
7
|
+
export declare const describeSelectionFailure: (error: unknown) => SelectionFailure;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import FeatureSelectionError from 'spl-js-engine/src/feature-model/feature-selection-error.js';
|
|
2
|
+
/** Whether the derivation engine refused a product because its feature selection does not fit the feature model. */
|
|
3
|
+
export const isFeatureSelectionError = (error) => error instanceof FeatureSelectionError;
|
|
4
|
+
export const describeSelectionFailure = (error) => {
|
|
5
|
+
if (error instanceof FeatureSelectionError) {
|
|
6
|
+
return { message: error.message, errorType: error.errorType ?? null };
|
|
7
|
+
}
|
|
8
|
+
if (error instanceof Error) {
|
|
9
|
+
return { message: error.message, errorType: null };
|
|
10
|
+
}
|
|
11
|
+
return { message: String(error), errorType: null };
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=selection-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-error.js","sourceRoot":"","sources":["../../src/derivation/selection-error.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,4DAA4D,CAAA;AAO9F,oHAAoH;AACpH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAc,EAAW,EAAE,CACjE,KAAK,YAAY,qBAAqB,CAAA;AAExC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAc,EAAoB,EAAE;IAC3E,IAAI,KAAK,YAAY,qBAAqB,EAAE,CAAC;QAC3C,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,IAAI,EAAE,CAAA;IACvE,CAAC;IACD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;IACpD,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;AACpD,CAAC,CAAA","sourcesContent":["import FeatureSelectionError from 'spl-js-engine/src/feature-model/feature-selection-error.js'\n\nexport interface SelectionFailure {\n readonly message: string\n readonly errorType: string | null\n}\n\n/** Whether the derivation engine refused a product because its feature selection does not fit the feature model. */\nexport const isFeatureSelectionError = (error: unknown): boolean =>\n error instanceof FeatureSelectionError\n\nexport const describeSelectionFailure = (error: unknown): SelectionFailure => {\n if (error instanceof FeatureSelectionError) {\n return { message: error.message, errorType: error.errorType ?? null }\n }\n if (error instanceof Error) {\n return { message: error.message, errorType: null }\n }\n return { message: String(error), errorType: null }\n}\n"]}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,72 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Migrated from `linea/server/src/model/errors/errors.js`, keeping only the
|
|
5
|
-
* subset that belongs to the offline engine. User-facing and GitLab-facing
|
|
6
|
-
* errors (`IncorrectCredentialsError`, `UserNotFoundError`, `PermissionError`,
|
|
7
|
-
* `AlreadyExistent*Error`, `LineNotFoundError`) stay in linea-server: linea-core
|
|
8
|
-
* knows nothing about users, sessions or repositories (ADR-002, ADR-003).
|
|
9
|
-
*
|
|
10
|
-
* Every error carries a stable `.code` so callers can branch on it without
|
|
11
|
-
* string-matching messages or relying on `instanceof` across module instances.
|
|
12
|
-
*/
|
|
13
|
-
/** Stable, machine-readable discriminator of a `LineaCoreError`. */
|
|
14
|
-
export type LineaCoreErrorCode = 'INVALID_ARGUMENT' | 'UVL_PARSE_ERROR' | 'UNSUPPORTED_CONVERSION' | 'FEATURE_SELECTION_INVALID' | 'LINE_PLATFORM_NOT_FOUND' | 'INVALID_PRODUCT_SPEC' | 'PRODUCTS_INDEX_ERROR' | 'ANALYSIS_RUNTIME_ERROR';
|
|
15
|
-
/** Base class of every error thrown by linea-core. */
|
|
1
|
+
import type { Diagnostic } from './modules/types.js';
|
|
2
|
+
export type LineaCoreErrorCode = 'INVALID_ARGUMENT' | 'UVL_PARSE_ERROR' | 'FEATURE_SELECTION_INVALID' | 'LINE_PLATFORM_NOT_FOUND' | 'FEATURE_MODEL_EMPTY' | 'INVALID_PRODUCT_SPEC' | 'PRODUCTS_INDEX_ERROR' | 'ANALYSIS_RUNTIME_ERROR' | 'MODULE_MANIFEST_INVALID' | 'MODULE_RESOLUTION_FAILED' | 'MODULE_CHECK_FAILED' | 'TEMPLATE_ERROR';
|
|
16
3
|
export declare class LineaCoreError extends Error {
|
|
17
|
-
/** Stable discriminator; never changes for a given subclass. */
|
|
18
4
|
readonly code: LineaCoreErrorCode;
|
|
19
5
|
constructor(code: LineaCoreErrorCode, message: string, options?: ErrorOptions);
|
|
20
6
|
}
|
|
21
|
-
/** A parameter is missing, malformed or outside its allowed domain. */
|
|
22
7
|
export declare class InvalidArgumentError extends LineaCoreError {
|
|
23
8
|
constructor(message: string, options?: ErrorOptions);
|
|
24
9
|
}
|
|
25
|
-
/**
|
|
26
|
-
* A UVL document could not be parsed.
|
|
27
|
-
* Equivalent of `UVLValidationError` in the monolith.
|
|
28
|
-
*/
|
|
29
10
|
export declare class UvlParseError extends LineaCoreError {
|
|
30
11
|
constructor(message: string, options?: ErrorOptions);
|
|
31
12
|
}
|
|
32
|
-
/**
|
|
33
|
-
* The requested feature model conversion is not supported (e.g. UVL to UVL).
|
|
34
|
-
* Migrated from `UnsupportedConversionError`.
|
|
35
|
-
*/
|
|
36
|
-
export declare class UnsupportedConversionError extends LineaCoreError {
|
|
37
|
-
constructor(message: string, options?: ErrorOptions);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* A feature selection is not valid against its feature model.
|
|
41
|
-
* Wraps `FeatureSelectionError` from spl-js-engine, which the monolith surfaces
|
|
42
|
-
* directly (e.g. `ProductService.js:14`, `agents/tools/evolution.js`).
|
|
43
|
-
*/
|
|
44
13
|
export declare class FeatureSelectionInvalidError extends LineaCoreError {
|
|
45
14
|
constructor(message: string, options?: ErrorOptions);
|
|
46
15
|
}
|
|
47
|
-
/**
|
|
48
|
-
* A line working directory has no platform feature model.
|
|
49
|
-
* Migrated from `LinePlatformNotFoundError` (used in `generatePipeline.js:27`).
|
|
50
|
-
*/
|
|
51
16
|
export declare class LinePlatformNotFoundError extends LineaCoreError {
|
|
52
17
|
constructor(message: string, options?: ErrorOptions);
|
|
53
18
|
}
|
|
54
|
-
/** A product
|
|
19
|
+
/** A template of the annotated code threw while the product was derived: the platform is there, one of its files is broken for this product. */
|
|
20
|
+
export declare class TemplateError extends LineaCoreError {
|
|
21
|
+
constructor(message: string, options?: ErrorOptions);
|
|
22
|
+
}
|
|
23
|
+
export declare class FeatureModelEmptyError extends LineaCoreError {
|
|
24
|
+
constructor(message: string, options?: ErrorOptions);
|
|
25
|
+
}
|
|
55
26
|
export declare class InvalidProductSpecError extends LineaCoreError {
|
|
56
27
|
constructor(message: string, options?: ErrorOptions);
|
|
57
28
|
}
|
|
58
|
-
/** The `products.json` index (ADR-011) is missing, unreadable or malformed. */
|
|
59
29
|
export declare class ProductsIndexError extends LineaCoreError {
|
|
60
30
|
constructor(message: string, options?: ErrorOptions);
|
|
61
31
|
}
|
|
62
|
-
/**
|
|
63
|
-
* The feature model analysis runtime could not start, failed its canary, or has
|
|
64
|
-
* already been disposed (ADR-021).
|
|
65
|
-
*
|
|
66
|
-
* Exists so a broken Pyodide bootstrap surfaces as an explicit failure. flamapy
|
|
67
|
-
* swallows those errors and then returns `undefined` from every operation, which
|
|
68
|
-
* would make an offline core report empty metrics without telling anyone.
|
|
69
|
-
*/
|
|
70
32
|
export declare class AnalysisRuntimeError extends LineaCoreError {
|
|
71
33
|
constructor(message: string, options?: ErrorOptions);
|
|
72
34
|
}
|
|
35
|
+
export declare class ModuleManifestError extends LineaCoreError {
|
|
36
|
+
constructor(message: string, options?: ErrorOptions);
|
|
37
|
+
}
|
|
38
|
+
export declare class ModuleResolutionError extends LineaCoreError {
|
|
39
|
+
constructor(message: string, options?: ErrorOptions);
|
|
40
|
+
}
|
|
41
|
+
export declare class ModuleCheckError extends LineaCoreError {
|
|
42
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
43
|
+
constructor(message: string, diagnostics: readonly Diagnostic[], options?: ErrorOptions);
|
|
44
|
+
}
|
package/dist/errors.js
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error taxonomy of linea-core.
|
|
3
|
-
*
|
|
4
|
-
* Migrated from `linea/server/src/model/errors/errors.js`, keeping only the
|
|
5
|
-
* subset that belongs to the offline engine. User-facing and GitLab-facing
|
|
6
|
-
* errors (`IncorrectCredentialsError`, `UserNotFoundError`, `PermissionError`,
|
|
7
|
-
* `AlreadyExistent*Error`, `LineNotFoundError`) stay in linea-server: linea-core
|
|
8
|
-
* knows nothing about users, sessions or repositories (ADR-002, ADR-003).
|
|
9
|
-
*
|
|
10
|
-
* Every error carries a stable `.code` so callers can branch on it without
|
|
11
|
-
* string-matching messages or relying on `instanceof` across module instances.
|
|
12
|
-
*/
|
|
13
|
-
/** Base class of every error thrown by linea-core. */
|
|
14
1
|
export class LineaCoreError extends Error {
|
|
15
|
-
/** Stable discriminator; never changes for a given subclass. */
|
|
16
2
|
code;
|
|
17
3
|
constructor(code, message, options) {
|
|
18
4
|
super(message, options);
|
|
@@ -20,72 +6,67 @@ export class LineaCoreError extends Error {
|
|
|
20
6
|
this.code = code;
|
|
21
7
|
}
|
|
22
8
|
}
|
|
23
|
-
/** A parameter is missing, malformed or outside its allowed domain. */
|
|
24
9
|
export class InvalidArgumentError extends LineaCoreError {
|
|
25
10
|
constructor(message, options) {
|
|
26
11
|
super('INVALID_ARGUMENT', message, options);
|
|
27
12
|
}
|
|
28
13
|
}
|
|
29
|
-
/**
|
|
30
|
-
* A UVL document could not be parsed.
|
|
31
|
-
* Equivalent of `UVLValidationError` in the monolith.
|
|
32
|
-
*/
|
|
33
14
|
export class UvlParseError extends LineaCoreError {
|
|
34
15
|
constructor(message, options) {
|
|
35
16
|
super('UVL_PARSE_ERROR', message, options);
|
|
36
17
|
}
|
|
37
18
|
}
|
|
38
|
-
/**
|
|
39
|
-
* The requested feature model conversion is not supported (e.g. UVL to UVL).
|
|
40
|
-
* Migrated from `UnsupportedConversionError`.
|
|
41
|
-
*/
|
|
42
|
-
export class UnsupportedConversionError extends LineaCoreError {
|
|
43
|
-
constructor(message, options) {
|
|
44
|
-
super('UNSUPPORTED_CONVERSION', message, options);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* A feature selection is not valid against its feature model.
|
|
49
|
-
* Wraps `FeatureSelectionError` from spl-js-engine, which the monolith surfaces
|
|
50
|
-
* directly (e.g. `ProductService.js:14`, `agents/tools/evolution.js`).
|
|
51
|
-
*/
|
|
52
19
|
export class FeatureSelectionInvalidError extends LineaCoreError {
|
|
53
20
|
constructor(message, options) {
|
|
54
21
|
super('FEATURE_SELECTION_INVALID', message, options);
|
|
55
22
|
}
|
|
56
23
|
}
|
|
57
|
-
/**
|
|
58
|
-
* A line working directory has no platform feature model.
|
|
59
|
-
* Migrated from `LinePlatformNotFoundError` (used in `generatePipeline.js:27`).
|
|
60
|
-
*/
|
|
61
24
|
export class LinePlatformNotFoundError extends LineaCoreError {
|
|
62
25
|
constructor(message, options) {
|
|
63
26
|
super('LINE_PLATFORM_NOT_FOUND', message, options);
|
|
64
27
|
}
|
|
65
28
|
}
|
|
66
|
-
/** A product
|
|
29
|
+
/** A template of the annotated code threw while the product was derived: the platform is there, one of its files is broken for this product. */
|
|
30
|
+
export class TemplateError extends LineaCoreError {
|
|
31
|
+
constructor(message, options) {
|
|
32
|
+
super('TEMPLATE_ERROR', message, options);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export class FeatureModelEmptyError extends LineaCoreError {
|
|
36
|
+
constructor(message, options) {
|
|
37
|
+
super('FEATURE_MODEL_EMPTY', message, options);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
67
40
|
export class InvalidProductSpecError extends LineaCoreError {
|
|
68
41
|
constructor(message, options) {
|
|
69
42
|
super('INVALID_PRODUCT_SPEC', message, options);
|
|
70
43
|
}
|
|
71
44
|
}
|
|
72
|
-
/** The `products.json` index (ADR-011) is missing, unreadable or malformed. */
|
|
73
45
|
export class ProductsIndexError extends LineaCoreError {
|
|
74
46
|
constructor(message, options) {
|
|
75
47
|
super('PRODUCTS_INDEX_ERROR', message, options);
|
|
76
48
|
}
|
|
77
49
|
}
|
|
78
|
-
/**
|
|
79
|
-
* The feature model analysis runtime could not start, failed its canary, or has
|
|
80
|
-
* already been disposed (ADR-021).
|
|
81
|
-
*
|
|
82
|
-
* Exists so a broken Pyodide bootstrap surfaces as an explicit failure. flamapy
|
|
83
|
-
* swallows those errors and then returns `undefined` from every operation, which
|
|
84
|
-
* would make an offline core report empty metrics without telling anyone.
|
|
85
|
-
*/
|
|
86
50
|
export class AnalysisRuntimeError extends LineaCoreError {
|
|
87
51
|
constructor(message, options) {
|
|
88
52
|
super('ANALYSIS_RUNTIME_ERROR', message, options);
|
|
89
53
|
}
|
|
90
54
|
}
|
|
55
|
+
export class ModuleManifestError extends LineaCoreError {
|
|
56
|
+
constructor(message, options) {
|
|
57
|
+
super('MODULE_MANIFEST_INVALID', message, options);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export class ModuleResolutionError extends LineaCoreError {
|
|
61
|
+
constructor(message, options) {
|
|
62
|
+
super('MODULE_RESOLUTION_FAILED', message, options);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export class ModuleCheckError extends LineaCoreError {
|
|
66
|
+
diagnostics;
|
|
67
|
+
constructor(message, diagnostics, options) {
|
|
68
|
+
super('MODULE_CHECK_FAILED', message, options);
|
|
69
|
+
this.diagnostics = diagnostics;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
91
72
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAgBA,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC9B,IAAI,CAAoB;IAEjC,YAAa,IAAwB,EAAE,OAAe,EAAE,OAAsB;QAC5E,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACvB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAA;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,cAAc;IACtD,YAAa,OAAe,EAAE,OAAsB;QAClD,KAAK,CAAC,kBAAkB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,cAAc;IAC/C,YAAa,OAAe,EAAE,OAAsB;QAClD,KAAK,CAAC,iBAAiB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IAC5C,CAAC;CACF;AAED,MAAM,OAAO,4BAA6B,SAAQ,cAAc;IAC9D,YAAa,OAAe,EAAE,OAAsB;QAClD,KAAK,CAAC,2BAA2B,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IACtD,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IAC3D,YAAa,OAAe,EAAE,OAAsB;QAClD,KAAK,CAAC,yBAAyB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IACpD,CAAC;CACF;AAED,gJAAgJ;A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AW,GAAG,WAAW,CAAA;IAChC,CAAC;CACF","sourcesContent":["import type { Diagnostic } from './modules/types.js'\n\nexport type LineaCoreErrorCode =\n | 'INVALID_ARGUMENT'\n | 'UVL_PARSE_ERROR'\n | 'FEATURE_SELECTION_INVALID'\n | 'LINE_PLATFORM_NOT_FOUND'\n | 'FEATURE_MODEL_EMPTY'\n | 'INVALID_PRODUCT_SPEC'\n | 'PRODUCTS_INDEX_ERROR'\n | 'ANALYSIS_RUNTIME_ERROR'\n | 'MODULE_MANIFEST_INVALID'\n | 'MODULE_RESOLUTION_FAILED'\n | 'MODULE_CHECK_FAILED'\n | 'TEMPLATE_ERROR'\n\nexport class LineaCoreError extends Error {\n readonly code: LineaCoreErrorCode\n\n constructor (code: LineaCoreErrorCode, message: string, options?: ErrorOptions) {\n super(message, options)\n this.name = new.target.name\n this.code = code\n }\n}\n\nexport class InvalidArgumentError extends LineaCoreError {\n constructor (message: string, options?: ErrorOptions) {\n super('INVALID_ARGUMENT', message, options)\n }\n}\n\nexport class UvlParseError extends LineaCoreError {\n constructor (message: string, options?: ErrorOptions) {\n super('UVL_PARSE_ERROR', message, options)\n }\n}\n\nexport class FeatureSelectionInvalidError extends LineaCoreError {\n constructor (message: string, options?: ErrorOptions) {\n super('FEATURE_SELECTION_INVALID', message, options)\n }\n}\n\nexport class LinePlatformNotFoundError extends LineaCoreError {\n constructor (message: string, options?: ErrorOptions) {\n super('LINE_PLATFORM_NOT_FOUND', message, options)\n }\n}\n\n/** A template of the annotated code threw while the product was derived: the platform is there, one of its files is broken for this product. */\nexport class TemplateError extends LineaCoreError {\n constructor (message: string, options?: ErrorOptions) {\n super('TEMPLATE_ERROR', message, options)\n }\n}\n\nexport class FeatureModelEmptyError extends LineaCoreError {\n constructor (message: string, options?: ErrorOptions) {\n super('FEATURE_MODEL_EMPTY', message, options)\n }\n}\n\nexport class InvalidProductSpecError extends LineaCoreError {\n constructor (message: string, options?: ErrorOptions) {\n super('INVALID_PRODUCT_SPEC', message, options)\n }\n}\n\nexport class ProductsIndexError extends LineaCoreError {\n constructor (message: string, options?: ErrorOptions) {\n super('PRODUCTS_INDEX_ERROR', message, options)\n }\n}\n\nexport class AnalysisRuntimeError extends LineaCoreError {\n constructor (message: string, options?: ErrorOptions) {\n super('ANALYSIS_RUNTIME_ERROR', message, options)\n }\n}\n\nexport class ModuleManifestError extends LineaCoreError {\n constructor (message: string, options?: ErrorOptions) {\n super('MODULE_MANIFEST_INVALID', message, options)\n }\n}\n\nexport class ModuleResolutionError extends LineaCoreError {\n constructor (message: string, options?: ErrorOptions) {\n super('MODULE_RESOLUTION_FAILED', message, options)\n }\n}\n\nexport class ModuleCheckError extends LineaCoreError {\n readonly diagnostics: readonly Diagnostic[]\n\n constructor (\n message: string,\n diagnostics: readonly Diagnostic[],\n options?: ErrorOptions\n ) {\n super('MODULE_CHECK_FAILED', message, options)\n this.diagnostics = diagnostics\n }\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The feature model as bango's feature metamodel (`featuremodel`) gives it as JSON (its JSON mapping, `featureModel`), and UVL (the
|
|
3
|
+
* Universal Variability Language, Boolean level) as text. The platform's tools speak UVL (flamapy, the derivation engine); the models are
|
|
4
|
+
* bango's. This is the one place where one becomes the other.
|
|
5
|
+
*/
|
|
6
|
+
export type GroupKind = 'mandatory' | 'optional' | 'alternative' | 'or' | 'cardinality';
|
|
7
|
+
export interface FeatureNode {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly abstract?: boolean;
|
|
10
|
+
readonly groups: readonly FeatureGroup[];
|
|
11
|
+
}
|
|
12
|
+
export interface FeatureGroup {
|
|
13
|
+
readonly kind: GroupKind;
|
|
14
|
+
/** Only for a `cardinality` group: `[min..max]`; `max` is missing when there is none (`[min..*]`). */
|
|
15
|
+
readonly min?: number;
|
|
16
|
+
readonly max?: number;
|
|
17
|
+
readonly features: readonly FeatureNode[];
|
|
18
|
+
}
|
|
19
|
+
export type Formula = {
|
|
20
|
+
readonly feature: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly not: Formula;
|
|
23
|
+
} | {
|
|
24
|
+
readonly operator: '&' | '|' | '=>' | '<=>';
|
|
25
|
+
readonly left: Formula;
|
|
26
|
+
readonly right: Formula;
|
|
27
|
+
};
|
|
28
|
+
export interface FeatureModelTree {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly root: FeatureNode;
|
|
31
|
+
readonly constraints: readonly Formula[];
|
|
32
|
+
}
|
|
33
|
+
/** A name as UVL writes it: plain when it can be, else between double quotes (which cannot hold a dot, a quote or a line break). */
|
|
34
|
+
export declare const uvlName: ({ name }: {
|
|
35
|
+
name: string;
|
|
36
|
+
}) => string;
|
|
37
|
+
/** The tree as UVL: tabs, one feature or group to a line, empty groups left out (UVL has none), constraints one to a line. */
|
|
38
|
+
export declare const printUvl: ({ tree }: {
|
|
39
|
+
tree: FeatureModelTree;
|
|
40
|
+
}) => string;
|
|
41
|
+
/**
|
|
42
|
+
* UVL (Boolean level: features with mandatory, optional, alternative, or and cardinality groups, and `! & | => <=>` constraints) as a tree.
|
|
43
|
+
* `namespace`, `include` and `imports` are skipped. What is not supported (typed features, feature cardinalities, arithmetic) is said, with its line.
|
|
44
|
+
* Throws `UvlParseError`.
|
|
45
|
+
*/
|
|
46
|
+
export declare const parseUvl: ({ content }: {
|
|
47
|
+
content: string;
|
|
48
|
+
}) => FeatureModelTree;
|
|
49
|
+
/** Every feature of the tree, parents first. */
|
|
50
|
+
export declare const featuresOf: ({ tree }: {
|
|
51
|
+
tree: FeatureModelTree;
|
|
52
|
+
}) => FeatureNode[];
|