Skip to content

DeltaScript 1.0.2

Choose a tag to compare

@ZtaMDev ZtaMDev released this 01 Nov 14:24

DeltaScript v1.0.2 — Release Notes

Date: 2025-11-01

Highlights

  • Native .ds module imports end-to-end: import ... from "./file.ds" and export ... from "./file.ds" now work across the transpiler and CLI.
  • Accurate diagnostics after interfaces: syntax errors now map precisely to the original source lines even when interface blocks are stripped.
  • Single-file CLI runner is module-aware: recursively compiles .ds dependencies and executes as ESM with clean output (no Node warnings).

Added

  • .ds import support in transpiler
    • Rewrites all .ds specifiers to .js:
      • Static: import ... from "x.ds", export ... from "x.ds".
      • Bare/dynamic: import "x.ds", import("x.ds").
    • Adds ./ to specifiers lacking a relative prefix so Node treats them as relative modules (avoids “Cannot find package …” errors in ESM).
  • CLI single-file dependency graph
    • dsc <entry.ds> now parses .ds imports, recursively transpiles all dependencies into a temp workspace preserving folder structure, and runs the entry as .mjs.
    • Injects Spectral builtins into every transpiled module in single-file mode (so spec.* works in imported modules too).
    • Writes a temporary package.json with {"type":"module"} to suppress Node ESM warnings.

Changed

  • Transpiler emit normalization
    • Emits valid JS for function declarations:
      • func Name( → function Name(
      • async func Name( → async function Name(
    • Consistently rewrites .ds imports/exports/bare/dynamic to .js in both preprocessing and emitted output.
  • Fallback Spectral shim
    • Removed unused specweb constant from the injected shim.
    • Shim remains synchronous and safe for Node and browser environments.

Fixed

  • Interface line/column mapping
    • Parser-phase syntax errors are now mapped back to original source lines using a parsed→source map that simulates full interface removal (including single-line interfaces and trailing code after }).
    • Column positions are corrected for inline transformations (e.g., removal of ::Type, func → function, maybe expansion).
  • ESM false positives
    • JS syntax validation is skipped for ESM output to avoid reporting false “Unexpected token” errors when using export/import.
  • Single-file execution
    • Ensures imported modules have spec available when builtins are enabled.
    • Suppresses Node’s MODULE_TYPELESS_PACKAGE_JSON warning by marking the temp workspace as ESM.

CLI

  • dsc build unchanged for multi-file projects (rewrites .ds → .js in output).
  • dsc <file.ds>:
    • Recursively compiles imported .ds files.
    • Runs entry as .mjs with cwd set to the temp workspace.
    • Applies builtins/migration only to the entry for console→spec migration; builtins are injected into all modules to provide spec.

Compatibility / Breaking Changes

  • No breaking changes to the DeltaScript language syntax.
  • If you relied on specweb from the fallback shim, it has been removed (it was unused and undocumented).
  • For single-file runs that import other .ds files, use dsc <entry.ds>; dependencies will be transpiled automatically.

Acknowledgements

Thanks for the feedback that led to:

  • Robust .ds import handling (static, bare, dynamic).
  • Precise diagnostic mapping after interfaces.
  • Clean ESM execution in single-file workflows.