@caperjs/core 0.7.3 → 0.7.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.
Files changed (64) hide show
  1. package/build/index.mjs +1 -1
  2. package/build/internal/buildFlags.mjs +63 -18
  3. package/build/internal/schema.mjs +53 -0
  4. package/build/plugins/pwa.mjs +13 -7
  5. package/cli/doctor.mjs +53 -2
  6. package/cli/doctor.test.mjs +80 -1
  7. package/cli/native.mjs +105 -11
  8. package/cli/native.test.mjs +184 -0
  9. package/extras/llms.txt +26 -3
  10. package/lib/{CaptionsPlugin-COrofpHN.js → CaptionsPlugin-CAgQBcA1.js} +7 -7
  11. package/lib/{CaptionsPlugin-COrofpHN.js.map → CaptionsPlugin-CAgQBcA1.js.map} +1 -1
  12. package/lib/{DataAdapter-T-22-_D1.js → DataAdapter-CbyqWMo-.js} +5 -5
  13. package/lib/{DataAdapter-T-22-_D1.js.map → DataAdapter-CbyqWMo-.js.map} +1 -1
  14. package/lib/{DebugRenderer-ZN692Pbg.js → DebugRenderer-Bdkpyyt6.js} +2 -2
  15. package/lib/{DebugRenderer-ZN692Pbg.js.map → DebugRenderer-Bdkpyyt6.js.map} +1 -1
  16. package/lib/{DevToolsPlugin-CQXFoj1T.js → DevToolsPlugin-Cq5HHN9K.js} +2 -2
  17. package/lib/{DevToolsPlugin-CQXFoj1T.js.map → DevToolsPlugin-Cq5HHN9K.js.map} +1 -1
  18. package/lib/{GSAPPlugin-CNkncyXS.js → GSAPPlugin-D-ujhVYo.js} +2 -2
  19. package/lib/{GSAPPlugin-CNkncyXS.js.map → GSAPPlugin-D-ujhVYo.js.map} +1 -1
  20. package/lib/{LayoutPlugin-BuJgr9bd.js → LayoutPlugin-DqbwBm-X.js} +4 -4
  21. package/lib/{LayoutPlugin-BuJgr9bd.js.map → LayoutPlugin-DqbwBm-X.js.map} +1 -1
  22. package/lib/{ScreenDebugPlugin-kz9Mr6j1.js → ScreenDebugPlugin-CyT8UxEa.js} +3 -3
  23. package/lib/{ScreenDebugPlugin-kz9Mr6j1.js.map → ScreenDebugPlugin-CyT8UxEa.js.map} +1 -1
  24. package/lib/{SpinePlugin-DDzD-Qxd.js → SpinePlugin-DyXJyA3x.js} +2 -2
  25. package/lib/{SpinePlugin-DDzD-Qxd.js.map → SpinePlugin-DyXJyA3x.js.map} +1 -1
  26. package/lib/{StatsPlugin-tyFGzVjy.js → StatsPlugin-CEhgzWby.js} +4 -4
  27. package/lib/{StatsPlugin-tyFGzVjy.js.map → StatsPlugin-CEhgzWby.js.map} +1 -1
  28. package/lib/{VoiceOverPlugin-rTNz_9eb.js → VoiceOverPlugin-CSpNZjpJ.js} +2 -2
  29. package/lib/{VoiceOverPlugin-rTNz_9eb.js.map → VoiceOverPlugin-CSpNZjpJ.js.map} +1 -1
  30. package/lib/caper.mjs +159 -162
  31. package/lib/caper.mjs.map +1 -1
  32. package/lib/{const-BClauBNo.js → const-Bca54QyV.js} +251 -251
  33. package/lib/{const-BClauBNo.js.map → const-Bca54QyV.js.map} +1 -1
  34. package/lib/core/Application.d.ts +4 -0
  35. package/lib/core/Application.d.ts.map +1 -1
  36. package/lib/core/interfaces/IApplicationOptions.d.ts +21 -0
  37. package/lib/core/interfaces/IApplicationOptions.d.ts.map +1 -1
  38. package/lib/plugins/OrientationPlugin.d.ts +57 -0
  39. package/lib/plugins/OrientationPlugin.d.ts.map +1 -0
  40. package/lib/plugins/OrientationPlugin.test.d.ts +2 -0
  41. package/lib/plugins/OrientationPlugin.test.d.ts.map +1 -0
  42. package/lib/plugins/defaults.d.ts.map +1 -1
  43. package/lib/plugins/index.d.ts +1 -0
  44. package/lib/plugins/index.d.ts.map +1 -1
  45. package/lib/{registries-DmNGVLAi.js → registries-C1nPl8B3.js} +593 -502
  46. package/lib/registries-C1nPl8B3.js.map +1 -0
  47. package/lib/utils/index.d.ts +1 -0
  48. package/lib/utils/index.d.ts.map +1 -1
  49. package/lib/utils/orientation.d.ts +44 -0
  50. package/lib/utils/orientation.test.d.ts +2 -0
  51. package/lib/utils/orientation.test.d.ts.map +1 -0
  52. package/package.json +1 -1
  53. package/src/core/Application.ts +10 -0
  54. package/src/core/interfaces/IApplicationOptions.ts +21 -0
  55. package/src/plugins/OrientationPlugin.test.ts +252 -0
  56. package/src/plugins/OrientationPlugin.ts +178 -0
  57. package/src/plugins/defaults.ts +6 -0
  58. package/src/plugins/index.ts +1 -0
  59. package/src/utils/index.ts +1 -0
  60. package/src/utils/orientation.d.ts +44 -0
  61. package/src/utils/orientation.js +37 -0
  62. package/src/utils/orientation.test.ts +30 -0
  63. package/src/version.ts +1 -1
  64. package/lib/registries-DmNGVLAi.js.map +0 -1
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The one normalizer for `caper.config.ts`'s `orientation`, shared by the
3
+ * runtime `orientation` plugin, the native CLI, `caper doctor` and the PWA
4
+ * default. Plain ESM with a hand-written `orientation.d.ts` beside it, so the
5
+ * Node CLI (`cli/`, `build/`) can import it without a TypeScript step. Keep it
6
+ * dependency-free and free of browser globals.
7
+ */
8
+
9
+ const LOCKS = ['portrait', 'landscape'];
10
+
11
+ /**
12
+ * `orientation` as `{ lock, overlay }`, or `null` when unset. The string form is
13
+ * shorthand for `{ lock }`; a missing `overlay` means the default overlay (`{}`).
14
+ * Throws on anything else.
15
+ *
16
+ * @param {unknown} orientation
17
+ */
18
+ export function resolveOrientation(orientation) {
19
+ if (orientation === undefined || orientation === null) return null;
20
+ if (typeof orientation === 'string') {
21
+ if (!LOCKS.includes(orientation)) {
22
+ throw new TypeError(`orientation must be 'portrait' or 'landscape' (got ${JSON.stringify(orientation)})`);
23
+ }
24
+ return { lock: orientation, overlay: {} };
25
+ }
26
+ if (typeof orientation === 'object' && !Array.isArray(orientation)) {
27
+ const { lock, overlay } = orientation;
28
+ if (!LOCKS.includes(lock)) {
29
+ throw new TypeError(`orientation.lock must be 'portrait' or 'landscape' (got ${JSON.stringify(lock)})`);
30
+ }
31
+ if (overlay !== undefined && overlay !== false && (overlay === null || typeof overlay !== 'object')) {
32
+ throw new TypeError(`orientation.overlay must be false or an object (got ${JSON.stringify(overlay)})`);
33
+ }
34
+ return { lock, overlay: overlay ?? {} };
35
+ }
36
+ throw new TypeError(`orientation must be 'portrait', 'landscape', or { lock, overlay? } (got ${JSON.stringify(orientation)})`);
37
+ }
@@ -0,0 +1,30 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { resolveOrientation } from './orientation';
3
+
4
+ describe('resolveOrientation', () => {
5
+ it('is null when unset', () => {
6
+ expect(resolveOrientation(undefined)).toBeNull();
7
+ expect(resolveOrientation(null)).toBeNull();
8
+ });
9
+
10
+ it.each(['portrait', 'landscape'] as const)('expands the %s shorthand with the default overlay', (lock) => {
11
+ expect(resolveOrientation(lock)).toEqual({ lock, overlay: {} });
12
+ });
13
+
14
+ it('keeps the object form, defaulting the overlay', () => {
15
+ expect(resolveOrientation({ lock: 'landscape' })).toEqual({ lock: 'landscape', overlay: {} });
16
+ });
17
+
18
+ it('passes overlay options and false through', () => {
19
+ const overlay = { text: 'Hold your phone upright to play' };
20
+ expect(resolveOrientation({ lock: 'portrait', overlay })).toEqual({ lock: 'portrait', overlay });
21
+ expect(resolveOrientation({ lock: 'portrait', overlay: false })).toEqual({ lock: 'portrait', overlay: false });
22
+ });
23
+
24
+ it.each(['any', 'Portrait', 1, true, {}, { lock: 'any' }, { overlay: false }, { lock: 'portrait', overlay: 'off' }])(
25
+ 'throws on %o',
26
+ (value) => {
27
+ expect(() => resolveOrientation(value)).toThrow(/orientation/);
28
+ },
29
+ );
30
+ });
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated during the build process.
2
- export const version: string = '0.7.3';
2
+ export const version: string = '0.7.4';
3
3
  export const pixiVersion: string = '8.22.0';