Skip to content

Releases: ZtaMDev/DeltaScript

DeltaScript 1.0.5

03 Nov 17:21

Choose a tag to compare

DeltaScript 1.0.5 and VS Code Extension 1.0.8 – Release Notes

Highlights

  • Language: Stronger type inference and class support. Ternaries and mbool fixed. Class method ::ReturnType enforced.
  • CLI: New --minify flag and config minify option. Single-file runs bundle .ds and .js when possible.
  • Extension: Improved diagnostics around method returns and class parsing. Stable experience aligned with the language changes.
  • Docs: Updated for new flags, config, return types in classes, and inference behavior.

Language (1.0.5)

  • Class methods ::ReturnType enforcement

    • Member calls on class instances (including new Class(...).method()) now use the declared method ::ReturnType.
    • Avoids confusing class methods named like native methods (e.g., toString) with JS built-ins.
  • Deep expression analysis improvements

    • Ternary analysis infers from branches (not from the condition):
      • typeof res === "string" ? res : String(res?.code || "")str.
      • Array.isArray(x) ? x : []arr.
    • Handles optional chaining and recognizes nullish/optional patterns when splitting ternaries.
    • Better string inference on concatenations involving literals and .toString().
  • mbool stability

    • maybe, true, false → inferred as mbool.
    • Top-level comparisons (===, !==, ==, !=, >=, <=, <, >) and !mbool.
    • && and || no longer misclassified as boolean by default; avoids false “mbool to num/str” errors in expressions like err || {}.
  • Native/global function return types recognized

    • parseFloat, parseInt, Numbernum.
    • String, JSON.stringifystr.
    • Boolean, Array.isArraymbool.
    • Math.*(...)num.
    • Common methods: .includes(...)mbool, .join(...)str.
  • Typed arrays and ternaries

    • Assignments like const arrExt::arr<str> = Array.isArray(exts) ? exts : [exts] now pass.
    • For non-literal RHS arrays with unknown inner types, the checker avoids incorrectly flagging “mixed array” errors.
  • Parsing

    • Preprocessing preserves class method headers with ::ReturnType so methods and constructors parse cleanly.
  • Compatibility

    • .ds imports are still rewritten to .js. .js imports are preserved and allowed.
    • No breaking changes to existing syntax or rules.

CLI

  • New: Minification

    • dsc build --minify minifies emitted JS (best-effort with esbuild).
    • Config support: minify: false (default). Set true to enable by default.
    • Requires esbuild dependency. Falls back gracefully if not installed.
  • Single-file runs: bundling

    • dsc <entry.ds> compiles to a temp workspace and now bundles the entry (and imported .ds/.js) into a single module via esbuild when available.
    • To prevent runtime crashes in bundled ESM (e.g., dynamic require), single-file runs force a logging shim instead of importing SpectralLogs packages/CDN. Project builds are unaffected.
  • Flags recap

    • --no-builtins, --spectral-cdn, --minify.

VS Code Extension (1.0.8)

  • Diagnostics

    • Return type checking improved:
      • Mismatched return expressions.
      • Missing return for declared non-void methods/functions.
    • Class method ::ReturnType support integrated with LSP diagnostics.
  • Language support

    • Syntax/hover/completions reflect ::ReturnType for class methods.
    • Inline errors align with updated compiler inference (ternaries, mbool, array checks).

Documentation

  • Readme

    • Updated CLI flags (including --minify), config minify, single-file bundling, and class method ::ReturnType example.
  • /docs (VitePress)

    • cli.md: --minify flag, bundling behavior in single-file runs, updated examples.
    • config.md: minify: false default and field documentation.
    • index.md: Highlights return type enforcement and bundling; adds --minify to useful flags.
    • language.md: Method ::ReturnType section and examples, ternary inference rules, recognized native functions.

Migration Notes

  • No code changes required for existing projects.
  • Optional:
    • Add "esbuild" to your project for minify/bundling features.
    • Flip minify: true in dsk.config.ds to default minification on builds.
  • If you rely on SpectralLogs in single-file runs, note that a shim is used during bundling for compatibility; project builds still use package/CDN if configured.

How to Update

  • Language: npm i -g deltascript or npm i deltascript (1.0.5)
  • Extension: Update to v1.0.8 in VS Code Marketplace/Open VSX

