@teacss/runtime 0.5.1 → 0.6.0

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 (2) hide show
  1. package/README.md +21 -72
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,53 +1,22 @@
1
1
  # @teacss/runtime
2
2
 
3
- Shared stateful runtime for TeaCSS build integrations.
4
-
5
- The runtime connects `@teacss/config` and `@teacss/core`: it loads an entry,
6
- tracks source modules, runs transformers, extracts tokens, and coordinates
7
- configuration reloads. Applications should use a concrete build adapter.
8
-
9
- Use `applyTransformerPipeline` for the standard `pre → default → post`
10
- sequence. Use `applyTransformers` when an integration needs one phase.
11
- Stateful transformers may implement `onModuleRemoved(id, ctx)` to release
12
- module-owned registrations.
13
-
14
- Each transformer reads its optional `idFilter` once per filtering decision and
15
- calls it with the transformer as `this`. Without an ID filter, the pipeline
16
- filter receives the current transformed code and module ID.
17
- Pipeline filtering removes the complete query or fragment suffix, including
18
- line terminators, without changing the path before the first `?` or `#`.
19
- Transformer selection, reload snapshots, and removal cleanup ignore empty and
20
- inherited array slots, matching Core's configuration-list handling.
21
-
22
- Reloads are transactional. A candidate configuration replays tracked sources
23
- and settles staged work before becoming live. Failure preserves the last valid
24
- runtime state while exposing current source dependencies for recovery.
25
-
26
- Overlapping transforms reconcile to the newest source and context. Stateful
27
- transformers should key data by `ctx` or `ctx.generator`, and cleanup must be
3
+ Shared stateful runtime for TeaCSS build integrations. It loads a CSS entry
4
+ through `@teacss/config`, tracks source modules, runs transformers, extracts
5
+ tokens, and coordinates `@teacss/core` generation. Applications should use a
6
+ concrete build adapter.
7
+
8
+ Use `applyTransformerPipeline` for the `pre → default → post` sequence, or
9
+ `applyTransformers` for one phase. A stateful transformer may implement
10
+ `onModuleRemoved(id, ctx)` to release module-owned registrations. Its `idFilter`
11
+ receives the current module ID with the transformer as `this`; the pipeline
12
+ filter receives the current transformed code and ID.
13
+
14
+ Reloads are transactional: a candidate configuration replays tracked modules
15
+ and settles staged work before publication. Failure preserves the last valid
16
+ runtime state while exposing source dependencies for recovery. Overlapping
17
+ transforms reconcile to the newest source and context. Stateful transformers
18
+ should key registrations by `ctx` or `ctx.generator`, and make cleanup
28
19
  idempotent. `onReload` and `onInvalidate` return disposers.
29
- Observers are invoked synchronously in registration order. Returned promises
30
- are not awaited by reload or invalidation, but their rejections are reported as
31
- diagnostics without failing publication. Ordinary void callbacks allocate no promise.
32
- Nested cleanup retains access only to ancestor cleanups that are still active.
33
- Work outliving an ancestor must respect new locks for that ancestor's modules;
34
- inherited staged-module access and mutation notifications expire with their owner.
35
- Failures in the diagnostic sink cannot fail a committed reload or interrupt
36
- module removal cleanup after an observer fails.
37
- Reload staging and cleanup preserve large error lists, including their order and
38
- object identity, without expanding them into function arguments.
39
- Map views exposed to transformers route `getOrInsert` and `getOrInsertComputed`
40
- to their current storage, including staged and detached contexts, rather than
41
- writing into the view's unused native Map storage.
42
- Map and Set view `forEach` callbacks receive the requested `thisArg` and the
43
- view as their collection argument. Non-callable callbacks are rejected even for
44
- empty views, and a callable's own `call` property is not consulted.
45
- Transformer ID filters retain their transformer receiver and are read once per
46
- decision; invoking them does not consult the function's own `call` property.
47
- Virtual-module regexes match whole module IDs: layer suffixes cannot span path
48
- separators, and names inside queries or fragments are not filenames. The
49
- query-aware matcher includes multiline queries. Layer/query capture groups stay
50
- unchanged; the full match now includes any directory prefix.
51
20
 
52
21
  `getModuleOutput(ctx, id)` reads the latest successful full-pipeline output,
53
22
  including output from a module currently excluded by global content filtering.
@@ -66,30 +35,10 @@ import {
66
35
  ```
67
36
 
68
37
  `readSourceFile` treats a missing file as empty and preserves other filesystem
69
- errors. `generateSources` applies configured extractors to file paths and
70
- generates directly from supplied source content.
71
- If the generator configuration is replaced, or its extractor list, extraction
72
- hooks, or environment mode changes during file extraction or generation, it
73
- re-extracts all supplied file sources before returning a result. This also covers
74
- in-place edits to prepared configurations, preventing mixed or obsolete tokens.
75
- Snapshots compare the same own extractor entries Core executes: filling an empty
76
- array slot invalidates the batch, while inherited slots remain ignored.
77
- Extraction snapshots track data-property hooks by function identity and accessor
78
- hooks by getter identity, including class-prototype getters. Snapshot checks do
79
- not invoke getters: returning a fresh bound function does not cause endless
80
- re-extraction, while replacing the getter still invalidates the batch. Changes
81
- to a hook's closed-over state require an explicit configuration update.
82
- Its Core input-validity check also stops obsolete unmatched and shortcut warnings
83
- before publication, leaving later genuine diagnostics eligible to warn. A
84
- caller-supplied `isInputCurrent` check is composed with the extraction snapshot;
85
- caller failures, false returns, and invalid return types are terminal even when
86
- the check also changes extraction. Only internal snapshot invalidation retries.
87
- Errors reading the caller's input-check option or validating its function type
88
- are terminal too; a valid option getter is captured once across retries.
89
- Running hooks and diagnostics already delivered before invalidation are not
90
- rolled back.
38
+ errors. `generateSources` applies configured extractors to supplied file paths
39
+ and source content. If the generator configuration or extraction hooks change
40
+ mid-build, it re-extracts those sources before returning a result. A caller's
41
+ `isInputCurrent` check remains authoritative: a failed or false check is not
42
+ retried as an internal snapshot change.
91
43
 
92
44
  This package defines no utility vocabulary or application-facing class API.
93
-
94
- Pre-1.0. Prefer a TeaCSS integration unless you are extending the build
95
- pipeline.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teacss/runtime",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "Build-pipeline runtime for TeaCSS (context, content extraction, transformers, layers).",
5
5
  "homepage": "https://css.teasim.com",
6
6
  "funding": "https://github.com/sponsors/billgo",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@jridgewell/remapping": "^2.3.5",
27
- "@teacss/config": "0.5.1",
28
- "@teacss/core": "0.5.1",
27
+ "@teacss/config": "0.6.0",
28
+ "@teacss/core": "0.6.0",
29
29
  "magic-string": "^1.2.3",
30
30
  "unplugin-utils": "^0.3.2"
31
31
  },