@weapp-tailwindcss/css-compat 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +108 -2
- package/README.zh-CN.md +106 -0
- package/THIRD_PARTY_LICENSES.txt +126 -0
- package/dist/diagnostics.cjs +13 -0
- package/dist/diagnostics.d.cts +24 -0
- package/dist/diagnostics.d.mts +24 -0
- package/dist/diagnostics.mjs +12 -0
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +3 -0
- package/dist/layers-CT2GtJgP.cjs +5480 -0
- package/dist/layers-D0OJtr2q.mjs +5490 -0
- package/dist/layers.cjs +4 -0
- package/dist/layers.d.cts +17 -0
- package/dist/layers.d.mts +17 -0
- package/dist/layers.mjs +2 -0
- package/dist/legacy.cjs +160 -0
- package/dist/legacy.d.cts +9 -0
- package/dist/legacy.d.mts +9 -0
- package/dist/legacy.mjs +157 -0
- package/dist/rolldown-runtime-y5ARvAq5.cjs +35 -0
- package/package.json +96 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 ice breaker
|
|
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,109 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @weapp-tailwindcss/css-compat
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> English | [简体中文](./README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
A framework-independent CSS cascade layer compiler. Version `0.1.0` provides layer registration, ordered compilation and source-aware diagnostics. Generator, scanner, runtime, selector/value transforms and Tailwind defaults remain in their adapters.
|
|
6
|
+
|
|
7
|
+
## Install and exports
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add -D @weapp-tailwindcss/css-compat postcss
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requires Node `^22.18.0 || >=24.11.0` and PostCSS `^8.5.29`. All four entrypoints ship ESM/CJS and matching declarations:
|
|
14
|
+
|
|
15
|
+
- Root and `/layers`: `compileCascadeLayers`, `createCascadeLayersPlugin` and options.
|
|
16
|
+
- `/diagnostics`: diagnostic types and `CascadeLayerError`.
|
|
17
|
+
- `/legacy`: `consumeCascadeLayers`, preserving the existing anchor algorithm.
|
|
18
|
+
|
|
19
|
+
## AST API
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { compileCascadeLayers } from '@weapp-tailwindcss/css-compat/layers'
|
|
23
|
+
import postcss from 'postcss'
|
|
24
|
+
|
|
25
|
+
const root = postcss.parse(css, { from: 'input.css' })
|
|
26
|
+
const result = compileCascadeLayers(root, {
|
|
27
|
+
mode: 'ordered',
|
|
28
|
+
onConflict: 'warning',
|
|
29
|
+
inputStage: 'native',
|
|
30
|
+
})
|
|
31
|
+
console.log(result.root.toString(), result.diagnostics)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`mode` is required. `ordered` mutates and returns the same Root only after all checks pass. Errors throw `CascadeLayerError` with diagnostics and leave the input content, structure and node identities intact. `preserve` returns the original Root with no diagnostics, suitable for targets supporting native layers.
|
|
35
|
+
|
|
36
|
+
`onConflict` defaults to `warning`; `error` rejects conservative diagnostics as well. `inputStage` defaults to `native`. Explicitly polyfilled input is rejected by ordered mode. Flattened CSS without provenance cannot recover layer semantics; author `:not(...)` selectors are retained without guessing their origin.
|
|
37
|
+
|
|
38
|
+
## PostCSS pipeline
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { createCascadeLayersPlugin } from '@weapp-tailwindcss/css-compat'
|
|
42
|
+
import postcss from 'postcss'
|
|
43
|
+
|
|
44
|
+
const result = await postcss([
|
|
45
|
+
createCascadeLayersPlugin({ mode: 'ordered', onConflict: 'error' }),
|
|
46
|
+
]).process(css, { from: 'input.css', to: 'output.css', map: { inline: false } })
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Complete generation, import expansion, preprocessor conditionals and CSS nesting before ordered compilation. Put the plugin after those processors; it runs in `OnceExit`. Diagnostics become PostCSS warnings with a stable `code` and the full `diagnostic` attached. Standard PostCSS processing retains from/to/map and result messages.
|
|
50
|
+
|
|
51
|
+
Variable safety analysis needs the original variable scope and layer information. Selector/value transforms can change specificity or introduce overrides; finish them before analyzing the final selectors. Merge inputs before compilation instead of flattening separate fragments and concatenating them.
|
|
52
|
+
|
|
53
|
+
## Ordered contract and limits
|
|
54
|
+
|
|
55
|
+
| Capability | Behavior |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| Named, repeated, dotted, nested, anonymous and escaped layers | First registration determines sibling order; anonymous identities never merge with author names |
|
|
58
|
+
| Normal declarations | Child layers precede direct parent declarations; later layers win; unlayered declarations have highest priority |
|
|
59
|
+
| Important declarations | Layer priority reverses; unlayered priority is lowest; fallback order within a layer stays intact |
|
|
60
|
+
| Conditions and source maps | Wrappers and sources are retained; conditional first registration is diagnosed |
|
|
61
|
+
| Descriptors | Preserved whole, once; cross-layer duplicate or uncertain identities are diagnosed |
|
|
62
|
+
| Reprocessing | No-layer input is retained; Root reuse, serialization and processor reuse are stable |
|
|
63
|
+
| Different specificity across layers | Potential inversions are diagnosed; ordering cannot emulate arbitrary cascade specificity |
|
|
64
|
+
|
|
65
|
+
Normal and important declarations are analyzed separately, including selector lists. Property names are tokenizer-decoded while custom properties remain case-sensitive. Aliases and shorthand longhands share property identities. Logical/physical overlap, reset shorthands and unknown properties receive conservative treatment. Selector intersection and mutually exclusive conditions are not proven, so diagnostics may include false positives.
|
|
66
|
+
|
|
67
|
+
Any remaining `@import`, `revert-layer`, nesting, invalid layer names, unconsumed preprocessor conditionals and explicitly polyfilled input always fail ordered mode, even with `onConflict: 'warning'`. Matching text inside strings and URLs is not interpreted as syntax. Independent whitespace around dotted layer separators is invalid; comments and escape-terminating whitespace are supported.
|
|
68
|
+
|
|
69
|
+
## Diagnostics
|
|
70
|
+
|
|
71
|
+
Diagnostics contain `code`, `severity`, `message`, `suggestion`, available source file/line/column and optional `related`, `layer`, `selector` and `property`. Nodes without source metadata do not get invented positions.
|
|
72
|
+
|
|
73
|
+
| Code | Meaning |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| `LAYER_OPTIONS` | Invalid API options |
|
|
76
|
+
| `LAYER_INPUT_STAGE` | Explicitly polyfilled input |
|
|
77
|
+
| `LAYER_IMPORT` | Remaining import or invalid prologue location |
|
|
78
|
+
| `LAYER_REVERT` | Unsupported revert-layer |
|
|
79
|
+
| `LAYER_NESTING` | Remaining nesting or invalid declaration location |
|
|
80
|
+
| `LAYER_NAME` | Invalid layer name/list |
|
|
81
|
+
| `LAYER_PREPROCESSOR` | Unconsumed conditional compilation |
|
|
82
|
+
| `LAYER_CONDITIONAL_ORDER` | Conditional first layer registration |
|
|
83
|
+
| `LAYER_SPECIFICITY` | Potential cross-layer specificity inversion |
|
|
84
|
+
| `LAYER_SELECTOR_UNKNOWN` | Selector cannot be reliably analyzed |
|
|
85
|
+
| `LAYER_DESCRIPTOR_ORDER` | Cross-layer descriptor semantics need validation |
|
|
86
|
+
| `LAYER_WRAPPER_SEMANTICS` | Unknown/scoping wrapper equivalence cannot be proven |
|
|
87
|
+
|
|
88
|
+
## Scope and migration
|
|
89
|
+
|
|
90
|
+
One Root represents one merged cascade scope. Merge using the actual import/build graph. Isolated components, independent subpackages and different targets require separate compilation. The caller owns graph relationships, caching and HMR invalidation; every compiler call owns independent state.
|
|
91
|
+
|
|
92
|
+
`@weapp-tailwindcss/postcss/transform` continues re-exporting `consumeCascadeLayers(root)` from `/legacy`, including its existing limitations. The new API does not switch the published Tailwind layer defaults. Tailwind preflight/theme/components markers and Panda codec/recipes/runtime stay with their adapters.
|
|
93
|
+
|
|
94
|
+
For Panda 2.1.2, disable generator polyfilling and pass generated CSS to this public plugin. Isolated tarball tests exercise real generated CSS without changing the Panda repository. Selector, variable, unit and color compatibility are follow-up work.
|
|
95
|
+
|
|
96
|
+
## Verification
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
pnpm --filter @weapp-tailwindcss/css-compat build
|
|
100
|
+
pnpm --filter @weapp-tailwindcss/css-compat test
|
|
101
|
+
pnpm --filter @weapp-tailwindcss/css-compat typecheck
|
|
102
|
+
pnpm --filter @weapp-tailwindcss/css-compat properties:check
|
|
103
|
+
pnpm --filter @weapp-tailwindcss/css-compat test:package
|
|
104
|
+
pnpm --filter @weapp-tailwindcss/css-compat test:consumers
|
|
105
|
+
pnpm --filter @weapp-tailwindcss/css-compat test:browser
|
|
106
|
+
pnpm --filter @weapp-tailwindcss/css-compat bench
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Consumer tests require this checkout's PostCSS and generation-engine dependency builds. Browser tests require the installed Playwright version's Chromium, Firefox and WebKit binaries and fail if unavailable. Each engine runs headlessly and releases its browser/context/page. Package/browser evidence does not constitute WeChat or device acceptance. The compact property table is generated from pinned `mdn-data@2.37.2` (CC0-1.0) with explicit shorthand corrections; regenerate with `properties:generate`.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# @weapp-tailwindcss/css-compat
|
|
2
|
+
|
|
3
|
+
> [English](./README.md) | 简体中文
|
|
4
|
+
|
|
5
|
+
框架无关的 CSS layer 兼容内核。首期版本为 `0.1.0`,只提供 layer 注册、顺序编译和定位诊断;不生成 class,不转换 runtime,不扫描文件,也不注入 Tailwind 默认值。
|
|
6
|
+
|
|
7
|
+
## 安装与入口
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add -D @weapp-tailwindcss/css-compat postcss
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
支持 Node `^22.18.0 || >=24.11.0`、PostCSS `^8.5.29`。根入口和 `/layers` 提供编译器与插件,`/diagnostics` 提供诊断类型及 `CascadeLayerError`,`/legacy` 提供旧 anchor 算法。每个入口均有 ESM/CJS 及对应声明。
|
|
14
|
+
|
|
15
|
+
## AST API
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { compileCascadeLayers } from '@weapp-tailwindcss/css-compat/layers'
|
|
19
|
+
import postcss from 'postcss'
|
|
20
|
+
|
|
21
|
+
const root = postcss.parse(css, { from: 'input.css' })
|
|
22
|
+
const result = compileCascadeLayers(root, {
|
|
23
|
+
mode: 'ordered',
|
|
24
|
+
onConflict: 'warning',
|
|
25
|
+
inputStage: 'native',
|
|
26
|
+
})
|
|
27
|
+
console.log(result.root.toString(), result.diagnostics)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`mode` 必填。`ordered` 在全部输入检查和冲突分析完成后原地修改 Root,返回同一个 Root 与诊断数组;失败抛出携带诊断的 `CascadeLayerError`,原始节点身份、结构和内容均不变。`preserve` 原样返回,适合支持原生 layer 的 Web 目标。`onConflict` 默认 `warning`,设为 `error` 时保守诊断也阻止编译。
|
|
31
|
+
|
|
32
|
+
`inputStage` 默认 `native`;明确知道上游已经 polyfill 的输入应传 `polyfilled`,ordered 会拒绝它。未提供来源信息的已展平 CSS 无法恢复层语义;内核不会根据 `:not(...)` 的形状猜测来源,也不会清理作者选择器。
|
|
33
|
+
|
|
34
|
+
## PostCSS 插件与顺序
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { createCascadeLayersPlugin } from '@weapp-tailwindcss/css-compat'
|
|
38
|
+
import postcss from 'postcss'
|
|
39
|
+
|
|
40
|
+
const result = await postcss([
|
|
41
|
+
// 在此之前完成生成器、import、条件编译及 nesting 展开。
|
|
42
|
+
createCascadeLayersPlugin({ mode: 'ordered', onConflict: 'error' }),
|
|
43
|
+
]).process(css, { from: 'input.css', to: 'output.css', map: { inline: false } })
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
插件在 `OnceExit` 编译;将它放在 import/nesting 等前置插件之后。诊断通过 PostCSS warnings 输出,warning 带稳定 `code` 与完整 `diagnostic`。字符串处理使用 PostCSS 原生 `process`,保留 from/to/map/result messages。
|
|
47
|
+
|
|
48
|
+
变量安全分析必须在原变量作用域与 layer 信息仍存在时进行。selector/value 转换可能改变权重或引入覆盖,调用者应先完成这些变换,再对最终选择器运行 ordered;不要把生成的两段 CSS 分别展平后再拼接。
|
|
49
|
+
|
|
50
|
+
## 顺序兼容契约
|
|
51
|
+
|
|
52
|
+
| 能力 | 行为 |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| 命名、重复、点分、嵌套、匿名、转义层 | 首次注册确定顺序;匿名身份不与作者名称合并 |
|
|
55
|
+
| 普通声明 | 子层在父层直接声明之前,较晚层优先,未分层最高 |
|
|
56
|
+
| important | 层优先级反转,未分层最低;同层 fallback 保持源顺序 |
|
|
57
|
+
| 条件与 source map | 保留 wrapper 和来源;条件内首次注册产生诊断 |
|
|
58
|
+
| descriptor | 完整保留,不拆分、不重复;跨层同名或身份不明的定义产生保守诊断 |
|
|
59
|
+
| 无 layer、重复处理 | 不重排无 layer 输入;同 Root、序列化重读与处理器复用稳定 |
|
|
60
|
+
| 跨层不同 specificity | 潜在冲突诊断;顺序展开不能等价模拟任意 CSS cascade |
|
|
61
|
+
|
|
62
|
+
普通和 important 分别分析属性及 selector list 的权重倒置。属性名通过 tokenizer 解码,自定义属性继续区分大小写;别名归一后简写展开长写,逻辑/物理属性、reset shorthand 与未知属性保守处理。选择器是否相交、条件是否互斥不会被静态证明,因此诊断可能包含保守误报;strict 适用于愿意调整这类输入的消费者。
|
|
63
|
+
|
|
64
|
+
任何未展开的 import、`revert-layer`、nesting、非法层名、未消费的条件编译控制注释和明确 polyfilled 的输入始终报错;这些输入不能靠将 onConflict 改为 warning 放行。字符串和 URL 中的同名字样不被当作语法。
|
|
65
|
+
|
|
66
|
+
## 诊断
|
|
67
|
+
|
|
68
|
+
诊断包含 `code`、`severity`、`message`、`suggestion`、`source`,以及可用的 `related`、`layer`、`selector`、`property`。source 包含可用的 file/line/column,人工创建且没有 source 的节点不会伪造位置。
|
|
69
|
+
|
|
70
|
+
| code | 含义 |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| `LAYER_OPTIONS` | API 选项非法 |
|
|
73
|
+
| `LAYER_INPUT_STAGE` | 来源明确已被 polyfill |
|
|
74
|
+
| `LAYER_IMPORT` | 未展开 import 或不合法的 prologue 位置 |
|
|
75
|
+
| `LAYER_REVERT` | 输入包含 revert-layer |
|
|
76
|
+
| `LAYER_NESTING` | 尚未展开的 nesting 或不合法声明位置 |
|
|
77
|
+
| `LAYER_NAME` | 层名或声明列表非法 |
|
|
78
|
+
| `LAYER_PREPROCESSOR` | 未消费条件编译控制注释 |
|
|
79
|
+
| `LAYER_CONDITIONAL_ORDER` | 条件中的首次层注册 |
|
|
80
|
+
| `LAYER_SPECIFICITY` | 跨层潜在权重倒置 |
|
|
81
|
+
| `LAYER_SELECTOR_UNKNOWN` | 无法可靠分析的选择器 |
|
|
82
|
+
| `LAYER_DESCRIPTOR_ORDER` | 跨层同名 descriptor 需要验证 |
|
|
83
|
+
| `LAYER_WRAPPER_SEMANTICS` | 不可证明等价的作用域/未知包装规则 |
|
|
84
|
+
|
|
85
|
+
## 作用域与迁移
|
|
86
|
+
|
|
87
|
+
一个 Root 只代表一个已合并的级联作用域。按真实 import/build graph 合并输入后再编译;app/page/component 样式隔离、独立分包和多目标分别建立模型。调用者拥有图关系、HMR 失效和缓存,内核每次调用独立持有状态。
|
|
88
|
+
|
|
89
|
+
现有 `@weapp-tailwindcss/postcss/transform` 的 `consumeCascadeLayers(root)` 转导出 `/legacy`,保持旧 anchor 行为,包括原来的语义限制。新 ordered API 不替换线上默认策略;Web 默认为原生层保留。Tailwind preflight/theme/components 标记、Panda codec/recipe/runtime 继续由对应 adapter 负责。
|
|
90
|
+
|
|
91
|
+
Panda 2.1.2 应关闭生成器 polyfill,将生成 CSS 交给本包的公开插件;本期提供隔离 tarball 消费测试,不修改 Panda 仓库。后续再逐项提取 selector、变量、单位和颜色能力。
|
|
92
|
+
|
|
93
|
+
## 验证
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
pnpm --filter @weapp-tailwindcss/css-compat build
|
|
97
|
+
pnpm --filter @weapp-tailwindcss/css-compat test
|
|
98
|
+
pnpm --filter @weapp-tailwindcss/css-compat typecheck
|
|
99
|
+
pnpm --filter @weapp-tailwindcss/css-compat properties:check
|
|
100
|
+
pnpm --filter @weapp-tailwindcss/css-compat test:package
|
|
101
|
+
pnpm --filter @weapp-tailwindcss/css-compat test:consumers
|
|
102
|
+
pnpm --filter @weapp-tailwindcss/css-compat test:browser
|
|
103
|
+
pnpm --filter @weapp-tailwindcss/css-compat bench
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
消费测试先构建本 worktree 的 PostCSS 及生成引擎依赖;浏览器测试需要当前 Playwright 对应的 Chromium、Firefox、WebKit 二进制,缺失时失败,不静默 skip。三个引擎依次后台运行,均定向释放 browser/context/page。包级证据不代表真实微信或全平台验收。属性映射由固定 `mdn-data@2.37.2`(CC0-1.0)生成,运行 `properties:generate` 更新。
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
本包构建产物包含以下依赖的代码;精简属性表来自 mdn-data@2.37.2(CC0-1.0)。
|
|
2
|
+
MDN 来源:https://github.com/mdn/data
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@csstools/css-tokenizer@4.0.2 (MIT)
|
|
6
|
+
|
|
7
|
+
The MIT License (MIT)
|
|
8
|
+
|
|
9
|
+
Copyright 2022 Romain Menke, Antonio Laguna <antonio@laguna.es>
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
12
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
13
|
+
the Software without restriction, including without limitation the rights to
|
|
14
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
15
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
16
|
+
subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
23
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
24
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
25
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
26
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@csstools/selector-specificity@6.0.1 (MIT-0)
|
|
30
|
+
|
|
31
|
+
MIT No Attribution (MIT-0)
|
|
32
|
+
|
|
33
|
+
Copyright © CSSTools Contributors
|
|
34
|
+
|
|
35
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
36
|
+
this software and associated documentation files (the “Software”), to deal in
|
|
37
|
+
the Software without restriction, including without limitation the rights to
|
|
38
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
39
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
40
|
+
so.
|
|
41
|
+
|
|
42
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
47
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
48
|
+
SOFTWARE.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
postcss-selector-parser@7.1.6 (MIT)
|
|
52
|
+
|
|
53
|
+
Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
|
|
54
|
+
|
|
55
|
+
Permission is hereby granted, free of charge, to any person
|
|
56
|
+
obtaining a copy of this software and associated documentation
|
|
57
|
+
files (the "Software"), to deal in the Software without
|
|
58
|
+
restriction, including without limitation the rights to use,
|
|
59
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
60
|
+
copies of the Software, and to permit persons to whom the
|
|
61
|
+
Software is furnished to do so, subject to the following
|
|
62
|
+
conditions:
|
|
63
|
+
|
|
64
|
+
The above copyright notice and this permission notice shall be
|
|
65
|
+
included in all copies or substantial portions of the Software.
|
|
66
|
+
|
|
67
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
68
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
69
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
70
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
71
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
72
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
73
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
74
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
cssesc@3.0.0 (MIT)
|
|
78
|
+
|
|
79
|
+
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
|
80
|
+
|
|
81
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
82
|
+
a copy of this software and associated documentation files (the
|
|
83
|
+
"Software"), to deal in the Software without restriction, including
|
|
84
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
85
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
86
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
87
|
+
the following conditions:
|
|
88
|
+
|
|
89
|
+
The above copyright notice and this permission notice shall be
|
|
90
|
+
included in all copies or substantial portions of the Software.
|
|
91
|
+
|
|
92
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
93
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
94
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
95
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
96
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
97
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
98
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
util-deprecate@1.0.2 (MIT)
|
|
102
|
+
|
|
103
|
+
(The MIT License)
|
|
104
|
+
|
|
105
|
+
Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
|
|
106
|
+
|
|
107
|
+
Permission is hereby granted, free of charge, to any person
|
|
108
|
+
obtaining a copy of this software and associated documentation
|
|
109
|
+
files (the "Software"), to deal in the Software without
|
|
110
|
+
restriction, including without limitation the rights to use,
|
|
111
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
112
|
+
copies of the Software, and to permit persons to whom the
|
|
113
|
+
Software is furnished to do so, subject to the following
|
|
114
|
+
conditions:
|
|
115
|
+
|
|
116
|
+
The above copyright notice and this permission notice shall be
|
|
117
|
+
included in all copies or substantial portions of the Software.
|
|
118
|
+
|
|
119
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
120
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
121
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
122
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
123
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
124
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
125
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
126
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/diagnostics.ts
|
|
3
|
+
/** 编译失败的诊断集合;失败时调用者的 Root 保持完整。 */
|
|
4
|
+
var CascadeLayerError = class extends Error {
|
|
5
|
+
diagnostics;
|
|
6
|
+
constructor(diagnostics) {
|
|
7
|
+
super(diagnostics.map((item) => `[${item.code}] ${item.message}`).join("\n"));
|
|
8
|
+
this.name = "CascadeLayerError";
|
|
9
|
+
this.diagnostics = [...diagnostics];
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.CascadeLayerError = CascadeLayerError;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/diagnostics.d.ts
|
|
2
|
+
export type CascadeLayerDiagnosticCode = 'LAYER_OPTIONS' | 'LAYER_INPUT_STAGE' | 'LAYER_IMPORT' | 'LAYER_REVERT' | 'LAYER_NESTING' | 'LAYER_NAME' | 'LAYER_PREPROCESSOR' | 'LAYER_CONDITIONAL_ORDER' | 'LAYER_SPECIFICITY' | 'LAYER_SELECTOR_UNKNOWN' | 'LAYER_DESCRIPTOR_ORDER' | 'LAYER_WRAPPER_SEMANTICS';
|
|
3
|
+
export interface CascadeLayerSource {
|
|
4
|
+
file?: string | undefined;
|
|
5
|
+
line?: number | undefined;
|
|
6
|
+
column?: number | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface CascadeLayerDiagnostic {
|
|
9
|
+
code: CascadeLayerDiagnosticCode;
|
|
10
|
+
severity: 'warning' | 'error';
|
|
11
|
+
message: string;
|
|
12
|
+
suggestion: string;
|
|
13
|
+
source: CascadeLayerSource;
|
|
14
|
+
related?: CascadeLayerSource | undefined;
|
|
15
|
+
layer?: string | undefined;
|
|
16
|
+
selector?: string | undefined;
|
|
17
|
+
property?: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
/** 编译失败的诊断集合;失败时调用者的 Root 保持完整。 */
|
|
20
|
+
export declare class CascadeLayerError extends Error {
|
|
21
|
+
readonly diagnostics: readonly CascadeLayerDiagnostic[];
|
|
22
|
+
constructor(diagnostics: readonly CascadeLayerDiagnostic[]);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/diagnostics.d.ts
|
|
2
|
+
export type CascadeLayerDiagnosticCode = 'LAYER_OPTIONS' | 'LAYER_INPUT_STAGE' | 'LAYER_IMPORT' | 'LAYER_REVERT' | 'LAYER_NESTING' | 'LAYER_NAME' | 'LAYER_PREPROCESSOR' | 'LAYER_CONDITIONAL_ORDER' | 'LAYER_SPECIFICITY' | 'LAYER_SELECTOR_UNKNOWN' | 'LAYER_DESCRIPTOR_ORDER' | 'LAYER_WRAPPER_SEMANTICS';
|
|
3
|
+
export interface CascadeLayerSource {
|
|
4
|
+
file?: string | undefined;
|
|
5
|
+
line?: number | undefined;
|
|
6
|
+
column?: number | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface CascadeLayerDiagnostic {
|
|
9
|
+
code: CascadeLayerDiagnosticCode;
|
|
10
|
+
severity: 'warning' | 'error';
|
|
11
|
+
message: string;
|
|
12
|
+
suggestion: string;
|
|
13
|
+
source: CascadeLayerSource;
|
|
14
|
+
related?: CascadeLayerSource | undefined;
|
|
15
|
+
layer?: string | undefined;
|
|
16
|
+
selector?: string | undefined;
|
|
17
|
+
property?: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
/** 编译失败的诊断集合;失败时调用者的 Root 保持完整。 */
|
|
20
|
+
export declare class CascadeLayerError extends Error {
|
|
21
|
+
readonly diagnostics: readonly CascadeLayerDiagnostic[];
|
|
22
|
+
constructor(diagnostics: readonly CascadeLayerDiagnostic[]);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/diagnostics.ts
|
|
2
|
+
/** 编译失败的诊断集合;失败时调用者的 Root 保持完整。 */
|
|
3
|
+
var CascadeLayerError = class extends Error {
|
|
4
|
+
diagnostics;
|
|
5
|
+
constructor(diagnostics) {
|
|
6
|
+
super(diagnostics.map((item) => `[${item.code}] ${item.message}`).join("\n"));
|
|
7
|
+
this.name = "CascadeLayerError";
|
|
8
|
+
this.diagnostics = [...diagnostics];
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { CascadeLayerError };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_diagnostics = require("./diagnostics.cjs");
|
|
3
|
+
const require_layers = require("./layers-CT2GtJgP.cjs");
|
|
4
|
+
exports.CascadeLayerError = require_diagnostics.CascadeLayerError;
|
|
5
|
+
exports.compileCascadeLayers = require_layers.compileCascadeLayers;
|
|
6
|
+
exports.createCascadeLayersPlugin = require_layers.createCascadeLayersPlugin;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CascadeLayerDiagnostic, CascadeLayerDiagnosticCode, CascadeLayerError, CascadeLayerSource } from "./diagnostics.cjs";
|
|
2
|
+
import { CascadeLayerCompilation, CascadeLayerOptions, compileCascadeLayers, createCascadeLayersPlugin } from "./layers.cjs";
|
|
3
|
+
export { type CascadeLayerCompilation, type CascadeLayerDiagnostic, type CascadeLayerDiagnosticCode, CascadeLayerError, type CascadeLayerOptions, type CascadeLayerSource, compileCascadeLayers, createCascadeLayersPlugin };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CascadeLayerDiagnostic, CascadeLayerDiagnosticCode, CascadeLayerError, CascadeLayerSource } from "./diagnostics.mjs";
|
|
2
|
+
import { CascadeLayerCompilation, CascadeLayerOptions, compileCascadeLayers, createCascadeLayersPlugin } from "./layers.mjs";
|
|
3
|
+
export { type CascadeLayerCompilation, type CascadeLayerDiagnostic, type CascadeLayerDiagnosticCode, CascadeLayerError, type CascadeLayerOptions, type CascadeLayerSource, compileCascadeLayers, createCascadeLayersPlugin };
|
package/dist/index.mjs
ADDED