voltra 2.2.0 → 2.3.1
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/build/cjs/apply/index.js +6 -1
- package/build/cjs/apply/index.js.map +1 -1
- package/build/cjs/config/normalize.js +150 -31
- package/build/cjs/config/normalize.js.map +1 -1
- package/build/cjs/config/perConfiguration.js +29 -0
- package/build/cjs/config/perConfiguration.js.map +1 -0
- package/build/cjs/config/serverUpdate.js +119 -0
- package/build/cjs/config/serverUpdate.js.map +1 -0
- package/build/cjs/config/widgetKind.js +25 -0
- package/build/cjs/config/widgetKind.js.map +1 -0
- package/build/cjs/dependencies/platformPackages.js +9 -0
- package/build/cjs/dependencies/platformPackages.js.map +1 -1
- package/build/cjs/discovery/ios.js +50 -31
- package/build/cjs/discovery/ios.js.map +1 -1
- package/build/cjs/discovery/metro.js +52 -0
- package/build/cjs/discovery/metro.js.map +1 -0
- package/build/cjs/index.js +6 -2
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/platforms/android/generated.js +98 -40
- package/build/cjs/platforms/android/generated.js.map +1 -1
- package/build/cjs/platforms/android/widgetSizing.js +89 -0
- package/build/cjs/platforms/android/widgetSizing.js.map +1 -0
- package/build/cjs/platforms/ios/apply.js +21 -11
- package/build/cjs/platforms/ios/apply.js.map +1 -1
- package/build/cjs/platforms/ios/buildConfigurationValues.js +73 -0
- package/build/cjs/platforms/ios/buildConfigurationValues.js.map +1 -0
- package/build/cjs/platforms/ios/entitlements.js +34 -19
- package/build/cjs/platforms/ios/entitlements.js.map +1 -1
- package/build/cjs/platforms/ios/generated.js +79 -32
- package/build/cjs/platforms/ios/generated.js.map +1 -1
- package/build/cjs/platforms/ios/plist.js +22 -4
- package/build/cjs/platforms/ios/plist.js.map +1 -1
- package/build/cjs/platforms/ios/targetName.js.map +1 -1
- package/build/cjs/platforms/ios/xcodeTarget.js +166 -23
- package/build/cjs/platforms/ios/xcodeTarget.js.map +1 -1
- package/build/cjs/platforms/shared/widgetModule.js +18 -145
- package/build/cjs/platforms/shared/widgetModule.js.map +1 -1
- package/build/esm/apply/index.js +6 -1
- package/build/esm/apply/index.js.map +1 -1
- package/build/esm/config/normalize.js +150 -31
- package/build/esm/config/normalize.js.map +1 -1
- package/build/esm/config/perConfiguration.js +25 -0
- package/build/esm/config/perConfiguration.js.map +1 -0
- package/build/esm/config/serverUpdate.js +112 -0
- package/build/esm/config/serverUpdate.js.map +1 -0
- package/build/esm/config/widgetKind.js +20 -0
- package/build/esm/config/widgetKind.js.map +1 -0
- package/build/esm/dependencies/platformPackages.js +8 -0
- package/build/esm/dependencies/platformPackages.js.map +1 -1
- package/build/esm/discovery/ios.js +50 -31
- package/build/esm/discovery/ios.js.map +1 -1
- package/build/esm/discovery/metro.js +46 -0
- package/build/esm/discovery/metro.js.map +1 -0
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/platforms/android/generated.js +100 -42
- package/build/esm/platforms/android/generated.js.map +1 -1
- package/build/esm/platforms/android/widgetSizing.js +85 -0
- package/build/esm/platforms/android/widgetSizing.js.map +1 -0
- package/build/esm/platforms/ios/apply.js +21 -11
- package/build/esm/platforms/ios/apply.js.map +1 -1
- package/build/esm/platforms/ios/buildConfigurationValues.js +68 -0
- package/build/esm/platforms/ios/buildConfigurationValues.js.map +1 -0
- package/build/esm/platforms/ios/entitlements.js +34 -19
- package/build/esm/platforms/ios/entitlements.js.map +1 -1
- package/build/esm/platforms/ios/generated.js +80 -33
- package/build/esm/platforms/ios/generated.js.map +1 -1
- package/build/esm/platforms/ios/plist.js +22 -4
- package/build/esm/platforms/ios/plist.js.map +1 -1
- package/build/esm/platforms/ios/targetName.js.map +1 -1
- package/build/esm/platforms/ios/xcodeTarget.js +166 -23
- package/build/esm/platforms/ios/xcodeTarget.js.map +1 -1
- package/build/esm/platforms/shared/widgetModule.js +16 -107
- package/build/esm/platforms/shared/widgetModule.js.map +1 -1
- package/build/types/apply/index.d.ts.map +1 -1
- package/build/types/config/normalize.d.ts.map +1 -1
- package/build/types/config/perConfiguration.d.ts +18 -0
- package/build/types/config/perConfiguration.d.ts.map +1 -0
- package/build/types/config/serverUpdate.d.ts +80 -0
- package/build/types/config/serverUpdate.d.ts.map +1 -0
- package/build/types/config/types.d.ts +91 -30
- package/build/types/config/types.d.ts.map +1 -1
- package/build/types/config/widgetKind.d.ts +11 -0
- package/build/types/config/widgetKind.d.ts.map +1 -0
- package/build/types/dependencies/platformPackages.d.ts +1 -0
- package/build/types/dependencies/platformPackages.d.ts.map +1 -1
- package/build/types/discovery/ios.d.ts +10 -0
- package/build/types/discovery/ios.d.ts.map +1 -1
- package/build/types/discovery/metro.d.ts +21 -0
- package/build/types/discovery/metro.d.ts.map +1 -0
- package/build/types/index.d.ts +3 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/platforms/android/generated.d.ts.map +1 -1
- package/build/types/platforms/android/widgetSizing.d.ts +50 -0
- package/build/types/platforms/android/widgetSizing.d.ts.map +1 -0
- package/build/types/platforms/ios/apply.d.ts.map +1 -1
- package/build/types/platforms/ios/buildConfigurationValues.d.ts +33 -0
- package/build/types/platforms/ios/buildConfigurationValues.d.ts.map +1 -0
- package/build/types/platforms/ios/entitlements.d.ts +4 -4
- package/build/types/platforms/ios/entitlements.d.ts.map +1 -1
- package/build/types/platforms/ios/generated.d.ts +14 -2
- package/build/types/platforms/ios/generated.d.ts.map +1 -1
- package/build/types/platforms/ios/plist.d.ts +3 -3
- package/build/types/platforms/ios/plist.d.ts.map +1 -1
- package/build/types/platforms/ios/podfile.d.ts +2 -2
- package/build/types/platforms/ios/podfile.d.ts.map +1 -1
- package/build/types/platforms/ios/targetName.d.ts +2 -2
- package/build/types/platforms/ios/targetName.d.ts.map +1 -1
- package/build/types/platforms/ios/xcodeTarget.d.ts +4 -2
- package/build/types/platforms/ios/xcodeTarget.d.ts.map +1 -1
- package/build/types/platforms/shared/widgetModule.d.ts +12 -3
- package/build/types/platforms/shared/widgetModule.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/apply/index.ts +6 -1
- package/src/config/normalize.node.test.ts +105 -0
- package/src/config/normalize.ts +217 -45
- package/src/config/perConfiguration.ts +49 -0
- package/src/config/serverUpdate.ts +160 -0
- package/src/config/types.ts +97 -30
- package/src/config/widgetKind.node.test.ts +27 -0
- package/src/config/widgetKind.ts +27 -0
- package/src/dependencies/platformPackages.ts +11 -0
- package/src/discovery/ios.ts +104 -60
- package/src/discovery/metro.node.test.ts +91 -0
- package/src/discovery/metro.ts +54 -0
- package/src/index.ts +8 -0
- package/src/platforms/android/generated.ts +144 -47
- package/src/platforms/android/widgetSizing.ts +112 -0
- package/src/platforms/ios/apply.ts +21 -11
- package/src/platforms/ios/buildConfigurationValues.ts +105 -0
- package/src/platforms/ios/entitlements.ts +55 -31
- package/src/platforms/ios/generated.node.test.ts +61 -0
- package/src/platforms/ios/generated.ts +137 -38
- package/src/platforms/ios/plist.ts +36 -7
- package/src/platforms/ios/podfile.ts +2 -2
- package/src/platforms/ios/targetName.ts +2 -2
- package/src/platforms/ios/xcodeTarget.ts +248 -43
- package/src/platforms/shared/widgetModule.ts +22 -140
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { VoltraCliError } from '../../reporting/summary';
|
|
2
2
|
import type { IOSProjectDiscovery } from '../../discovery/ios';
|
|
3
|
-
import type {
|
|
3
|
+
import type { NormalizedIOSWidgetConfig, ResolvedVoltraIOSConfig } from '../../config/types';
|
|
4
4
|
import type { ReportedChange } from '../../reporting/summary';
|
|
5
5
|
export interface GenerateIOSFilesOptions {
|
|
6
6
|
projectRoot: string;
|
|
7
|
-
ios:
|
|
7
|
+
ios: ResolvedVoltraIOSConfig;
|
|
8
8
|
discovery: IOSProjectDiscovery;
|
|
9
9
|
}
|
|
10
10
|
export interface GenerateIOSFilesResult {
|
|
@@ -14,8 +14,20 @@ export interface GenerateIOSFilesResult {
|
|
|
14
14
|
targetName: string;
|
|
15
15
|
targetPath: string;
|
|
16
16
|
}
|
|
17
|
+
export type DetectedIOSWidget = (NormalizedIOSWidgetConfig & {
|
|
18
|
+
clientRendered: false;
|
|
19
|
+
}) | (NormalizedIOSWidgetConfig & {
|
|
20
|
+
entry: string;
|
|
21
|
+
clientRendered: true;
|
|
22
|
+
clientSourcePath: string;
|
|
23
|
+
});
|
|
17
24
|
export declare class IOSGeneratedFilesError extends VoltraCliError {
|
|
18
25
|
constructor(message: string);
|
|
19
26
|
}
|
|
20
27
|
export declare function generateIOSFiles(options: GenerateIOSFilesOptions): Promise<GenerateIOSFilesResult>;
|
|
28
|
+
declare function generateWidgetBundleSwift(widgets: DetectedIOSWidget[]): string;
|
|
29
|
+
export declare const __test__: {
|
|
30
|
+
generateWidgetBundleSwift: typeof generateWidgetBundleSwift;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
21
33
|
//# sourceMappingURL=generated.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generated.d.ts","sourceRoot":"","sources":["../../../../src/platforms/ios/generated.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"generated.d.ts","sourceRoot":"","sources":["../../../../src/platforms/ios/generated.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAQxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAGV,yBAAyB,EACzB,uBAAuB,EAExB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AA8E7D,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,uBAAuB,CAAA;IAC5B,SAAS,EAAE,mBAAmB,CAAA;CAC/B;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AA0BD,MAAM,MAAM,iBAAiB,GACzB,CAAC,yBAAyB,GAAG;IAAE,cAAc,EAAE,KAAK,CAAA;CAAE,CAAC,GACvD,CAAC,yBAAyB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,IAAI,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAEnG,qBAAa,sBAAuB,SAAQ,cAAc;gBAC5C,OAAO,EAAE,MAAM;CAI5B;AAMD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAgFxG;AAuVD,iBAAS,yBAAyB,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAkEvE;AA6qBD,eAAO,MAAM,QAAQ;;CAEpB,CAAA"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { VoltraCliError } from '../../reporting/summary';
|
|
2
2
|
import type { IOSProjectDiscovery } from '../../discovery/ios';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ResolvedVoltraIOSConfig } from '../../config/types';
|
|
4
4
|
import type { ReportedChange } from '../../reporting/summary';
|
|
5
5
|
type PlistErrorFactory = (message: string) => Error;
|
|
6
6
|
export interface EnsureInfoPlistOptions {
|
|
7
7
|
projectRoot: string;
|
|
8
|
-
ios:
|
|
8
|
+
ios: ResolvedVoltraIOSConfig;
|
|
9
9
|
discovery: IOSProjectDiscovery;
|
|
10
10
|
}
|
|
11
11
|
export interface EnsureInfoPlistResult {
|
|
12
|
-
|
|
12
|
+
changes: ReportedChange[];
|
|
13
13
|
}
|
|
14
14
|
export declare class IOSInfoPlistMutationError extends VoltraCliError {
|
|
15
15
|
constructor(message: string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plist.d.ts","sourceRoot":"","sources":["../../../../src/platforms/ios/plist.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plist.d.ts","sourceRoot":"","sources":["../../../../src/platforms/ios/plist.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAa7D,KAAK,iBAAiB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,KAAK,CAAA;AAEnD,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,uBAAuB,CAAA;IAC5B,SAAS,EAAE,mBAAmB,CAAA;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,cAAc,EAAE,CAAA;CAC1B;AAED,qBAAa,yBAA0B,SAAQ,cAAc;gBAC/C,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAcrG;AAmDD,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,iBAAiB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAuBlC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,GAAG,MAAM,CAiBpF"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { VoltraCliError } from '../../reporting/summary';
|
|
2
2
|
import type { IOSProjectDiscovery } from '../../discovery/ios';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ResolvedVoltraIOSConfig } from '../../config/types';
|
|
4
4
|
import type { ReportedChange } from '../../reporting/summary';
|
|
5
5
|
export interface EnsurePodfileBlockOptions {
|
|
6
6
|
projectRoot: string;
|
|
7
|
-
ios:
|
|
7
|
+
ios: ResolvedVoltraIOSConfig;
|
|
8
8
|
discovery: IOSProjectDiscovery;
|
|
9
9
|
}
|
|
10
10
|
export interface EnsurePodfileBlockResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"podfile.d.ts","sourceRoot":"","sources":["../../../../src/platforms/ios/podfile.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"podfile.d.ts","sourceRoot":"","sources":["../../../../src/platforms/ios/podfile.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAO7D,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,uBAAuB,CAAA;IAC5B,SAAS,EAAE,mBAAmB,CAAA;CAC/B;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,qBAAa,uBAAwB,SAAQ,cAAc;gBAC7C,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAsB9G"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { IOSProjectDiscovery } from '../../discovery/ios';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function resolveIOSWidgetTargetName(ios:
|
|
2
|
+
import type { ResolvedVoltraIOSConfig } from '../../config/types';
|
|
3
|
+
export declare function resolveIOSWidgetTargetName(ios: ResolvedVoltraIOSConfig, discovery: IOSProjectDiscovery): string;
|
|
4
4
|
//# sourceMappingURL=targetName.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"targetName.d.ts","sourceRoot":"","sources":["../../../../src/platforms/ios/targetName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"targetName.d.ts","sourceRoot":"","sources":["../../../../src/platforms/ios/targetName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAEjE,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,uBAAuB,EAAE,SAAS,EAAE,mBAAmB,GAAG,MAAM,CAO/G"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { VoltraCliError } from '../../reporting/summary';
|
|
2
2
|
import type { IOSProjectDiscovery } from '../../discovery/ios';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ResolvedVoltraIOSConfig } from '../../config/types';
|
|
4
4
|
import type { ReportedChange } from '../../reporting/summary';
|
|
5
5
|
export interface EnsureIOSWidgetTargetOptions {
|
|
6
6
|
projectRoot: string;
|
|
7
|
-
ios:
|
|
7
|
+
ios: ResolvedVoltraIOSConfig;
|
|
8
8
|
discovery: IOSProjectDiscovery;
|
|
9
9
|
generatedFiles: string[];
|
|
10
10
|
previousGeneratedFiles?: string[];
|
|
11
|
+
/** User-defined build settings to write at project level, keyed by build configuration name. */
|
|
12
|
+
buildSettings?: Map<string, Record<string, string>>;
|
|
11
13
|
}
|
|
12
14
|
export interface EnsureIOSWidgetTargetResult {
|
|
13
15
|
change?: ReportedChange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xcodeTarget.d.ts","sourceRoot":"","sources":["../../../../src/platforms/ios/xcodeTarget.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"xcodeTarget.d.ts","sourceRoot":"","sources":["../../../../src/platforms/ios/xcodeTarget.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAQxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAgE7D,MAAM,WAAW,4BAA4B;IAC3C,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,uBAAuB,CAAA;IAC5B,SAAS,EAAE,mBAAmB,CAAA;IAC9B,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAA;IACjC,gGAAgG;IAChG,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACpD;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,qBAAa,4BAA6B,SAAQ,cAAc;gBAClD,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,2BAA2B,CAAC,CAwDtC"}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import { type WidgetModuleLoader } from '@use-voltra/compiler';
|
|
2
|
+
import type { VoltraPlatform } from '../../config/types';
|
|
1
3
|
export interface WidgetModuleBuildInfo {
|
|
2
4
|
isDev: false;
|
|
3
5
|
metroUrl: null;
|
|
4
6
|
appVersion: 'unknown';
|
|
5
|
-
voltraVersion:
|
|
7
|
+
voltraVersion: string;
|
|
6
8
|
}
|
|
7
|
-
export declare
|
|
8
|
-
|
|
9
|
+
export declare function createDynamicWidgetBuildInfo(voltraVersion: string): WidgetModuleBuildInfo;
|
|
10
|
+
/**
|
|
11
|
+
* Loader used by the apply pipeline to evaluate widget source at build time.
|
|
12
|
+
*
|
|
13
|
+
* The evaluation rules — which imports are allowed and what they resolve to — live in
|
|
14
|
+
* `@use-voltra/compiler` so that `voltra apply`, the Expo config plugins, and the Metro
|
|
15
|
+
* widget bundler all apply the same contract.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createGeneratedWidgetModuleLoader(projectRoot: string, platform: VoltraPlatform, createError: (message: string) => Error, onWarning?: (message: string) => void): WidgetModuleLoader;
|
|
9
18
|
//# sourceMappingURL=widgetModule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgetModule.d.ts","sourceRoot":"","sources":["../../../../src/platforms/shared/widgetModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"widgetModule.d.ts","sourceRoot":"","sources":["../../../../src/platforms/shared/widgetModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAExF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,IAAI,CAAA;IACd,UAAU,EAAE,SAAS,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,4BAA4B,CAAC,aAAa,EAAE,MAAM,GAAG,qBAAqB,CAOzF;AAED;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,cAAc,EACxB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,KAAK,EACvC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GACpC,kBAAkB,CAEpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "voltra",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "CLI for applying Voltra to native React Native projects",
|
|
5
5
|
"main": "build/cjs/index.js",
|
|
6
6
|
"module": "build/esm/index.js",
|
|
@@ -40,22 +40,22 @@
|
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"homepage": "https://use-voltra.dev",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@babel/core": "^7.27.4",
|
|
44
43
|
"@bacons/xcode": "^1.0.0-alpha.33",
|
|
45
44
|
"@clack/prompts": "^1.0.0-alpha.5",
|
|
46
45
|
"commander": "^12.1.0",
|
|
47
46
|
"cosmiconfig": "^9.0.0",
|
|
48
47
|
"vd-tool": "^4.0.2",
|
|
49
|
-
"xml2js": "^0.6.2"
|
|
48
|
+
"xml2js": "^0.6.2",
|
|
49
|
+
"@use-voltra/compiler": "^2.3.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"
|
|
52
|
+
"tsx": "^4.19.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "node ../../scripts/build-package.mjs packages/cli",
|
|
56
56
|
"clean": "rm -rf build",
|
|
57
57
|
"lint": "oxlint src",
|
|
58
58
|
"typecheck": "tsc -p tsconfig.typecheck.json --noEmit",
|
|
59
|
-
"test": "node --test"
|
|
59
|
+
"test": "node --import tsx --test"
|
|
60
60
|
}
|
|
61
61
|
}
|
package/src/apply/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { applyAndroidPlatform, createAndroidPreflightRunner } from '../platforms
|
|
|
9
9
|
import { applyIOSPlatform, createIOSPreflightRunner } from '../platforms/ios/apply'
|
|
10
10
|
import { renderApplySummary, renderIntro } from '../reporting/clack'
|
|
11
11
|
import { VoltraCliError } from '../reporting/summary'
|
|
12
|
+
import { findMissingMetroPackageWarning } from '../discovery/metro'
|
|
12
13
|
import { diffVoltraState } from '../state/diff'
|
|
13
14
|
import { loadVoltraState } from '../state/load'
|
|
14
15
|
import { saveVoltraState } from '../state/save'
|
|
@@ -108,7 +109,11 @@ export async function runApplyPipeline(options: ApplyOptions, dependencies: Appl
|
|
|
108
109
|
const deletedChanges = await removeStaleGeneratedFiles(normalizedConfig.projectRoot, stateDiff.staleFiles)
|
|
109
110
|
await saveVoltraState(normalizedConfig.projectRoot, { files: stateDiff.nextFiles })
|
|
110
111
|
|
|
111
|
-
const summaryWarnings =
|
|
112
|
+
const summaryWarnings = [
|
|
113
|
+
...(normalizedConfig.warnings ?? []),
|
|
114
|
+
...platformResults.flatMap((result) => result.warnings ?? []),
|
|
115
|
+
findMissingMetroPackageWarning(normalizedConfig),
|
|
116
|
+
].filter(isDefined)
|
|
112
117
|
const summaryChanges = [...platformResults.flatMap((result) => result.changes), ...deletedChanges]
|
|
113
118
|
|
|
114
119
|
await resolvedDependencies.writeSummary({ changes: summaryChanges, warnings: summaryWarnings })
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import assert from 'node:assert/strict'
|
|
2
|
+
import { describe, test } from 'node:test'
|
|
3
|
+
|
|
4
|
+
import { normalizeVoltraConfig, VoltraConfigNormalizationError } from './normalize.ts'
|
|
5
|
+
|
|
6
|
+
import type { AndroidWidgetConfig, IOSWidgetConfig } from './types.ts'
|
|
7
|
+
|
|
8
|
+
function normalizeWidgets(widgets: IOSWidgetConfig[]) {
|
|
9
|
+
return normalizeVoltraConfig({
|
|
10
|
+
config: { ios: { widgets } },
|
|
11
|
+
configDir: process.cwd(),
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const streak: IOSWidgetConfig = { id: 'streak', displayName: 'Streak', description: 'Your daily streak' }
|
|
16
|
+
const weather: IOSWidgetConfig = { id: 'weather', displayName: 'Weather', description: 'Shows weather' }
|
|
17
|
+
|
|
18
|
+
describe('ios widget kind', () => {
|
|
19
|
+
test('accepts a custom kind', () => {
|
|
20
|
+
const config = normalizeWidgets([{ ...streak, kind: 'StreakWidget' }])
|
|
21
|
+
|
|
22
|
+
assert.equal(config.ios?.widgets[0]?.kind, 'StreakWidget')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test('leaves the kind unset when the config does not pin one', () => {
|
|
26
|
+
const config = normalizeWidgets([streak])
|
|
27
|
+
|
|
28
|
+
assert.equal(config.ios?.widgets[0]?.kind, undefined)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test('rejects an empty kind', () => {
|
|
32
|
+
assert.throws(
|
|
33
|
+
() => normalizeWidgets([{ ...streak, kind: '' }]),
|
|
34
|
+
(error: unknown) =>
|
|
35
|
+
error instanceof VoltraConfigNormalizationError && /ios\.widgets\[streak\]\.kind/.test(error.message)
|
|
36
|
+
)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test('rejects two widgets sharing a kind', () => {
|
|
40
|
+
assert.throws(
|
|
41
|
+
() =>
|
|
42
|
+
normalizeWidgets([
|
|
43
|
+
{ ...streak, kind: 'Widgets' },
|
|
44
|
+
{ ...weather, kind: 'Widgets' },
|
|
45
|
+
]),
|
|
46
|
+
(error: unknown) =>
|
|
47
|
+
error instanceof VoltraConfigNormalizationError && /Duplicate ios widget kind 'Widgets'/.test(error.message)
|
|
48
|
+
)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
test('rejects a custom kind that collides with another widget default kind', () => {
|
|
52
|
+
// `weather` would answer to `Voltra_Widget_weather` too, so both would fight over the same
|
|
53
|
+
// placed instances.
|
|
54
|
+
assert.throws(
|
|
55
|
+
() => normalizeWidgets([{ ...streak, kind: 'Voltra_Widget_weather' }, weather]),
|
|
56
|
+
(error: unknown) =>
|
|
57
|
+
error instanceof VoltraConfigNormalizationError &&
|
|
58
|
+
/Duplicate ios widget kind 'Voltra_Widget_weather'/.test(error.message)
|
|
59
|
+
)
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
describe('appIntent without an entry', () => {
|
|
64
|
+
const parameters = [{ name: 'city', title: 'City', default: 'Seul' }]
|
|
65
|
+
|
|
66
|
+
const androidWeather: AndroidWidgetConfig = {
|
|
67
|
+
id: 'weather_widget',
|
|
68
|
+
displayName: 'Weather Widget',
|
|
69
|
+
description: 'Test Weather component',
|
|
70
|
+
targetCellWidth: 3,
|
|
71
|
+
targetCellHeight: 2,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function normalizeAndroidWidgets(widgets: AndroidWidgetConfig[]) {
|
|
75
|
+
return normalizeVoltraConfig({
|
|
76
|
+
config: { android: { widgets } },
|
|
77
|
+
configDir: process.cwd(),
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
test('warns that android appIntent needs an entry', () => {
|
|
82
|
+
const config = normalizeAndroidWidgets([{ ...androidWeather, appIntent: { parameters } }])
|
|
83
|
+
|
|
84
|
+
assert.match(config.warnings?.join('\n') ?? '', /android\.widgets\[weather_widget\]\.appIntent is ignored/)
|
|
85
|
+
assert.match(config.warnings?.join('\n') ?? '', /'entry'/)
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
test('warns that ios appIntent needs an entry', () => {
|
|
89
|
+
const config = normalizeWidgets([{ ...weather, appIntent: { parameters } }])
|
|
90
|
+
|
|
91
|
+
assert.match(config.warnings?.join('\n') ?? '', /ios\.widgets\[weather\]\.appIntent is ignored/)
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
test('stays quiet when the widget has an entry', () => {
|
|
95
|
+
const config = normalizeWidgets([{ ...weather, entry: './widgets/weather.tsx', appIntent: { parameters } }])
|
|
96
|
+
|
|
97
|
+
assert.deepEqual(config.warnings, [])
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
test('stays quiet for an appIntent that declares no parameters', () => {
|
|
101
|
+
const config = normalizeWidgets([{ ...weather, appIntent: { parameters: [] } }])
|
|
102
|
+
|
|
103
|
+
assert.deepEqual(config.warnings, [])
|
|
104
|
+
})
|
|
105
|
+
})
|