@astrale-os/sdk 0.5.0-beta.21 → 0.5.0-beta.22

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.
@@ -26,7 +26,7 @@ export async function run(argv) {
26
26
  return lint(parsed);
27
27
  if (parsed.command === 'package') {
28
28
  const result = await packageDomain({ projectDir: process.cwd() });
29
- info(`Packaged ${result.declarations} public declarations (${result.replacements} facade references normalized).`);
29
+ info(`Packaged ${result.declarations} public declarations (${result.replacements} references normalized).`);
30
30
  return 0;
31
31
  }
32
32
  if (parsed.command === 'publish' && parsed.schemaOnly) {
@@ -14,6 +14,9 @@ export async function normalizeDeclarations(input) {
14
14
  for (const file of files) {
15
15
  const source = readFileSync(file, 'utf8');
16
16
  const fileEdits = declarationEdits(file, source, (specifier, symbols) => {
17
+ if (specifier.startsWith('.')) {
18
+ return runtimeSpecifier(file, resolveLocal(file, specifier));
19
+ }
17
20
  const key = JSON.stringify([specifier, symbols]);
18
21
  if (admittedFacades.has(key))
19
22
  return admittedFacades.get(key);
@@ -97,6 +100,15 @@ function resolveLocal(containing, specifier) {
97
100
  throw new TypeError(`Cannot resolve declaration reference ${specifier} from ${containing}.`);
98
101
  return file;
99
102
  }
103
+ /** Point a local declaration reference at the emitted ESM module that owns it. */
104
+ function runtimeSpecifier(containing, declaration) {
105
+ const runtime = declaration
106
+ .replace(/\.d\.mts$/u, '.mjs')
107
+ .replace(/\.d\.cts$/u, '.cjs')
108
+ .replace(/\.d\.ts$/u, '.js');
109
+ const path = relative(dirname(containing), runtime).replaceAll('\\', '/');
110
+ return path.startsWith('.') ? path : `./${path}`;
111
+ }
100
112
  function confined(root, file) {
101
113
  const path = relative(realpathSync(root), realpathSync(file));
102
114
  if (path === '..' ||
@@ -23,9 +23,7 @@ export function declarationEdits(file, source, resolveFacade = declarationFacade
23
23
  ts.forEachChild(node, visit);
24
24
  }
25
25
  function append(literal) {
26
- if (!literal.text.startsWith(KERNEL_PREFIX))
27
- return;
28
- const symbols = importedSymbols(literal);
26
+ const symbols = literal.text.startsWith(KERNEL_PREFIX) ? importedSymbols(literal) : [];
29
27
  const replacement = resolveFacade(literal.text, symbols);
30
28
  if (replacement === undefined || replacement === literal.text)
31
29
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-os/sdk",
3
- "version": "0.5.0-beta.21",
3
+ "version": "0.5.0-beta.22",
4
4
  "description": "Schema-first SDK for defining, composing, and deploying Astrale domains",
5
5
  "keywords": [
6
6
  "astrale",