@lorion-org/react 1.0.0-beta.2 → 1.0.0-beta.4
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 +304 -15
- package/dist/index.cjs +49 -38
- package/dist/index.d.cts +21 -5
- package/dist/index.d.ts +21 -5
- package/dist/index.js +53 -15
- package/dist/vite.cjs +317 -130
- package/dist/vite.d.cts +64 -6
- package/dist/vite.d.ts +64 -6
- package/dist/vite.js +325 -107
- package/package.json +15 -8
- package/src/index.ts +3 -0
- package/src/relations.ts +8 -37
- package/src/runtime-config.ts +63 -0
- package/src/vite.ts +575 -129
- package/dist/chunk-5FUI4JPB.js +0 -38
package/dist/vite.d.cts
CHANGED
|
@@ -1,16 +1,64 @@
|
|
|
1
|
-
import { DescriptorId, CompositionPolicy, RelationDescriptor, DescriptorSelectionSeedInput
|
|
1
|
+
import { Descriptor, DescriptorId, CompositionPolicy, RelationDescriptor, DescriptorSelectionSeedInput } from '@lorion-org/composition-graph';
|
|
2
|
+
import { RuntimeConfigValidationPolicyInput, RuntimeConfigSection } from '@lorion-org/runtime-config';
|
|
3
|
+
import { RuntimeConfigPathPatternSource, RuntimeConfigSchemaValidationErrorFormatter } from '@lorion-org/runtime-config-node';
|
|
4
|
+
import { ActivationResolver } from '@lorion-org/surface-activation';
|
|
2
5
|
|
|
6
|
+
type CapabilityActivationEntry = {
|
|
7
|
+
exportName?: string;
|
|
8
|
+
exportSubpath?: string;
|
|
9
|
+
};
|
|
10
|
+
type ResolveCapabilityActivation = (input: {
|
|
11
|
+
capabilityDir: string;
|
|
12
|
+
descriptor: Descriptor;
|
|
13
|
+
packageJson: Record<string, unknown>;
|
|
14
|
+
packageName: string;
|
|
15
|
+
}) => CapabilityActivationEntry | null | undefined;
|
|
3
16
|
type CapabilityLoaderOptions = {
|
|
17
|
+
activation?: ResolveCapabilityActivation;
|
|
18
|
+
surface?: {
|
|
19
|
+
name: string;
|
|
20
|
+
resolver: ActivationResolver;
|
|
21
|
+
};
|
|
4
22
|
capabilitiesDir?: string;
|
|
5
23
|
baseDescriptors?: readonly DescriptorId[];
|
|
6
24
|
defaultSelection?: readonly DescriptorId[];
|
|
7
25
|
policy?: Partial<CompositionPolicy>;
|
|
8
26
|
relationDescriptors?: readonly RelationDescriptor[];
|
|
27
|
+
runtimeConfig?: false | ReactRuntimeConfigOptions;
|
|
9
28
|
selected?: readonly DescriptorId[];
|
|
10
29
|
selectionSeed?: false | CapabilitySelectionSeedOptions;
|
|
11
30
|
workspaceRoot?: string;
|
|
12
31
|
};
|
|
13
32
|
type CapabilitySelectionSeedOptions = Omit<DescriptorSelectionSeedInput, 'defaultValue'>;
|
|
33
|
+
type ReactRuntimeConfigEnvOptions = {
|
|
34
|
+
env?: Record<string, string | undefined>;
|
|
35
|
+
privatePrefix?: string;
|
|
36
|
+
publicPrefix?: string;
|
|
37
|
+
};
|
|
38
|
+
type ReactRuntimeConfigValidationOptions = {
|
|
39
|
+
formatError?: RuntimeConfigSchemaValidationErrorFormatter;
|
|
40
|
+
policy?: RuntimeConfigValidationPolicyInput;
|
|
41
|
+
schemaFileName?: string;
|
|
42
|
+
};
|
|
43
|
+
type ReactRuntimeConfigVarDirOptions = {
|
|
44
|
+
defaultValue?: string;
|
|
45
|
+
env?: Record<string, string | undefined>;
|
|
46
|
+
envKey?: string;
|
|
47
|
+
value?: string;
|
|
48
|
+
};
|
|
49
|
+
type ReactRuntimeConfigOptions = {
|
|
50
|
+
configFileName?: string;
|
|
51
|
+
enabled?: boolean;
|
|
52
|
+
env?: false | ReactRuntimeConfigEnvOptions;
|
|
53
|
+
schemaFileName?: string;
|
|
54
|
+
source?: false | RuntimeConfigPathPatternSource;
|
|
55
|
+
validation?: false | ReactRuntimeConfigValidationOptions;
|
|
56
|
+
varDir?: string | ReactRuntimeConfigVarDirOptions;
|
|
57
|
+
};
|
|
58
|
+
type ReactRuntimeConfig = {
|
|
59
|
+
private: Record<string, RuntimeConfigSection>;
|
|
60
|
+
public: Record<string, RuntimeConfigSection>;
|
|
61
|
+
};
|
|
14
62
|
type CapabilityRouteConfigOptions = CapabilityLoaderOptions & {
|
|
15
63
|
indexRouteFile?: false | string;
|
|
16
64
|
routesDirectory: string;
|
|
@@ -22,10 +70,12 @@ type LorionReactViteSetup = {
|
|
|
22
70
|
routeConfig: VirtualRootRoute;
|
|
23
71
|
};
|
|
24
72
|
type DiscoveredCapability = {
|
|
73
|
+
capabilityDir: string;
|
|
25
74
|
disabled: boolean;
|
|
26
|
-
entryFile
|
|
75
|
+
entryFile?: string;
|
|
76
|
+
exportName?: string;
|
|
27
77
|
id: string;
|
|
28
|
-
importSpecifier
|
|
78
|
+
importSpecifier?: string;
|
|
29
79
|
manifest: Descriptor;
|
|
30
80
|
packageName: string;
|
|
31
81
|
routesDirectory?: string;
|
|
@@ -46,20 +96,28 @@ type VirtualRootRoute = {
|
|
|
46
96
|
type: 'root';
|
|
47
97
|
};
|
|
48
98
|
type ViteResolvedConfig = {
|
|
99
|
+
env?: Record<string, string | undefined>;
|
|
100
|
+
envDir?: false | string;
|
|
101
|
+
mode?: string;
|
|
49
102
|
root: string;
|
|
50
103
|
};
|
|
51
104
|
type VitePlugin = {
|
|
52
105
|
configResolved: (resolvedConfig: ViteResolvedConfig) => void;
|
|
53
106
|
enforce: 'pre';
|
|
54
|
-
load: (id: string
|
|
107
|
+
load: (id: string, options?: {
|
|
108
|
+
ssr?: boolean | undefined;
|
|
109
|
+
}) => string | null;
|
|
55
110
|
name: string;
|
|
56
111
|
resolveId: (id: string) => string | undefined;
|
|
57
112
|
};
|
|
58
113
|
declare function capabilityLoader(options?: CapabilityLoaderOptions): VitePlugin;
|
|
114
|
+
declare function createReactRuntimeConfig(capabilities: readonly DiscoveredCapability[], workspaceRoot: string, options?: false | ReactRuntimeConfigOptions, viteConfig?: Partial<ViteResolvedConfig>): ReactRuntimeConfig;
|
|
59
115
|
declare function lorionReact(options: LorionReactViteOptions): LorionReactViteSetup;
|
|
60
|
-
declare function discoverCapabilities(workspaceRoot: string, options?: Pick<CapabilityLoaderOptions, 'capabilitiesDir'>): DiscoveredCapability[];
|
|
116
|
+
declare function discoverCapabilities(workspaceRoot: string, options?: Pick<CapabilityLoaderOptions, 'activation' | 'capabilitiesDir' | 'surface'>): DiscoveredCapability[];
|
|
61
117
|
declare function discoverSelectedCapabilities(workspaceRoot: string, options?: CapabilityLoaderOptions): DiscoveredCapability[];
|
|
62
118
|
declare function renderCapabilityModule(capabilities: readonly DiscoveredCapability[], selected?: readonly DescriptorId[]): string;
|
|
119
|
+
declare function renderRuntimeConfigModule(runtimeConfig: ReactRuntimeConfig): string;
|
|
120
|
+
declare function renderServerRuntimeConfigModule(runtimeConfig: ReactRuntimeConfig): string;
|
|
63
121
|
declare function createCapabilityRouteConfig(options: CapabilityRouteConfigOptions): VirtualRootRoute;
|
|
64
122
|
|
|
65
|
-
export { type CapabilityLoaderOptions, type CapabilityRouteConfigOptions, type CapabilitySelectionSeedOptions, type DiscoveredCapability, type LorionReactViteOptions, type LorionReactViteSetup, type VirtualIndexRoute, type VirtualPhysicalRouteSubtree, type VirtualRootRoute, type VitePlugin, type ViteResolvedConfig, capabilityLoader, createCapabilityRouteConfig, discoverCapabilities, discoverSelectedCapabilities, lorionReact, renderCapabilityModule };
|
|
123
|
+
export { type CapabilityActivationEntry, type CapabilityLoaderOptions, type CapabilityRouteConfigOptions, type CapabilitySelectionSeedOptions, type DiscoveredCapability, type LorionReactViteOptions, type LorionReactViteSetup, type ReactRuntimeConfig, type ReactRuntimeConfigEnvOptions, type ReactRuntimeConfigOptions, type ReactRuntimeConfigValidationOptions, type ReactRuntimeConfigVarDirOptions, type ResolveCapabilityActivation, type VirtualIndexRoute, type VirtualPhysicalRouteSubtree, type VirtualRootRoute, type VitePlugin, type ViteResolvedConfig, capabilityLoader, createCapabilityRouteConfig, createReactRuntimeConfig, discoverCapabilities, discoverSelectedCapabilities, lorionReact, renderCapabilityModule, renderRuntimeConfigModule, renderServerRuntimeConfigModule };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,16 +1,64 @@
|
|
|
1
|
-
import { DescriptorId, CompositionPolicy, RelationDescriptor, DescriptorSelectionSeedInput
|
|
1
|
+
import { Descriptor, DescriptorId, CompositionPolicy, RelationDescriptor, DescriptorSelectionSeedInput } from '@lorion-org/composition-graph';
|
|
2
|
+
import { RuntimeConfigValidationPolicyInput, RuntimeConfigSection } from '@lorion-org/runtime-config';
|
|
3
|
+
import { RuntimeConfigPathPatternSource, RuntimeConfigSchemaValidationErrorFormatter } from '@lorion-org/runtime-config-node';
|
|
4
|
+
import { ActivationResolver } from '@lorion-org/surface-activation';
|
|
2
5
|
|
|
6
|
+
type CapabilityActivationEntry = {
|
|
7
|
+
exportName?: string;
|
|
8
|
+
exportSubpath?: string;
|
|
9
|
+
};
|
|
10
|
+
type ResolveCapabilityActivation = (input: {
|
|
11
|
+
capabilityDir: string;
|
|
12
|
+
descriptor: Descriptor;
|
|
13
|
+
packageJson: Record<string, unknown>;
|
|
14
|
+
packageName: string;
|
|
15
|
+
}) => CapabilityActivationEntry | null | undefined;
|
|
3
16
|
type CapabilityLoaderOptions = {
|
|
17
|
+
activation?: ResolveCapabilityActivation;
|
|
18
|
+
surface?: {
|
|
19
|
+
name: string;
|
|
20
|
+
resolver: ActivationResolver;
|
|
21
|
+
};
|
|
4
22
|
capabilitiesDir?: string;
|
|
5
23
|
baseDescriptors?: readonly DescriptorId[];
|
|
6
24
|
defaultSelection?: readonly DescriptorId[];
|
|
7
25
|
policy?: Partial<CompositionPolicy>;
|
|
8
26
|
relationDescriptors?: readonly RelationDescriptor[];
|
|
27
|
+
runtimeConfig?: false | ReactRuntimeConfigOptions;
|
|
9
28
|
selected?: readonly DescriptorId[];
|
|
10
29
|
selectionSeed?: false | CapabilitySelectionSeedOptions;
|
|
11
30
|
workspaceRoot?: string;
|
|
12
31
|
};
|
|
13
32
|
type CapabilitySelectionSeedOptions = Omit<DescriptorSelectionSeedInput, 'defaultValue'>;
|
|
33
|
+
type ReactRuntimeConfigEnvOptions = {
|
|
34
|
+
env?: Record<string, string | undefined>;
|
|
35
|
+
privatePrefix?: string;
|
|
36
|
+
publicPrefix?: string;
|
|
37
|
+
};
|
|
38
|
+
type ReactRuntimeConfigValidationOptions = {
|
|
39
|
+
formatError?: RuntimeConfigSchemaValidationErrorFormatter;
|
|
40
|
+
policy?: RuntimeConfigValidationPolicyInput;
|
|
41
|
+
schemaFileName?: string;
|
|
42
|
+
};
|
|
43
|
+
type ReactRuntimeConfigVarDirOptions = {
|
|
44
|
+
defaultValue?: string;
|
|
45
|
+
env?: Record<string, string | undefined>;
|
|
46
|
+
envKey?: string;
|
|
47
|
+
value?: string;
|
|
48
|
+
};
|
|
49
|
+
type ReactRuntimeConfigOptions = {
|
|
50
|
+
configFileName?: string;
|
|
51
|
+
enabled?: boolean;
|
|
52
|
+
env?: false | ReactRuntimeConfigEnvOptions;
|
|
53
|
+
schemaFileName?: string;
|
|
54
|
+
source?: false | RuntimeConfigPathPatternSource;
|
|
55
|
+
validation?: false | ReactRuntimeConfigValidationOptions;
|
|
56
|
+
varDir?: string | ReactRuntimeConfigVarDirOptions;
|
|
57
|
+
};
|
|
58
|
+
type ReactRuntimeConfig = {
|
|
59
|
+
private: Record<string, RuntimeConfigSection>;
|
|
60
|
+
public: Record<string, RuntimeConfigSection>;
|
|
61
|
+
};
|
|
14
62
|
type CapabilityRouteConfigOptions = CapabilityLoaderOptions & {
|
|
15
63
|
indexRouteFile?: false | string;
|
|
16
64
|
routesDirectory: string;
|
|
@@ -22,10 +70,12 @@ type LorionReactViteSetup = {
|
|
|
22
70
|
routeConfig: VirtualRootRoute;
|
|
23
71
|
};
|
|
24
72
|
type DiscoveredCapability = {
|
|
73
|
+
capabilityDir: string;
|
|
25
74
|
disabled: boolean;
|
|
26
|
-
entryFile
|
|
75
|
+
entryFile?: string;
|
|
76
|
+
exportName?: string;
|
|
27
77
|
id: string;
|
|
28
|
-
importSpecifier
|
|
78
|
+
importSpecifier?: string;
|
|
29
79
|
manifest: Descriptor;
|
|
30
80
|
packageName: string;
|
|
31
81
|
routesDirectory?: string;
|
|
@@ -46,20 +96,28 @@ type VirtualRootRoute = {
|
|
|
46
96
|
type: 'root';
|
|
47
97
|
};
|
|
48
98
|
type ViteResolvedConfig = {
|
|
99
|
+
env?: Record<string, string | undefined>;
|
|
100
|
+
envDir?: false | string;
|
|
101
|
+
mode?: string;
|
|
49
102
|
root: string;
|
|
50
103
|
};
|
|
51
104
|
type VitePlugin = {
|
|
52
105
|
configResolved: (resolvedConfig: ViteResolvedConfig) => void;
|
|
53
106
|
enforce: 'pre';
|
|
54
|
-
load: (id: string
|
|
107
|
+
load: (id: string, options?: {
|
|
108
|
+
ssr?: boolean | undefined;
|
|
109
|
+
}) => string | null;
|
|
55
110
|
name: string;
|
|
56
111
|
resolveId: (id: string) => string | undefined;
|
|
57
112
|
};
|
|
58
113
|
declare function capabilityLoader(options?: CapabilityLoaderOptions): VitePlugin;
|
|
114
|
+
declare function createReactRuntimeConfig(capabilities: readonly DiscoveredCapability[], workspaceRoot: string, options?: false | ReactRuntimeConfigOptions, viteConfig?: Partial<ViteResolvedConfig>): ReactRuntimeConfig;
|
|
59
115
|
declare function lorionReact(options: LorionReactViteOptions): LorionReactViteSetup;
|
|
60
|
-
declare function discoverCapabilities(workspaceRoot: string, options?: Pick<CapabilityLoaderOptions, 'capabilitiesDir'>): DiscoveredCapability[];
|
|
116
|
+
declare function discoverCapabilities(workspaceRoot: string, options?: Pick<CapabilityLoaderOptions, 'activation' | 'capabilitiesDir' | 'surface'>): DiscoveredCapability[];
|
|
61
117
|
declare function discoverSelectedCapabilities(workspaceRoot: string, options?: CapabilityLoaderOptions): DiscoveredCapability[];
|
|
62
118
|
declare function renderCapabilityModule(capabilities: readonly DiscoveredCapability[], selected?: readonly DescriptorId[]): string;
|
|
119
|
+
declare function renderRuntimeConfigModule(runtimeConfig: ReactRuntimeConfig): string;
|
|
120
|
+
declare function renderServerRuntimeConfigModule(runtimeConfig: ReactRuntimeConfig): string;
|
|
63
121
|
declare function createCapabilityRouteConfig(options: CapabilityRouteConfigOptions): VirtualRootRoute;
|
|
64
122
|
|
|
65
|
-
export { type CapabilityLoaderOptions, type CapabilityRouteConfigOptions, type CapabilitySelectionSeedOptions, type DiscoveredCapability, type LorionReactViteOptions, type LorionReactViteSetup, type VirtualIndexRoute, type VirtualPhysicalRouteSubtree, type VirtualRootRoute, type VitePlugin, type ViteResolvedConfig, capabilityLoader, createCapabilityRouteConfig, discoverCapabilities, discoverSelectedCapabilities, lorionReact, renderCapabilityModule };
|
|
123
|
+
export { type CapabilityActivationEntry, type CapabilityLoaderOptions, type CapabilityRouteConfigOptions, type CapabilitySelectionSeedOptions, type DiscoveredCapability, type LorionReactViteOptions, type LorionReactViteSetup, type ReactRuntimeConfig, type ReactRuntimeConfigEnvOptions, type ReactRuntimeConfigOptions, type ReactRuntimeConfigValidationOptions, type ReactRuntimeConfigVarDirOptions, type ResolveCapabilityActivation, type VirtualIndexRoute, type VirtualPhysicalRouteSubtree, type VirtualRootRoute, type VitePlugin, type ViteResolvedConfig, capabilityLoader, createCapabilityRouteConfig, createReactRuntimeConfig, discoverCapabilities, discoverSelectedCapabilities, lorionReact, renderCapabilityModule, renderRuntimeConfigModule, renderServerRuntimeConfigModule };
|