@nativescript/ios 9.1.0-alpha.20 → 9.1.0-alpha.21

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.
@@ -505,7 +505,7 @@
505
505
  repositoryURL = "https://github.com/NativeScript/ios-spm.git";
506
506
  requirement = {
507
507
  kind = exactVersion;
508
- version = "9.1.0-alpha.20";
508
+ version = "9.1.0-alpha.21";
509
509
  };
510
510
  };
511
511
  /* End XCRemoteSwiftPackageReference section */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nativescript/ios",
3
3
  "description": "NativeScript Runtime for iOS",
4
- "version": "9.1.0-alpha.20",
4
+ "version": "9.1.0-alpha.21",
5
5
  "keywords": [
6
6
  "NativeScript",
7
7
  "iOS",
package/types/index.d.ts CHANGED
@@ -19,9 +19,12 @@
19
19
  // packages must reference them, not redeclare the modules — two
20
20
  // `declare module` blocks for the same specifier conflict.
21
21
  //
22
- // The `node:util` compatibility shim is deliberately not declared here:
23
- // programs that include @types/node already have a `node:util` declaration,
24
- // and a second one would clash with it.
22
+ // The `node:` compatibility shims (`node:util`, `node:module`, `node:url`) are
23
+ // deliberately not declared here: programs that include @types/node already
24
+ // have declarations for those specifiers, and a second one would clash with
25
+ // them. A shim exposing less than Node does is a runtime concern, documented
26
+ // in docs/ns-builtin-modules.md, not something to restate in types that would
27
+ // then conflict.
25
28
 
26
29
  /// <reference path="./ns-module.d.ts" />
27
30
  /// <reference path="./ns-runtime.d.ts" />
@@ -4,9 +4,25 @@ declare module "ns:module" {
4
4
  * absolute URL. Consulted inside the engine's synchronous module resolver,
5
5
  * which is why it must be handed to the runtime ahead of time rather than
6
6
  * resolved on demand.
7
+ *
8
+ * A key ending in `/` maps a whole subtree and its target must end in `/`
9
+ * too; longest match wins. The map is validated in full before it is
10
+ * installed — an invalid map throws a `TypeError` out of
11
+ * {@link configureLoader} and leaves the previously installed map in place.
7
12
  */
8
13
  export interface ImportMap {
9
- imports: Record<string, string>;
14
+ imports?: Record<string, string>;
15
+ /**
16
+ * Per-referrer overrides. Each key is matched as a plain prefix of the
17
+ * importing module's canonical registry key — an absolute `http(s)` URL
18
+ * for a served module, or a canonical absolute path for a file — which is
19
+ * this runtime's analogue of the web's resolved referrer URL. End a scope
20
+ * key with `/` to keep it on a directory boundary.
21
+ *
22
+ * Resolution consults the most specific matching scope first, then less
23
+ * specific ones, then {@link ImportMap.imports}.
24
+ */
25
+ scopes?: Record<string, Record<string, string>>;
10
26
  }
11
27
 
12
28
  /**
@@ -36,9 +52,14 @@ declare module "ns:module" {
36
52
  /**
37
53
  * Loader policy, installed before the dev session imports anything. Every
38
54
  * section is optional; each present section replaces its native state
39
- * wholesale.
55
+ * wholesale (an empty array included — `undefined` counts as absent).
56
+ *
57
+ * The policy applies to the isolate that calls `configureLoader`. A worker
58
+ * inherits a copy of its parent's policy taken at spawn; a worker already
59
+ * running does not observe a later reconfiguration.
40
60
  */
41
61
  export interface LoaderConfig {
62
+ /** Replaces the whole map. */
42
63
  importMap?: ImportMap;
43
64
  /** URL substrings identifying modules that are always re-fetched, never cached. */
44
65
  volatilePatterns?: string[];
@@ -48,6 +69,12 @@ declare module "ns:module" {
48
69
  /**
49
70
  * Installs loader policy — the sole channel by which server/framework URL
50
71
  * policy enters the runtime's module loader.
72
+ *
73
+ * Throws `TypeError` on a missing or non-object config, an unknown top-level
74
+ * key, a section of the wrong type, or a non-string inside a section's array
75
+ * — the message names the offending section, key or index. The whole config
76
+ * is validated before any of it is installed, so a rejected call leaves every
77
+ * section exactly as it was.
51
78
  */
52
79
  export function configureLoader(config: LoaderConfig): void;
53
80
 
@@ -55,6 +82,9 @@ declare module "ns:module" {
55
82
  * Evicts the given URLs (canonicalized) from the module registry and marks
56
83
  * them bust-next-fetch, so the next network fetch bypasses every HTTP
57
84
  * cache layer.
85
+ *
86
+ * Throws `TypeError` if `urls` is not an array or holds a non-string, naming
87
+ * the offending index.
58
88
  */
59
89
  export function invalidateModules(urls: string[]): void;
60
90
 
@@ -65,10 +95,67 @@ declare module "ns:module" {
65
95
  export function getLoadedModuleUrls(): string[];
66
96
 
67
97
  /**
68
- * Flips the dev-boot-complete signal (defaults to `true`); disarms
69
- * cold-boot-only behaviors.
98
+ * A `require` that resolves against the directory of `filenameOrURL` — a
99
+ * trailing slash names the directory itself. Accepts an absolute path
100
+ * string, a `file:` URL string, or a URL object; anything else throws a
101
+ * `TypeError`, and an `http(s)` base is refused because `require()` of a
102
+ * dev-served module is not supported (import those instead).
103
+ *
104
+ * ES module graphs load under Node's `require(esm)` rule: a graph
105
+ * containing top-level await is refused before it evaluates.
106
+ *
107
+ * The returned `require` takes a string specifier and throws a `TypeError`
108
+ * with Node's `ERR_INVALID_ARG_TYPE` wording on anything else.
109
+ *
110
+ * `require.resolve`, `require.cache` and `require.main` are not
111
+ * implemented and are absent from the returned function.
112
+ */
113
+ export function createRequire(
114
+ filenameOrURL: string | URL,
115
+ ): (specifier: string) => any;
116
+
117
+ /** Evaluation-settle options for {@link createPumpingRequire}. */
118
+ export interface PumpingRequireOptions {
119
+ /**
120
+ * How long the graph may take to settle, in seconds. Positive and finite.
121
+ * Defaults to 60. Governs the evaluation-settle phase only — the graph
122
+ * walk's fetch deadline is separate and unaffected.
123
+ */
124
+ deadlineSeconds?: number;
125
+ /**
126
+ * What an expired deadline means. `"throw"` (default) fails the require;
127
+ * `"return-pending"` returns the namespace with evaluation still in
128
+ * flight, which a caller must discard rather than read.
129
+ */
130
+ onTimeout?: "throw" | "return-pending";
131
+ /**
132
+ * Also give the Cocoa runloop a slice per pump iteration. Only sane while
133
+ * boot owns the runloop — mid-app it re-enters arbitrary runloop sources
134
+ * underneath JS frames. Defaults to `false`.
135
+ */
136
+ pumpRunLoop?: boolean;
137
+ }
138
+
139
+ /**
140
+ * Like {@link createRequire}, except an ES module graph containing
141
+ * top-level await is evaluated — by driving V8's nestable tasks and
142
+ * microtasks until it settles — rather than refused. The Cocoa runloop is
143
+ * never advanced, so a graph awaiting a native transport still cannot
144
+ * settle here and fails on the deadline instead of returning a
145
+ * half-initialized namespace.
146
+ *
147
+ * Callable only from a task context. The loop cannot be pumped
148
+ * re-entrantly — V8 ignores a microtask checkpoint while the isolate is
149
+ * already draining the microtask queue — and a top-level await resumes
150
+ * through a promise reaction, which is a microtask. Requiring such a graph
151
+ * from after an `await` or inside a `.then` callback throws immediately,
152
+ * before evaluation, so `import()` can still load it. A synchronous graph
153
+ * needs no pumping and stays legal from anywhere.
70
154
  */
71
- export function setDevBootComplete(value?: boolean): void;
155
+ export function createPumpingRequire(
156
+ filenameOrURL: string | URL,
157
+ options?: PumpingRequireOptions,
158
+ ): (specifier: string) => any;
72
159
 
73
160
  // Debug builds additionally carry `canonicalizeHttpUrlKey(url)`, a pure
74
161
  // test diagnostic; release builds omit the member entirely. It is
@@ -22,17 +22,15 @@ declare module "ns:runtime" {
22
22
  export interface RuntimeConfig {
23
23
  releasedObjectPolicy: ReleasedObjectPolicy;
24
24
  /**
25
- * Verbose script/module-loading diagnostics. Boot default is the
26
- * `logScriptLoading` value from nativescript.config / package.json
27
- * (`false` when absent). Process-wide; main-isolate writes only.
25
+ * The enabled debug-trace categories, as a comma-separated list — the
26
+ * whole set is replaced on every write, so `""` disables tracing.
27
+ * `getConfig` returns the canonical list of what is currently on.
28
+ * Unknown names are ignored with one warning line.
29
+ *
30
+ * Also settable before boot through the `NS_DEBUG` environment variable.
31
+ * Available in release builds too. Process-wide; main-isolate writes only.
28
32
  */
29
- logScriptLoading: boolean;
30
- /**
31
- * One log line per HTTP fetch URL (high volume). Boot default is the
32
- * `httpFetchUrlLog` value from nativescript.config / package.json
33
- * (`false` when absent). Process-wide; main-isolate writes only.
34
- */
35
- httpFetchUrlLog: boolean;
33
+ debug: string;
36
34
  }
37
35
 
38
36
  /**