@ai.all/ds 0.0.0-stage → 0.1.0-beta.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.
- package/ALL.md +29 -0
- package/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +155 -2
- package/bin/ds.js +9 -0
- package/brand/ai-all.svg +5 -0
- package/brand/aiall.svg +11 -0
- package/brand/ds.svg +9 -0
- package/brand/ds7.svg +10 -0
- package/brand/ui.svg +10 -0
- package/docs/ARCHITECTURE.md +36 -0
- package/docs/CRITICAL-CSS.md +36 -0
- package/docs/ECOSYSTEM.md +37 -0
- package/docs/RELEASE.md +22 -0
- package/docs/STATIC-SITES.md +34 -0
- package/ds.config.schema.json +91 -0
- package/nuxt/module.mjs +17 -0
- package/package.json +71 -4
- package/src/build.mjs +18 -0
- package/src/cli.mjs +172 -0
- package/src/config.mjs +231 -0
- package/src/files.mjs +36 -0
- package/src/index.mjs +10 -0
- package/src/nuxt-options.mjs +27 -0
- package/src/optimize.mjs +163 -0
- package/src/report.mjs +102 -0
package/ALL.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# DS — Agent Rules
|
|
2
|
+
|
|
3
|
+
> DS is an experimental static-output optimization engine in the AI.ALL ecosystem. Read this file before changing code or documentation.
|
|
4
|
+
|
|
5
|
+
## Product boundary
|
|
6
|
+
|
|
7
|
+
- Frameworks own rendering, route discovery, bundling, content hashing and framework-specific minification.
|
|
8
|
+
- DS can run a configured static generator, optimize its generated HTML, optionally inline document-matched CSS, write gzip/Brotli sidecars and report output sizes.
|
|
9
|
+
- Never rewrite hashed JavaScript or CSS after the bundler emits it.
|
|
10
|
+
- Critical CSS is opt-in and must target explicit generated HTML paths. Preserve the source stylesheet and test the rendered result.
|
|
11
|
+
- Beasties matches selectors against the generated document; it does not measure a browser viewport. Do not describe this mode as viewport-accurate above-the-fold extraction.
|
|
12
|
+
- The package is a beta. Do not claim a stable API or publish without maintainer approval.
|
|
13
|
+
|
|
14
|
+
## Engineering rules
|
|
15
|
+
|
|
16
|
+
- Code, comments, identifiers, technical documentation and commit messages are in English.
|
|
17
|
+
- Prefer small, explicit changes and preserve existing user configuration.
|
|
18
|
+
- Validate all configuration before writing generated output. Errors must be actionable and non-zero.
|
|
19
|
+
- Execute generator commands as argument arrays without a shell.
|
|
20
|
+
- Add tests and a changelog entry for every user-visible behavior change.
|
|
21
|
+
- Run `npm run verify` before declaring work complete.
|
|
22
|
+
- Do not commit or push unless the owner explicitly asks.
|
|
23
|
+
|
|
24
|
+
## Entry points
|
|
25
|
+
|
|
26
|
+
- [README.md](README.md): installation, commands and configuration.
|
|
27
|
+
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md): package modules and data flow.
|
|
28
|
+
- [docs/STATIC-SITES.md](docs/STATIC-SITES.md): static generation and post-processing.
|
|
29
|
+
- [docs/CRITICAL-CSS.md](docs/CRITICAL-CSS.md): supported CSS inlining modes and limits.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to DS are recorded here. Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versions follow [Semantic Versioning](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.0-beta.0] - 2026-12-03
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- A beta CLI to initialize a static build config, run a configured generator, optimize generated HTML, and analyze output sizes.
|
|
11
|
+
- An optional Nuxt 4 module that enables framework minification and Nitro compression defaults without replacing explicit project settings.
|
|
12
|
+
- Opt-in, route-scoped document-matched critical CSS processing that preserves source stylesheets.
|
|
13
|
+
- Optional gzip and Brotli sidecars for compressible static assets.
|
|
14
|
+
- A Node API at `@ai.all/ds` (config loading, generator run, optimization, size report) so DS7 and UI can reuse the pipeline without spawning the CLI.
|
|
15
|
+
|
|
16
|
+
### Safety
|
|
17
|
+
- Keep framework rendering and hashed JS/CSS optimization in the framework's build tool.
|
|
18
|
+
- Keep HTML minification and critical CSS disabled or narrowly scoped until the generated output has been checked.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Igor Orlov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,156 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/ai-all-ai/ds/main/brand/ai-all.svg" width="190" alt="AI.ALL" />
|
|
3
|
+
<p><img src="https://raw.githubusercontent.com/ai-all-ai/ds/main/brand/ds.svg" width="56" alt="" /></p>
|
|
4
|
+
<h1>DS</h1>
|
|
5
|
+
<p><strong>Static-site build and delivery optimization.</strong><br />Framework-owned rendering and bundling, with opt-in output processing.</p>
|
|
6
|
+
<p>
|
|
7
|
+
<a href="https://www.npmjs.com/package/@ai.all/ds?activeTab=versions"><img src="https://img.shields.io/npm/v/@ai.all/ds/next?label=npm%20next" alt="npm next" /></a>
|
|
8
|
+
<a href="https://img.shields.io/node/v/@ai.all/ds"><img src="https://img.shields.io/node/v/@ai.all/ds?label=Node.js" alt="Node.js version" /></a>
|
|
9
|
+
<a href="https://github.com/ai-all-ai/ds/actions/workflows/ci.yml"><img src="https://github.com/ai-all-ai/ds/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI status" /></a>
|
|
10
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="MIT license" /></a>
|
|
11
|
+
</p>
|
|
12
|
+
</div>
|
|
2
13
|
|
|
3
|
-
|
|
14
|
+
```bash
|
|
15
|
+
npm install --save-dev @ai.all/ds@next
|
|
16
|
+
npx ds init
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Status:** Experimental beta on the npm `next` tag. The CLI, API and config may change before 1.0.
|
|
20
|
+
|
|
21
|
+
## Documentation map
|
|
22
|
+
|
|
23
|
+
| If you need to | Start with |
|
|
24
|
+
| ---------------------------------------------- | --------------------------------------------------- |
|
|
25
|
+
| Configure and use the CLI | [Quick start](#quick-start) · [Commands](#commands) |
|
|
26
|
+
| Prepare or publish a beta release | [Release process](docs/RELEASE.md) |
|
|
27
|
+
| Choose a generator and output flow | [Static sites](docs/STATIC-SITES.md) |
|
|
28
|
+
| Configure critical CSS safely | [Critical CSS](docs/CRITICAL-CSS.md) |
|
|
29
|
+
| Understand the package design | [Architecture](docs/ARCHITECTURE.md) |
|
|
30
|
+
| See the package's standards and limits | [Agent rules](ALL.md) |
|
|
31
|
+
| Understand product ownership and compatibility | [AI.ALL ecosystem](docs/ECOSYSTEM.md) |
|
|
32
|
+
|
|
33
|
+
## AI.ALL ecosystem
|
|
34
|
+
|
|
35
|
+
<!-- ecosystem:begin -->
|
|
36
|
+
### Product boundaries
|
|
37
|
+
|
|
38
|
+
| Product | Responsibility | Release status |
|
|
39
|
+
| --- | --- | --- |
|
|
40
|
+
| [AI.ALL](https://github.com/ai-all-ai/aiall) ([`@ai.all/aiall`](https://www.npmjs.com/package/@ai.all/aiall)) | AI agent instructions, pack routing, entrypoint synchronization, and ecosystem registry. | Published on npm `latest` |
|
|
41
|
+
| [DS7](https://github.com/ai-all-ai/ds7) ([`@ai.all/ds7`](https://www.npmjs.com/package/@ai.all/ds7)) | Framework-independent web standards, architecture guidance, templates, and quality checks. | Published on npm `latest` |
|
|
42
|
+
| [UI](https://github.com/ai-all-ai/ui) ([`@ai.all/ui`](https://www.npmjs.com/package/@ai.all/ui)) | Vue components, design tokens, a living Brandbook, developer tools, and the Media Engine. | Pre-release on npm `next` |
|
|
43
|
+
| [DS](https://github.com/ai-all-ai/ds) (`@ai.all/ds`, not published) | Working beta package repository for static build orchestration, safe HTML optimization, optional document-matched CSS inlining, compression and size reporting; 0.1.0-beta.0 is prepared, npm publication pending. | Pre-release candidate; not yet published |
|
|
44
|
+
|
|
45
|
+
See [ecosystem boundaries, dependencies, compatibility and verified versions](docs/ECOSYSTEM.md).
|
|
46
|
+
<!-- ecosystem:end -->
|
|
47
|
+
|
|
48
|
+
## Overview
|
|
49
|
+
|
|
50
|
+
DS orchestrates a static build and applies carefully scoped processing to its generated output. It does not replace the framework: Nuxt, Vite, Astro or another generator remains responsible for rendering, route discovery, bundling and content hashes.
|
|
51
|
+
|
|
52
|
+
- **Static generation:** run the configured framework generator and process its output directory.
|
|
53
|
+
- **JavaScript and CSS:** leave bundling and minification to the framework before asset filenames are hashed.
|
|
54
|
+
- **HTML minification:** opt in only after checking hydration and rendered text.
|
|
55
|
+
- **Critical CSS:** opt in for explicit generated HTML paths. The beta matches selectors against document markup; it does not calculate viewport-specific above-the-fold CSS.
|
|
56
|
+
- **Compression:** write gzip and Brotli sidecars for a static server or CDN configured to serve them.
|
|
57
|
+
- **Analysis:** report raw, gzip and Brotli output sizes.
|
|
58
|
+
|
|
59
|
+
## Requirements
|
|
60
|
+
|
|
61
|
+
- Node.js 20.19 or newer.
|
|
62
|
+
- A static generator that writes an output directory.
|
|
63
|
+
- A static server or CDN configured to negotiate and serve `.gz` and `.br` sidecars when using pre-compression.
|
|
64
|
+
|
|
65
|
+
## Quick start
|
|
66
|
+
|
|
67
|
+
Install the beta from npm, then initialize the consumer project:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm install --save-dev @ai.all/ds@next
|
|
71
|
+
npx ds init
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The starter config runs `npm run generate` into `.output/public`. DS adds `generate:optimized` only when the project already has a `generate` script.
|
|
75
|
+
|
|
76
|
+
For a Nuxt 4 project, register the optional module:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
export default defineNuxtConfig({
|
|
80
|
+
modules: ['@ai.all/ds/nuxt'],
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The module enables production Vite JavaScript/CSS minification and Nitro gzip/Brotli defaults only when the project has not set those options explicitly. The active framework build owns bundle generation and filenames.
|
|
85
|
+
|
|
86
|
+
Run the optimized build when the script is available:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm run generate:optimized
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
For Astro or another static generator, set `generator.command` and `generator.outputDir` in `ds.config.json`, then run `ds build`. For example:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"generator": {
|
|
97
|
+
"command": ["npm", "run", "build"],
|
|
98
|
+
"outputDir": "dist"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
To process existing output instead, run the generator followed by:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npx ds optimize
|
|
107
|
+
npx ds analyze
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Commands
|
|
111
|
+
|
|
112
|
+
| Command | Purpose |
|
|
113
|
+
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
|
|
114
|
+
| `ds init` | Create the starter config and add an optimized generation script when the project has a `generate` script. |
|
|
115
|
+
| `ds build` | Run the configured static generator and optimize its output. |
|
|
116
|
+
| `ds optimize [--dir <path>]` | Optimize an existing output directory. |
|
|
117
|
+
| `ds analyze [--dir <path>] [--json]` | Report raw, gzip and Brotli sizes. |
|
|
118
|
+
|
|
119
|
+
## Node API
|
|
120
|
+
|
|
121
|
+
Other tools, such as DS7 and UI, can call DS directly instead of spawning the CLI:
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
import { loadConfig, resolveOutputDirectory, optimizeOutput, formatReport } from '@ai.all/ds';
|
|
125
|
+
|
|
126
|
+
const config = await loadConfig(process.cwd());
|
|
127
|
+
const dir = await resolveOutputDirectory(process.cwd(), config.generator.outputDir);
|
|
128
|
+
const result = await optimizeOutput(dir, config.optimization);
|
|
129
|
+
console.log(formatReport(result.report, config.generator.outputDir));
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The root export also provides `DEFAULT_CONFIG`, `validateConfig`, `runGenerator`, `analyzeOutput` and `applyProductionDefaults`.
|
|
133
|
+
|
|
134
|
+
Generator commands are configured as an executable and argument array; DS does not run them through a shell. Output directories must stay inside the project root.
|
|
135
|
+
|
|
136
|
+
## Optimization defaults and limits
|
|
137
|
+
|
|
138
|
+
- Nuxt's `nuxt generate` prerenders pages into `.output/public`; explicit dynamic routes belong in Nuxt's `nitro.prerender.routes`.
|
|
139
|
+
- DS does not post-process hashed JavaScript or CSS, avoiding stale hashes, source-map issues and framework-manifest mismatches.
|
|
140
|
+
- HTML minification and critical CSS are disabled by default.
|
|
141
|
+
- Critical CSS requires explicit generated `.html` paths. Beasties matches CSS selectors against the document, not a browser viewport. The source stylesheet remains unchanged, so matching rules may be transferred both inline and externally.
|
|
142
|
+
- Gzip and Brotli sidecars are enabled by default for compressible files. The web server or CDN must negotiate and serve them.
|
|
143
|
+
|
|
144
|
+
See [static generation](docs/STATIC-SITES.md) and [critical CSS](docs/CRITICAL-CSS.md) before enabling post-processing.
|
|
145
|
+
|
|
146
|
+
## Release
|
|
147
|
+
|
|
148
|
+
Versioning, release steps and rules: [docs/RELEASE.md](docs/RELEASE.md). The change history is in [CHANGELOG.md](CHANGELOG.md). `0.1.0-beta.0` is the first pre-release, on the npm `next` tag; its CLI, API and config may change before a stable release.
|
|
149
|
+
|
|
150
|
+
## Contributing and security
|
|
151
|
+
|
|
152
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
MIT. See [LICENSE](LICENSE).
|
package/bin/ds.js
ADDED
package/brand/ai-all.svg
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 128" role="img" aria-labelledby="title">
|
|
2
|
+
<title id="title">AI.ALL</title>
|
|
3
|
+
<style>text { fill: #17191c; } @media (prefers-color-scheme: dark) { text { fill: #f5f6f7; } }</style>
|
|
4
|
+
<text x="8" y="96" font-family="Inter, Arial, sans-serif" font-size="96" font-weight="750" letter-spacing="-5">AI<tspan fill="#e2a900">.</tspan>ALL</text>
|
|
5
|
+
</svg>
|
package/brand/aiall.svg
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-labelledby="title">
|
|
2
|
+
<title id="title">AI.ALL instruction network</title>
|
|
3
|
+
<style>path, circle { stroke: #17191c; } @media (prefers-color-scheme: dark) { path, circle { stroke: #f5f6f7; } }</style>
|
|
4
|
+
<g fill="none" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round">
|
|
5
|
+
<path d="M15 32h34M32 15v34M20 20l24 24M44 20 20 44" />
|
|
6
|
+
<circle cx="15" cy="32" r="4" fill="#e2a900" />
|
|
7
|
+
<circle cx="49" cy="32" r="4" fill="#e2a900" />
|
|
8
|
+
<circle cx="32" cy="15" r="4" fill="#e2a900" />
|
|
9
|
+
<circle cx="32" cy="49" r="4" fill="#e2a900" />
|
|
10
|
+
</g>
|
|
11
|
+
</svg>
|
package/brand/ds.svg
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-labelledby="title">
|
|
2
|
+
<title id="title">DS static build optimization</title>
|
|
3
|
+
<style>path, rect { stroke: #17191c; } @media (prefers-color-scheme: dark) { path, rect { stroke: #f5f6f7; } }</style>
|
|
4
|
+
<g fill="none" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round">
|
|
5
|
+
<rect x="9" y="12" width="31" height="40" rx="5" />
|
|
6
|
+
<path d="M17 23h15M17 32h11M17 41h15M40 32h12M46 26l6 6-6 6" />
|
|
7
|
+
</g>
|
|
8
|
+
<circle cx="51" cy="32" r="3.5" fill="#e2a900" />
|
|
9
|
+
</svg>
|
package/brand/ds7.svg
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-labelledby="title">
|
|
2
|
+
<title id="title">DS7 standards and quality gates</title>
|
|
3
|
+
<style>path, rect { stroke: #17191c; } @media (prefers-color-scheme: dark) { path, rect { stroke: #f5f6f7; } }</style>
|
|
4
|
+
<g fill="none" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round">
|
|
5
|
+
<rect x="10" y="10" width="44" height="44" rx="8" />
|
|
6
|
+
<path d="M20 23h12M20 32h8M20 41h12M39 22l3 3 6-7M35 41l4 4 9-10" />
|
|
7
|
+
</g>
|
|
8
|
+
<circle cx="49" cy="22" r="3" fill="#e2a900" />
|
|
9
|
+
<circle cx="49" cy="40" r="3" fill="#e2a900" />
|
|
10
|
+
</svg>
|
package/brand/ui.svg
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-labelledby="title">
|
|
2
|
+
<title id="title">UI components and design tokens</title>
|
|
3
|
+
<style>path, rect { stroke: #17191c; } @media (prefers-color-scheme: dark) { path, rect { stroke: #f5f6f7; } }</style>
|
|
4
|
+
<g fill="none" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round">
|
|
5
|
+
<rect x="9" y="10" width="30" height="36" rx="5" />
|
|
6
|
+
<rect x="25" y="18" width="30" height="36" rx="5" />
|
|
7
|
+
<path d="M16 19h15M16 27h10M32 29h15M32 37h15M32 45h9" />
|
|
8
|
+
</g>
|
|
9
|
+
<circle cx="48" cy="46" r="3.5" fill="#e2a900" />
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
DS is a static-output pipeline, not a rendering framework. The configured framework or generator remains responsible for route discovery, rendering, asset bundling, content hashes and JavaScript/CSS minification.
|
|
4
|
+
|
|
5
|
+
## Data flow
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
configured static generator
|
|
9
|
+
-> generated output directory
|
|
10
|
+
-> optional route-scoped HTML/CSS optimization
|
|
11
|
+
-> gzip and Brotli sidecars
|
|
12
|
+
-> size report
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Modules
|
|
16
|
+
|
|
17
|
+
| File | Responsibility |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `src/config.mjs` | Load, validate and resolve `ds.config.json`. |
|
|
20
|
+
| `src/build.mjs` | Run the configured generator as an argument array without a shell. |
|
|
21
|
+
| `src/nuxt-options.mjs` | Apply non-overriding production minification and compression defaults. |
|
|
22
|
+
| `src/optimize.mjs` | Process generated HTML, optionally apply Beasties, and refresh compression sidecars. |
|
|
23
|
+
| `src/report.mjs` | Measure raw, gzip and Brotli sizes for output assets. |
|
|
24
|
+
| `src/cli.mjs` | Expose `init`, `build`, `optimize` and `analyze`. |
|
|
25
|
+
| `src/index.mjs` | Expose the Node API at `@ai.all/ds` for DS7, UI and other tools. |
|
|
26
|
+
| `nuxt/module.mjs` | Expose the optional Nuxt 4 integration at `@ai.all/ds/nuxt`. |
|
|
27
|
+
|
|
28
|
+
The optimizer does not rewrite hashed JavaScript or CSS. Compression sidecars are generated from the final contents, including HTML changed by optimization.
|
|
29
|
+
|
|
30
|
+
## Configuration and paths
|
|
31
|
+
|
|
32
|
+
`ds.config.json` belongs to the project root. Output paths must resolve to a directory inside that root; the project root itself and paths that escape it are rejected. The generator is an executable plus arguments, never a shell command string.
|
|
33
|
+
|
|
34
|
+
## Beta boundary
|
|
35
|
+
|
|
36
|
+
The current beta targets pre-rendered static files. It does not own SSR response hooks, hydration, image transcoding, route discovery, CSS class mangling or viewport-based critical CSS extraction.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Critical CSS
|
|
2
|
+
|
|
3
|
+
Critical CSS can reduce render-blocking work, but extracting too little causes unstyled content and extracting too much increases HTML size. The DS beta therefore leaves it off by default and requires exact generated HTML paths.
|
|
4
|
+
|
|
5
|
+
## Supported mode
|
|
6
|
+
|
|
7
|
+
DS uses Beasties to match CSS selectors against the full generated HTML document. This is a static, document-used CSS set; it does **not** render a browser viewport or know which content is above the fold. Beasties can limit matching to elements marked `data-beasties-container`, but that is still an explicit document boundary, not a viewport measurement.
|
|
8
|
+
|
|
9
|
+
The source stylesheet is preserved (`pruneSource: false`) so its content hash and framework references remain valid. This means matched rules can be present in both the inline critical block and the full external stylesheet; total transferred bytes may increase even when first paint improves. Remaining stylesheets use the `body` preload strategy by default, which avoids injecting inline event handlers or scripts. Set `preload` to `false` to keep stylesheet links in their original render-blocking behavior.
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"optimization": {
|
|
14
|
+
"criticalCss": {
|
|
15
|
+
"enabled": true,
|
|
16
|
+
"routes": ["index.html", "es/index.html"],
|
|
17
|
+
"allowRules": [".dialog[data-open]", ".menu.-expanded"],
|
|
18
|
+
"preload": "body"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`routes` are exact paths relative to the generated output directory. Empty routes, missing files and paths outside the output are errors. `allowRules` retains selectors that are applied later by JavaScript but are absent from prerendered markup.
|
|
25
|
+
|
|
26
|
+
## Viewport-accurate extraction
|
|
27
|
+
|
|
28
|
+
For CSS that must be measured at actual mobile and desktop viewport sizes, use a browser-rendered extractor such as `critical` with Playwright and configure multiple dimensions. That strategy has a browser installation/runtime cost and is not part of this beta. Do not treat Beasties document matching as equivalent.
|
|
29
|
+
|
|
30
|
+
## Verification before enabling
|
|
31
|
+
|
|
32
|
+
1. Enable one route or one page group in a branch.
|
|
33
|
+
2. Compare the page before and after at the target phone, tablet and desktop widths; include open menus, dialogs and other runtime states.
|
|
34
|
+
3. Check keyboard, no-JavaScript and strict Content Security Policy behavior.
|
|
35
|
+
4. Measure render-blocking requests and real-device First Contentful Paint.
|
|
36
|
+
5. Keep the change only if the page remains correct and the measured result improves.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# DS and the AI.ALL ecosystem
|
|
2
|
+
|
|
3
|
+
<!-- Generated from src/ecosystem.json by scripts/sync-ecosystem.mjs. -->
|
|
4
|
+
|
|
5
|
+
**Registry snapshot checked:** 2026-12-02<br>
|
|
6
|
+
**Canonical registry:** [AI.ALL ecosystem guide](https://github.com/ai-all-ai/aiall/blob/main/docs/ECOSYSTEM.md)
|
|
7
|
+
|
|
8
|
+
This generated summary describes current package boundaries. The AI.ALL guide is the single source for the full dependency matrix, version sources and coordinated release order.
|
|
9
|
+
|
|
10
|
+
## Products
|
|
11
|
+
|
|
12
|
+
| Product | Responsibility | Release status |
|
|
13
|
+
| --- | --- | --- |
|
|
14
|
+
| [AI.ALL](https://github.com/ai-all-ai/aiall) ([`@ai.all/aiall`](https://www.npmjs.com/package/@ai.all/aiall)) | AI agent instructions, pack routing, entrypoint synchronization, and ecosystem registry. | Published on npm `latest` |
|
|
15
|
+
| [DS7](https://github.com/ai-all-ai/ds7) ([`@ai.all/ds7`](https://www.npmjs.com/package/@ai.all/ds7)) | Framework-independent web standards, architecture guidance, templates, and quality checks. | Published on npm `latest` |
|
|
16
|
+
| [UI](https://github.com/ai-all-ai/ui) ([`@ai.all/ui`](https://www.npmjs.com/package/@ai.all/ui)) | Vue components, design tokens, a living Brandbook, developer tools, and the Media Engine. | Pre-release on npm `next` |
|
|
17
|
+
| [DS](https://github.com/ai-all-ai/ds) (`@ai.all/ds`, not published) | Working beta package repository for static build orchestration, safe HTML optimization, optional document-matched CSS inlining, compression and size reporting; 0.1.0-beta.0 is prepared, npm publication pending. | Pre-release candidate; not yet published |
|
|
18
|
+
|
|
19
|
+
## DS ownership
|
|
20
|
+
|
|
21
|
+
- Owns static-output post-processing and build-size analysis; framework-specific generators remain responsible for rendering and bundling.
|
|
22
|
+
- Its working beta package wraps existing generator commands, optionally optimizes prerendered HTML and document-used CSS, and writes compression sidecars.
|
|
23
|
+
- The prerelease is prepared in the active repository but not yet published; its API remains experimental.
|
|
24
|
+
|
|
25
|
+
## Dependencies
|
|
26
|
+
|
|
27
|
+
- No product runtime dependencies.
|
|
28
|
+
|
|
29
|
+
## Integration notes
|
|
30
|
+
|
|
31
|
+
- AI.ALL works without DS7 or UI. Packs are opt-in and do not install other products by themselves.
|
|
32
|
+
- DS7 depends on UI because its current initializer creates a Nuxt application that consumes UI components, styles, and the Brandbook. Removing that dependency requires an explicit UI-free initializer profile and an integration migration.
|
|
33
|
+
- UI can be used without AI.ALL or DS7. Its AI.ALL pack is optional.
|
|
34
|
+
- DS7 currently provides responsive image generation as well as media validation. Moving generation to UI is a target, not a completed migration; keep the DS7 command until UI feature parity and consumer migration are verified.
|
|
35
|
+
- DS is an active repository with a working, tested beta package and a prepared 0.1.0-beta.0 prerelease; npm publication is pending and its API remains experimental.
|
|
36
|
+
|
|
37
|
+
Refresh this summary from the canonical AI.ALL repository with `npm run ecosystem:sync -- --require-all`.
|
package/docs/RELEASE.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Release process
|
|
2
|
+
|
|
3
|
+
DS is an experimental package. Pre-releases use the npm `next` dist-tag; they must not replace the stable `latest` tag.
|
|
4
|
+
|
|
5
|
+
## Current release
|
|
6
|
+
|
|
7
|
+
`@ai.all/ds@0.1.0-beta.0` is the first pre-release.
|
|
8
|
+
|
|
9
|
+
## How a release runs
|
|
10
|
+
|
|
11
|
+
Pushing a `vX.Y.Z` tag runs `.github/workflows/release.yml`, the same flow as DS7 and UI: it creates the GitHub Release from the matching `CHANGELOG.md` section, runs `npm run verify`, and publishes with provenance through npm trusted publishing (environment `npm`). A tag with a pre-release suffix (`-beta.N`) is marked as a GitHub pre-release and published to npm `next`; a final tag goes to `latest` and then asks `ai-all-ai/homebrew-tap` to update the `ds` formula. **Pushing a tag publishes the package**, so push it only when the release is approved.
|
|
12
|
+
|
|
13
|
+
## Before publishing a pre-release
|
|
14
|
+
|
|
15
|
+
1. Confirm `package.json`, `package-lock.json` if present, and the matching `CHANGELOG.md` entry use the same version.
|
|
16
|
+
2. Run `npm run verify` and inspect `npm pack --dry-run` for the expected files.
|
|
17
|
+
3. Check `npm view @ai.all/ds versions --json` to confirm the version is unused.
|
|
18
|
+
4. Commit the reviewed source and release notes, then create the matching `vVERSION` tag.
|
|
19
|
+
5. Push the tag only with the maintainer's explicit approval; the workflow publishes it.
|
|
20
|
+
6. Confirm `npm view @ai.all/ds@VERSION version dist.tarball` and install the published package in a clean fixture.
|
|
21
|
+
|
|
22
|
+
Do not publish the beta under `latest`, and do not describe it as a stable API. A stable release requires a separate compatibility review and explicit maintainer approval.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Static generation and optimization
|
|
2
|
+
|
|
3
|
+
## Keep rendering with the framework
|
|
4
|
+
|
|
5
|
+
DS runs a configured generator, then post-processes its output. It does not render routes itself.
|
|
6
|
+
|
|
7
|
+
For Nuxt, `nuxt generate` prerenders routes into `.output/public`. Nuxt discovers pages by crawling links by default; dynamic routes that are not linked need to be listed in `nitro.prerender.routes`. The generator fails on route errors rather than handing DS an incomplete site.
|
|
8
|
+
|
|
9
|
+
For other generators, change `generator.command` and `generator.outputDir`. For example, an Astro project commonly uses `["npm", "run", "build"]` and `dist`. Keep route configuration in the owning framework.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx ds init
|
|
13
|
+
npm run generate:optimized
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`ds init` creates `ds.config.json` and adds `generate:optimized` only when the project already has a `generate` script. The default generator is `npm run generate`; an Astro or other project should edit the command and output directory before running `ds build`.
|
|
17
|
+
|
|
18
|
+
## Build stages
|
|
19
|
+
|
|
20
|
+
1. **Render and bundle:** Nuxt, Vite, Astro or another framework creates the static files. The optional Nuxt module explicitly enables the active Vite JavaScript and CSS minifiers unless the project has set those options itself. Keep minification before content hashes are calculated.
|
|
21
|
+
2. **Optional HTML processing:** DS can minify HTML, but it is off by default because whitespace and framework hydration markers must be verified against the actual application.
|
|
22
|
+
3. **Optional critical CSS:** DS can process selected HTML files with Beasties. Configure exact output paths; start with one page group and verify visual references at the project's target viewports.
|
|
23
|
+
4. **Delivery compression:** DS can write gzip and Brotli sidecars for compressible files. A web server or CDN must be configured to serve the pre-compressed variants.
|
|
24
|
+
5. **Measure:** `ds analyze` reports raw, gzip and Brotli sizes for HTML, CSS, JavaScript and other compressible assets. Compare the same routes and assets before and after each change.
|
|
25
|
+
|
|
26
|
+
DS never rewrites post-hash JS or CSS. This avoids stale hashes, broken source maps and mismatch with framework manifests.
|
|
27
|
+
|
|
28
|
+
## Project-specific checks
|
|
29
|
+
|
|
30
|
+
- Confirm every intended route exists in generated output, including dynamic and localized routes.
|
|
31
|
+
- Test `404.html`, any SPA fallback and canonical URLs on the actual static host.
|
|
32
|
+
- Inspect generated HTML, stylesheets, scripts and compression headers.
|
|
33
|
+
- Run visual, accessibility, hydration and console checks after enabling HTML or CSS transforms.
|
|
34
|
+
- Record representative raw, gzip and Brotli sizes in the consuming project's metrics log.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "DS build configuration",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["schemaVersion", "generator", "optimization"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"$schema": {
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
"schemaVersion": {
|
|
11
|
+
"const": 1
|
|
12
|
+
},
|
|
13
|
+
"generator": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"required": ["command", "outputDir"],
|
|
16
|
+
"properties": {
|
|
17
|
+
"command": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"items": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"minLength": 1
|
|
22
|
+
},
|
|
23
|
+
"minItems": 1
|
|
24
|
+
},
|
|
25
|
+
"outputDir": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"minLength": 1
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"additionalProperties": false
|
|
31
|
+
},
|
|
32
|
+
"optimization": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"required": ["html", "criticalCss", "compression"],
|
|
35
|
+
"properties": {
|
|
36
|
+
"html": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"required": ["minify"],
|
|
39
|
+
"properties": {
|
|
40
|
+
"minify": {
|
|
41
|
+
"type": "boolean"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"additionalProperties": false
|
|
45
|
+
},
|
|
46
|
+
"criticalCss": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"required": ["enabled", "routes", "allowRules", "preload"],
|
|
49
|
+
"properties": {
|
|
50
|
+
"enabled": {
|
|
51
|
+
"type": "boolean"
|
|
52
|
+
},
|
|
53
|
+
"routes": {
|
|
54
|
+
"type": "array",
|
|
55
|
+
"items": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"minLength": 1
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"allowRules": {
|
|
61
|
+
"type": "array",
|
|
62
|
+
"items": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"minLength": 1
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"preload": {
|
|
68
|
+
"oneOf": [{ "const": "body" }, { "const": false }]
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"additionalProperties": false
|
|
72
|
+
},
|
|
73
|
+
"compression": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"required": ["gzip", "brotli"],
|
|
76
|
+
"properties": {
|
|
77
|
+
"gzip": {
|
|
78
|
+
"type": "boolean"
|
|
79
|
+
},
|
|
80
|
+
"brotli": {
|
|
81
|
+
"type": "boolean"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"additionalProperties": false
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"additionalProperties": false
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"additionalProperties": false
|
|
91
|
+
}
|
package/nuxt/module.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineNuxtModule } from 'nuxt/kit';
|
|
2
|
+
import { applyProductionDefaults } from '../src/nuxt-options.mjs';
|
|
3
|
+
|
|
4
|
+
export default defineNuxtModule({
|
|
5
|
+
meta: {
|
|
6
|
+
name: '@ai.all/ds',
|
|
7
|
+
configKey: 'ds',
|
|
8
|
+
compatibility: { nuxt: '^4.0.0' },
|
|
9
|
+
},
|
|
10
|
+
defaults: {
|
|
11
|
+
minify: true,
|
|
12
|
+
compression: { gzip: true, brotli: true },
|
|
13
|
+
},
|
|
14
|
+
setup(options, nuxt) {
|
|
15
|
+
applyProductionDefaults(nuxt, options);
|
|
16
|
+
},
|
|
17
|
+
});
|