Summary: Language 1.0.5 strengthens type inference, mbool, ternaries, and class returns. CLI gains minify and single-file bundling with robust logging. Extension 1.0.8 aligns diagnostics and language features.

DeltaScript 1.0.4

02 Nov 23:41

Choose a tag to compare

Release notes: Deltascript v1.0.4

Highlights

  • Function return type annotations

    • New syntax: annotate after the parameter list with ::ReturnType.
    • Type-checked against each return. Missing return is reported at the annotation position.
    • Works with single-line functions and inline declarations.
    • Example:
      func Sum(a::num, b::num)::num { return a + b }
      
      func Wrong()::num { return "x" }       // error: Return type mismatch (expects num)
      
      func NoReturn()::str {
        let x = 1
      }                                      // error: declares return type str but has no return
    • Docs: https://ztamdev.github.io/DeltaScript/language#function-return-types
  • Interface type checking (shallow) with optional fields

Editor and DX

Fixes and robustness

  • Robust stripping of ::ReturnType in the transpiler for both same-line and next-line {.
  • Accurate handling of single-line functions with inline variable declarations prior to return.
  • Interface-aware error messages for missing required fields in object literal returns.
  • Cleaner diagnostics without JS false positives.

Docs

Upgrade

Notes

  • Emitted JS remains ESM. Single-file runs execute a temporary .mjs via Node.

DeltaScript 1.0.3

01 Nov 18:07

Choose a tag to compare

DeltaScript v1.0.3 – Release Notes

  • Date: 2025-11-01
  • Scope: CLI, Transpiler Core, VS Code Extension (Language Server), Config UX

Highlights

  • Robust multi-error reporting across CLI and VS Code, no more “stop at first error.”
  • Accurate scope handling for class methods and control blocks, eliminating false “Redeclaration” errors.
  • Config quality-of-life: dsk.config.ds supports both plain objects and export default {}.
  • VS Code stability & hot-reload for the transpiler with ESM cache-busting.

Transpiler Core (src/transpiler.ts)

  • Multi-error diagnostics:
    • transpileSpark now returns { code, diagnostics } with all collected errors.
    • Syntax errors are mapped back to original lines even when interfaces are stripped.
  • Scope system correctness:
    • Detects methods with async/static/get/set/constructor.
    • Supports multi-line headers (brace { on the next line).
    • Conservative scope closing: only count } that start a line (ignores object/array closures like }, or }:).
    • Parameters are registered in the correct function/method scope.
  • Typed arrays and interfaces:
    • Precise inference for array literals, including interface-compatible arr<obj>.
    • Shallow interface validation on object literals at declaration/assignment.
  • Object-only files auto-wrap:
    • A file that is a single top-level object literal is auto-wrapped as export default { … }.
  • Emitted JS validation:
    • Final pass parse with comment-stripping fallback; records any emitted JS syntax errors as diagnostics.

CLI (src/cli.ts)

  • New transpiler contract supported:
    • Properly consumes { code, diagnostics } from transpileSpark.
    • Prints code-frames for all errors per file.
  • Build/dev experience:
    • dsc init creates dsk.config.ds using export default { … }.
    • dsk.config.ds is excluded from compilation/watch to avoid false syntax errors.
  • Spec helpers:
    • Optional injection of SpectralLogs and console→spec rewrite preserved, now applied safely with the new output flow.

Config Loader (src/config.ts)

  • Flexible formats:
    • Accepts both plain object and export default { … }.
    • Strips comments, quotes keys, and parses as JSON internally.
    • Defaults builtins: true when unspecified.

VS Code Extension (extension/server)

  • Language Server stability:
    • ESM cache-busting (?t=timestamp) ensures the latest transpiler loads.
    • Added a request handler to hot-reload the transpiler and revalidate open docs.
  • Multi-error surfaced in editor:
    • The server now consumes and forwards all diagnostics from the transpiler.
  • Fewer false positives:
    • Scope fixes and conservative closing rules ported to the bundled transpiler.
    • Temporary filter suppresses noisy “Redeclaration … in the same scope” messages.
  • Config auto-wrap in editor:
    • A file that is just { … } is treated as export default { … } to avoid syntax errors in the editor.

Bug Fixes

  • Fixed false “Redeclaration of variable 'scope' in the same scope” in methods and blocks.
  • Fixed incorrect scope closure on lines that contained object/array trailing braces.
  • Fixed extension loading stale transpiler due to ESM caching.
  • Fixed CLI crashes when transpiler returns structured diagnostics.
  • Fixed config parsing errors for plain object dsk.config.ds.

