@unframework.dev/compiler 0.2.0 → 0.2.2
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/dist/capabilities.d.ts +1 -3
- package/dist/capabilities.js +1 -2
- package/dist/compile.d.ts +1 -3
- package/dist/compile.js +1 -2
- package/dist/config-types.d.ts +1 -3
- package/dist/config.d.ts +1 -3
- package/dist/config.js +1 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/plugin-ir.js +1 -2
- package/dist/project.d.ts +2 -4
- package/dist/project.js +2 -3
- package/dist/resolver.d.ts +1 -3
- package/dist/resolver.js +1 -2
- package/dist/targets.d.ts +0 -2
- package/dist/targets.js +1 -2
- package/package.json +16 -16
package/dist/capabilities.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Target } from "@unframework.dev/codegen";
|
|
2
2
|
import { Diagnostic } from "@unframework.dev/diagnostics";
|
|
3
3
|
import { UfModule } from "@unframework.dev/ir";
|
|
4
|
-
//#region src/capabilities.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Pass P4: checks the capabilities a module uses against a target's matrix and reports a
|
|
7
6
|
* portability diagnostic for each one the target cannot support, where the module first uses
|
|
@@ -11,5 +10,4 @@ import { UfModule } from "@unframework.dev/ir";
|
|
|
11
10
|
* `nextTick`, refine `interactivity`: `CAPABILITY_PREREQUISITES`) is not reported again: the
|
|
12
11
|
* one report says the listener is inert, where three would say it at the same span.
|
|
13
12
|
*/
|
|
14
|
-
export declare function checkCapabilities(module: UfModule, target: Target): Diagnostic[];
|
|
15
|
-
//#endregion
|
|
13
|
+
export declare function checkCapabilities(module: UfModule, target: Target): Diagnostic[];
|
package/dist/capabilities.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CAPABILITY_PREREQUISITES, requiredCapabilities } from "@unframework.dev/codegen";
|
|
2
2
|
import { createDiagnostic } from "@unframework.dev/diagnostics";
|
|
3
|
-
|
|
3
|
+
// src/capabilities.ts
|
|
4
4
|
/**
|
|
5
5
|
* Pass P4: checks the capabilities a module uses against a target's matrix and reports a
|
|
6
6
|
* portability diagnostic for each one the target cannot support, where the module first uses
|
|
@@ -40,5 +40,4 @@ function checkCapabilities(module, target) {
|
|
|
40
40
|
}
|
|
41
41
|
return diagnostics;
|
|
42
42
|
}
|
|
43
|
-
//#endregion
|
|
44
43
|
export { checkCapabilities };
|
package/dist/compile.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { OutputFile, Target } from "@unframework.dev/codegen";
|
|
|
5
5
|
import { Diagnostic } from "@unframework.dev/diagnostics";
|
|
6
6
|
import { UfComponent, UfModule } from "@unframework.dev/ir";
|
|
7
7
|
import { TypeOracle } from "@unframework.dev/type-oracle";
|
|
8
|
-
//#region src/compile.d.ts
|
|
9
8
|
/** What an `output` plugin hook receives besides the files. */
|
|
10
9
|
export interface OutputHookContext {
|
|
11
10
|
target: string;
|
|
@@ -124,5 +123,4 @@ export interface CompileResult {
|
|
|
124
123
|
* problem, a misbehaving plugin or target included, is a diagnostic, and an error in one
|
|
125
124
|
* component or target never stops the others.
|
|
126
125
|
*/
|
|
127
|
-
export declare function compile(source: string, options: CompileOptions): Promise<CompileResult>;
|
|
128
|
-
//#endregion
|
|
126
|
+
export declare function compile(source: string, options: CompileOptions): Promise<CompileResult>;
|
package/dist/compile.js
CHANGED
|
@@ -8,7 +8,7 @@ import { createDiagnostic, sortDiagnostics } from "@unframework.dev/diagnostics"
|
|
|
8
8
|
import { checkInvariants, validateModule } from "@unframework.dev/ir";
|
|
9
9
|
import { parseModule } from "@unframework.dev/parser";
|
|
10
10
|
import { createSyntacticOracle } from "@unframework.dev/type-oracle";
|
|
11
|
-
|
|
11
|
+
// src/compile.ts
|
|
12
12
|
/**
|
|
13
13
|
* Checks the `passThrough` option (ADR-0064): throws when a prefix is empty, or starts with `.`,
|
|
14
14
|
* `/`, `\\` or a drive letter, since such a specifier names a file of the project, a component's
|
|
@@ -564,5 +564,4 @@ function pluginFailed(file, plugin, hook, what, target) {
|
|
|
564
564
|
...target ? { target } : {}
|
|
565
565
|
});
|
|
566
566
|
}
|
|
567
|
-
//#endregion
|
|
568
567
|
export { checkPassThrough, compile };
|
package/dist/config-types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/config-types.d.ts
|
|
2
1
|
/** The names of the built-in targets. */
|
|
3
2
|
export type TargetName = "react" | "vue" | "svelte" | "solid" | "angular" | "qwik" | "astro";
|
|
4
3
|
/** The targets packaging covers, and where each packager resolves from (ADR-0076). */
|
|
@@ -59,5 +58,4 @@ export interface UnframeworkConfig {
|
|
|
59
58
|
* the `font-fallback` message names them. Committed baselines take Inter alone (ADR-0105).
|
|
60
59
|
*/
|
|
61
60
|
liveFonts?: readonly string[];
|
|
62
|
-
}
|
|
63
|
-
//#endregion
|
|
61
|
+
}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PackageConfig, TargetName, UnframeworkConfig } from "./config-types.js";
|
|
2
2
|
import { Diagnostic } from "@unframework.dev/diagnostics";
|
|
3
|
-
//#region src/config.d.ts
|
|
4
3
|
/** The configuration with its defaults applied, and its paths absolute. */
|
|
5
4
|
export interface ResolvedConfig {
|
|
6
5
|
targets: readonly TargetName[];
|
|
@@ -50,5 +49,4 @@ export declare function loadConfig(root: string, file?: string): Promise<LoadedC
|
|
|
50
49
|
* target without a schema is given, UF7004, each with the field's JSON pointer. It is asynchronous
|
|
51
50
|
* because a Standard Schema may be.
|
|
52
51
|
*/
|
|
53
|
-
export declare function resolveConfig(raw: unknown, origin?: ConfigOrigin): Promise<ResolveConfigResult>;
|
|
54
|
-
//#endregion
|
|
52
|
+
export declare function resolveConfig(raw: unknown, origin?: ConfigOrigin): Promise<ResolveConfigResult>;
|
package/dist/config.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createDiagnostic } from "@unframework.dev/diagnostics";
|
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { dirname, relative, resolve } from "node:path";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
|
-
|
|
7
|
+
// src/config.ts
|
|
8
8
|
/** The file names {@link loadConfig} looks for, the first one found winning. */
|
|
9
9
|
const CONFIG_FILES = [
|
|
10
10
|
"unframework.config.ts",
|
|
@@ -273,5 +273,4 @@ function resolvePackage(value, targets, directory, report) {
|
|
|
273
273
|
} else if (from !== void 0) report("UF7002", "/package/resolveFrom", "must be a path, or an object of paths by target name.");
|
|
274
274
|
return resolved;
|
|
275
275
|
}
|
|
276
|
-
//#endregion
|
|
277
276
|
export { loadConfig, resolveConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { PackageConfig, ProjectViteConfig, TargetName, UnframeworkConfig, ViteContext, ViteMode, VitePluginOption } from "./config-types.js";
|
|
2
|
-
import { FileResolverOptions, ResolveRequest, ResolvedModule, ResolvedStylesheet, Resolver } from "./resolver.js";
|
|
3
|
-
import { TARGET_NAMES, builtinTargets, resolveTarget } from "./targets.js";
|
|
4
1
|
import { CompileOptions, CompileResult, CompilerPlugin, OutputHookContext, checkPassThrough, compile } from "./compile.js";
|
|
5
2
|
import { Project, ProjectOptions, ProjectUpdate, createFileResolver, createProject } from "./project.js";
|
|
3
|
+
import { FileResolverOptions, ResolveRequest, ResolvedModule, ResolvedStylesheet, Resolver } from "./resolver.js";
|
|
6
4
|
import { ConfigOrigin, LoadedConfig, ResolveConfigResult, ResolvedConfig, loadConfig, resolveConfig } from "./config.js";
|
|
5
|
+
import { PackageConfig, ProjectViteConfig, TargetName, UnframeworkConfig, ViteContext, ViteMode, VitePluginOption } from "./config-types.js";
|
|
6
|
+
import { TARGET_NAMES, builtinTargets, resolveTarget } from "./targets.js";
|
|
7
7
|
import { checkCapabilities } from "./capabilities.js";
|
|
8
8
|
import { DEFAULT_PASS_THROUGH } from "@unframework.dev/analyzer";
|
|
9
9
|
import { OutputFile, Target, requiredCapabilities } from "@unframework.dev/codegen";
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { checkCapabilities } from "./capabilities.js";
|
|
2
|
-
import { TARGET_NAMES, builtinTargets, resolveTarget } from "./targets.js";
|
|
3
1
|
import { checkPassThrough, compile } from "./compile.js";
|
|
4
2
|
import { createFileResolver, createProject } from "./project.js";
|
|
5
3
|
import { loadConfig, resolveConfig } from "./config.js";
|
|
4
|
+
import { TARGET_NAMES, builtinTargets, resolveTarget } from "./targets.js";
|
|
5
|
+
import { checkCapabilities } from "./capabilities.js";
|
|
6
6
|
import { DEFAULT_PASS_THROUGH } from "@unframework.dev/analyzer";
|
|
7
7
|
import { requiredCapabilities } from "@unframework.dev/codegen";
|
|
8
8
|
import { createSyntacticOracle } from "@unframework.dev/type-oracle";
|
package/dist/plugin-ir.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { codeOf, expressionsOf, functionsOf, spansOf } from "@unframework.dev/ir";
|
|
2
|
-
|
|
2
|
+
// src/plugin-ir.ts
|
|
3
3
|
/**
|
|
4
4
|
* Where a plugin's module (schema-valid) stops describing the source it was analysed from:
|
|
5
5
|
* - another file, or a span outside the source: diagnostics point at those spans, and JSON and
|
|
@@ -306,5 +306,4 @@ function isSpanIn(span, length) {
|
|
|
306
306
|
function unreachable(value) {
|
|
307
307
|
throw new Error(`Unexpected IR value: ${JSON.stringify(value)}`);
|
|
308
308
|
}
|
|
309
|
-
//#endregion
|
|
310
309
|
export { isSpanIn, pluginIrProblems };
|
package/dist/project.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { FileResolverOptions, Resolver } from "./resolver.js";
|
|
2
1
|
import { CompileOptions, CompileResult } from "./compile.js";
|
|
2
|
+
import { FileResolverOptions, Resolver } from "./resolver.js";
|
|
3
3
|
import { OutputFile } from "@unframework.dev/codegen";
|
|
4
|
-
//#region src/project.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Options for {@link createProject}: its files, as `createFileResolver`'s, and the options each of
|
|
7
6
|
* its compiles takes, but the file name and the resolver, which are the project's.
|
|
@@ -70,5 +69,4 @@ export declare function createProject(options: ProjectOptions): Project;
|
|
|
70
69
|
* import of a component from a `.uf.tsx` module, for the shortest cycle back to the importer
|
|
71
70
|
* (UF1205).
|
|
72
71
|
*/
|
|
73
|
-
export declare function createFileResolver(options: FileResolverOptions): Resolver;
|
|
74
|
-
//#endregion
|
|
72
|
+
export declare function createFileResolver(options: FileResolverOptions): Resolver;
|
package/dist/project.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { componentImportNames, directoryOf, joinPath, modulePath, relativePath, stylesheetSource, takesComponent } from "./resolver.js";
|
|
2
1
|
import { compile } from "./compile.js";
|
|
2
|
+
import { componentImportNames, directoryOf, joinPath, modulePath, relativePath, stylesheetSource, takesComponent } from "./resolver.js";
|
|
3
3
|
import { analyze, frameworkOf, isAuthoringModule, moduleSpecifiers, shapeQueries, stylesheetImports, unfollowedImports } from "@unframework.dev/analyzer";
|
|
4
4
|
import { parseModule } from "@unframework.dev/parser";
|
|
5
|
-
|
|
5
|
+
// src/project.ts
|
|
6
6
|
/**
|
|
7
7
|
* The project graph (ADR-0071) over the files `readFile` gives. A module's cache key is a hash of
|
|
8
8
|
* its source and of everything it read through the project: its children's APIs and the shapes
|
|
@@ -460,5 +460,4 @@ async function hash(text) {
|
|
|
460
460
|
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text));
|
|
461
461
|
return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
462
462
|
}
|
|
463
|
-
//#endregion
|
|
464
463
|
export { createFileResolver, createProject };
|
package/dist/resolver.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import "@unframework.dev/analyzer";
|
|
|
2
2
|
import { ModuleApi } from "@unframework.dev/ir";
|
|
3
3
|
import "@unframework.dev/parser";
|
|
4
4
|
import { TypeOracle } from "@unframework.dev/type-oracle";
|
|
5
|
-
//#region src/resolver.d.ts
|
|
6
5
|
/** What {@link compile}'s `resolve` option receives: an import's specifier, and its importer. */
|
|
7
6
|
export interface ResolveRequest {
|
|
8
7
|
/**
|
|
@@ -85,5 +84,4 @@ export interface FileResolverOptions {
|
|
|
85
84
|
* imports is unresolved. The caller owns it, and disposes of it.
|
|
86
85
|
*/
|
|
87
86
|
typeOracle?: TypeOracle;
|
|
88
|
-
}
|
|
89
|
-
//#endregion
|
|
87
|
+
}
|
package/dist/resolver.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isSharedModuleSpecifier } from "@unframework.dev/analyzer";
|
|
2
2
|
import { scopeStylesheet } from "@unframework.dev/codegen";
|
|
3
|
-
|
|
3
|
+
// src/resolver.ts
|
|
4
4
|
/** A shared module's file: the specifier as written, or with `.ts` where it has no extension. */
|
|
5
5
|
function modulePath(request) {
|
|
6
6
|
return isSharedModuleSpecifier(request.specifier) ? joinPath(directoryOf(request.importer), request.specifier.endsWith(".ts") ? request.specifier : `${request.specifier}.ts`) : void 0;
|
|
@@ -82,5 +82,4 @@ function takesComponent(api, names) {
|
|
|
82
82
|
}
|
|
83
83
|
/** A relative import of a `.uf.tsx` module. */
|
|
84
84
|
const COMPONENT_MODULE = /^\.\.?\/.*\.uf\.tsx$/;
|
|
85
|
-
//#endregion
|
|
86
85
|
export { componentImportNames, directoryOf, joinPath, modulePath, relativePath, stylesheetSource, takesComponent };
|
package/dist/targets.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { TargetName } from "./config-types.js";
|
|
2
2
|
import { Target } from "@unframework.dev/codegen";
|
|
3
|
-
//#region src/targets.d.ts
|
|
4
3
|
/** The built-in targets, in the order the docs and reports list them. */
|
|
5
4
|
export declare const TARGET_NAMES: readonly TargetName[];
|
|
6
5
|
/** The built-in targets by name. */
|
|
7
6
|
export declare const builtinTargets: Readonly<Record<TargetName, Target>>;
|
|
8
7
|
/** Resolves a target name, or passes a target object through (third-party targets). */
|
|
9
8
|
export declare function resolveTarget(target: TargetName | Target): Target;
|
|
10
|
-
//#endregion
|
|
11
9
|
export type { TargetName };
|
package/dist/targets.js
CHANGED
|
@@ -5,7 +5,7 @@ import react from "@unframework.dev/target-react";
|
|
|
5
5
|
import solid from "@unframework.dev/target-solid";
|
|
6
6
|
import svelte from "@unframework.dev/target-svelte";
|
|
7
7
|
import vue from "@unframework.dev/target-vue";
|
|
8
|
-
|
|
8
|
+
// src/targets.ts
|
|
9
9
|
/** The built-in targets, in the order the docs and reports list them. */
|
|
10
10
|
const TARGET_NAMES = [
|
|
11
11
|
"react",
|
|
@@ -32,5 +32,4 @@ function resolveTarget(target) {
|
|
|
32
32
|
if (!Object.hasOwn(builtinTargets, target)) throw new TypeError(`Unknown target "${target}".`);
|
|
33
33
|
return builtinTargets[target];
|
|
34
34
|
}
|
|
35
|
-
//#endregion
|
|
36
35
|
export { TARGET_NAMES, builtinTargets, resolveTarget };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unframework.dev/compiler",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "The Unframework compiler: compile() turns one .uf.tsx source into native React, Vue, Svelte, Solid, Angular, Qwik and Astro components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"unframework",
|
|
14
14
|
"vue"
|
|
15
15
|
],
|
|
16
|
-
"homepage": "https://
|
|
16
|
+
"homepage": "https://unframework.dev",
|
|
17
17
|
"bugs": "https://github.com/uxfront-com/unframework/issues",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"repository": {
|
|
@@ -41,24 +41,24 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@unframework.dev/analyzer": "0.1.
|
|
45
|
-
"@unframework.dev/codegen": "0.1.
|
|
46
|
-
"@unframework.dev/diagnostics": "0.1.
|
|
47
|
-
"@unframework.dev/ir": "0.1.
|
|
48
|
-
"@unframework.dev/parser": "0.1.
|
|
49
|
-
"@unframework.dev/target-angular": "0.1.
|
|
50
|
-
"@unframework.dev/target-astro": "0.1.
|
|
51
|
-
"@unframework.dev/target-qwik": "0.1.
|
|
52
|
-
"@unframework.dev/target-react": "0.1.
|
|
53
|
-
"@unframework.dev/target-solid": "0.1.
|
|
54
|
-
"@unframework.dev/target-svelte": "0.1.
|
|
55
|
-
"@unframework.dev/target-vue": "0.1.
|
|
56
|
-
"@unframework.dev/type-oracle": "0.1.
|
|
44
|
+
"@unframework.dev/analyzer": "0.1.1",
|
|
45
|
+
"@unframework.dev/codegen": "0.1.2",
|
|
46
|
+
"@unframework.dev/diagnostics": "0.1.1",
|
|
47
|
+
"@unframework.dev/ir": "0.1.1",
|
|
48
|
+
"@unframework.dev/parser": "0.1.1",
|
|
49
|
+
"@unframework.dev/target-angular": "0.1.2",
|
|
50
|
+
"@unframework.dev/target-astro": "0.1.2",
|
|
51
|
+
"@unframework.dev/target-qwik": "0.1.2",
|
|
52
|
+
"@unframework.dev/target-react": "0.1.2",
|
|
53
|
+
"@unframework.dev/target-solid": "0.1.2",
|
|
54
|
+
"@unframework.dev/target-svelte": "0.1.2",
|
|
55
|
+
"@unframework.dev/target-vue": "0.1.2",
|
|
56
|
+
"@unframework.dev/type-oracle": "0.1.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/node": "^24.19.0",
|
|
60
60
|
"@uxfront/typescript-config": "^0.1.0",
|
|
61
|
-
"tsdown": "^0.23.
|
|
61
|
+
"tsdown": "^0.23.7",
|
|
62
62
|
"vitest": "5.0.3"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|