Developer Notes

  • Scope handling now includes:
    • Class method detection with async/static/get/set/constructor.
    • Multi-line header handling with pending-open tracking.
    • Per-line transactional error handling with conservative scope rollback (extension).

DeltaScript 1.0.2

01 Nov 14:24

Choose a tag to compare

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.

DeltaScript 1.0.1

01 Nov 01:21

Choose a tag to compare

DeltaScript 1.0.1 — Small Fix Release

  • Date: 2025-10-31
  • Package: deltascript@1.0.1
  • CLI: dsc

Highlights

  • Minor UX polish for build errors.
  • Editor integration improvements (syntax + LSP).
  • Docs expanded for mutability semantics.

Changes

  • CLI

    • Refined build error summary:
      • Pretty error with code frame shown once per file.
      • “Failed” summary now lists only the file paths (no duplicate messages).
  • VS Code extension

    • Syntax highlighting: added mut keyword (plus common control-flow tokens).
    • LSP:
      • Completions include mut.
      • Cross-file symbol indexing retained; diagnostics still backed by the transpiler.
    • Stability: packaged VSIX and activation on startup/language ensured.
  • Docs

    • README and Language Guide:
      • Added “Mutability: mut / inmut”.
      • Behavior clarified:
        • inmut var makes an existing let immutable from that point (like const).
        • mut var = expr is explicit mutation; invalid after inmut.
  • Links

    • README: added links to VS Code extension on Marketplace and Open VSX.
    • docs/index.md: recommended extension with direct links; mention searching “deltascript” inside VS Code.

Installation

  • npm: npm i -g deltascript
  • Update to latest: npm i -g deltascript@latest

DeltaScript 1.0.0 Stable

31 Oct 22:29

Choose a tag to compare

DeltaScript 1.0.0 — Initial Stable Release

  • Date: 2025-10-31
  • Package: deltascript@1.0.0
  • CLI: dsc

Install

You can install globally or locally.

npm

Global:

npm install -g deltascript

Project:

npm install deltascript

Highlights

  • Stable initial release of the language, CLI, and tooling.
  • Comprehensive documentation and practical examples included.

Features

  • CLI

    • dsc init: creates dsk.config.ds and ensures src/ exists.
    • dsc build: compiles all .ds to ESM .js in outDir.
    • dsc dev: watch mode with per-file debounce and concise output.
    • dsc <file.ds>: transpiles and runs a single .ds using a temporary .mjs (supports top‑level await and full interactivity).
    • -v / --version: prints DeltaScript version.
    • Flags:
      • --no-builtins: disable SpectralLogs integration and console tips.
      • --migrate-to-spec: rewrite console.* to spec.* automatically.
      • --spectral-cdn: force CDN imports for SpectralLogs.
  • Language

    • Typed annotations with ::.
    • Types: num, str, mbool (true/false/maybe).
    • Arrays: arr, arr<T>.
    • Objects: obj.
    • Interfaces and classes.
    • func instead of function.
    • Default parameters; return types inferred.
    • Clear errors with code frames (file:line:col), colorized.
  • Runner (single-file)

    • Outputs to a temporary .mjs to ensure ESM and top‑level await.
    • Interactive I/O preserved (e.g., await spec.input(...)).
    • Proper Ctrl+C forwarding and cleanup of temp files.
  • SpectralLogs Integration

    • Auto integration:
      • Prefer package imports when available.
      • --spectral-cdn to use CDN.
      • No‑await shim fallback with spec.* (includes async spec.input).
    • Gentle warnings:
      • Concise, yellow warning per session/file for console.*.
      • Tip to use --migrate-to-spec when frequent.
  • Documentation

    • README with logo and quick start.
    • docs/: CLI, language, types, config, SpectralLogs, examples.
    • Examples demonstrating functions, classes, control flow, interfaces, arrays, and structured logging.

Installation

  • npm: npm i -g deltascript or npm i -D deltascript
  • bun: bun add -g deltascript or bun add -d deltascript
  • pnpm: pnpm add -g deltascript or pnpm add -D deltascript

Getting Started

  • Initialize: dsc init
  • Build: dsc build
  • Watch: dsc dev
  • Run single file: dsc ./src/main.ds

Status: release notes prepared for 1.0.0 (initial stable).