@web-baseline/nuxt-css-layer 0.1.0 → 1.0.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/README.md +92 -7
- package/README.zh-CN.md +92 -7
- package/dist/module.d.mts +11 -8
- package/dist/module.json +3 -3
- package/dist/module.mjs +28 -15
- package/dist/types.d.mts +2 -15
- package/package.json +29 -22
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -14
- package/dist/types.d.ts +0 -16
package/README.md
CHANGED
|
@@ -2,20 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
[![npm version][npm-version-src]][npm-version-href]
|
|
4
4
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
+
[![Codecov][codecov-src]][codecov-href]
|
|
5
6
|
[![License][license-src]][license-href]
|
|
6
7
|
[![Nuxt][nuxt-src]][nuxt-href]
|
|
7
8
|
|
|
8
9
|
_✨ Use css cascade layers in Nuxt ✨_
|
|
9
10
|
|
|
11
|
+
> Compatible with Nuxt 4.
|
|
12
|
+
|
|
10
13
|
- [✨ Release Notes](/CHANGELOG.md)
|
|
11
14
|
|
|
12
15
|
**English** | [简体中文](./README.zh-CN.md)
|
|
13
16
|
|
|
14
17
|
## Features
|
|
15
18
|
|
|
16
|
-
- Add
|
|
17
|
-
-
|
|
18
|
-
- CSS
|
|
19
|
+
- Add layer names to imported CSS files via `?layer=` query
|
|
20
|
+
- In Vue SFC, `<style layer="...">` is handled through the corresponding `?layer=` style request query
|
|
21
|
+
- Add layer names to matched CSS files with rule-based mapping
|
|
22
|
+
- Sort cascade layers globally via server-side injected `@layer` order
|
|
19
23
|
|
|
20
24
|
## Quick Setup
|
|
21
25
|
|
|
@@ -27,17 +31,95 @@ npx nuxi module add @web-baseline/nuxt-css-layer
|
|
|
27
31
|
|
|
28
32
|
That's it! You can now use css cascade layers in your Nuxt app ✨
|
|
29
33
|
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
### 1) Configure the module
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
// nuxt.config.ts
|
|
40
|
+
export default defineNuxtConfig({
|
|
41
|
+
modules: ['@web-baseline/nuxt-css-layer'],
|
|
42
|
+
cssLayer: {
|
|
43
|
+
rules: [
|
|
44
|
+
{
|
|
45
|
+
includes: /^node_modules\/element-plus/,
|
|
46
|
+
layerName: 'element-plus',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
cssLayerOrder: ['base', 'element-plus', 'app'],
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 2) Add layer by import query
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
// app.vue / any entry file
|
|
58
|
+
import './theme.css?layer=base'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 3) Add layer in Vue SFC style block
|
|
62
|
+
|
|
63
|
+
```vue
|
|
64
|
+
<style scoped layer="app">
|
|
65
|
+
.app-root {
|
|
66
|
+
color: red;
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
With default `importQuery: true`, this module reads `layer` query from SFC style requests, so using the `layer` attribute in `<style>` works directly.
|
|
72
|
+
|
|
73
|
+
### Known issue (SFC `layer` without value)
|
|
74
|
+
|
|
75
|
+
When using `<style layer>` in SFC (without an explicit layer name), Vite style request id generation converts it to `layer=true`.
|
|
76
|
+
|
|
77
|
+
Because query parsing cannot distinguish boolean and string in this case, a layer named `true` will be generated.
|
|
78
|
+
|
|
79
|
+
If you need an anonymous layer, set the layer name to a single space:
|
|
80
|
+
|
|
81
|
+
```vue
|
|
82
|
+
<style layer=" ">
|
|
83
|
+
/* anonymous layer */
|
|
84
|
+
</style>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 4) Optional: enforce global layer order
|
|
88
|
+
|
|
89
|
+
When `cssLayerOrder` is provided, this module injects the following into SSR `<head>`:
|
|
90
|
+
|
|
91
|
+
```css
|
|
92
|
+
@layer base, element-plus, app;
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
This ensures deterministic cascade order across your app and third-party styles.
|
|
96
|
+
|
|
30
97
|
|
|
31
98
|
### Options
|
|
32
99
|
|
|
33
100
|
| Option | Description | Type | Default |
|
|
34
101
|
| ------------------ | ---------------------------------------------------------------------------------------------------------------- | --------------------------------- | ----------- |
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
| ignoreOnlyComments | Ignore files that only contain comments (refer to [`@web-baseline/postcss-wrap-up-layer`](https://github.com/web-baseline/postcss-wrap-up-layer?tab=readme-ov-file#options-type)) | -- | -- |
|
|
102
|
+
| importQuery | Enable `?layer=` query parsing (controls both normal CSS imports and SFC `<style layer="...">` processing) | `boolean` | `true` |
|
|
103
|
+
| rules | Rule-based CSS mapping to layer names (from [`@web-baseline/postcss-wrap-up-layer`](https://github.com/web-baseline/postcss-wrap-up-layer#options-type)) | `PostcssWrapUpLayerOptions['rules']` | `[]` |
|
|
104
|
+
| ignoreOnlyComments | Ignore files that only contain comments (forwarded to `postcss-wrap-up-layer`) | `boolean \| undefined` | `undefined` |
|
|
39
105
|
| cssLayerOrder | Cascade layer sorting | `string \| string[] \| undefined` | `undefined` |
|
|
40
106
|
|
|
107
|
+
## How it works
|
|
108
|
+
|
|
109
|
+
- `importQuery` adds a PostCSS plugin that reads `layer` from import query, for example `a.css?layer=base`.
|
|
110
|
+
- SFC `<style layer="...">` follows the same `?layer=` query parsing path, so it is also controlled by the `importQuery` switch.
|
|
111
|
+
- `rules` adds another PostCSS plugin instance for path-based mapping.
|
|
112
|
+
- `cssLayerOrder` creates a Nitro server plugin to inject `@layer ...;` into SSR HTML head.
|
|
113
|
+
|
|
114
|
+
## Development
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pnpm dev # run playground
|
|
118
|
+
pnpm lint # eslint
|
|
119
|
+
pnpm test # unit + e2e tests
|
|
120
|
+
pnpm build # full build pipeline
|
|
121
|
+
```
|
|
122
|
+
|
|
41
123
|
|
|
42
124
|
|
|
43
125
|
<!-- Badges -->
|
|
@@ -47,6 +129,9 @@ That's it! You can now use css cascade layers in your Nuxt app ✨
|
|
|
47
129
|
[npm-downloads-src]: https://img.shields.io/npm/dm/@web-baseline/nuxt-css-layer.svg?style=flat&colorA=020420&colorB=00DC82
|
|
48
130
|
[npm-downloads-href]: https://npmjs.com/package/@web-baseline/nuxt-css-layer
|
|
49
131
|
|
|
132
|
+
[codecov-src]: https://img.shields.io/codecov/c/github/web-baseline/nuxt-css-layer?style=flat&colorA=020420&colorB=00DC82
|
|
133
|
+
[codecov-href]: https://codecov.io/gh/web-baseline/nuxt-css-layer
|
|
134
|
+
|
|
50
135
|
[license-src]: https://img.shields.io/npm/l/@web-baseline/nuxt-css-layer.svg?style=flat&colorA=020420&colorB=00DC82
|
|
51
136
|
[license-href]: https://npmjs.com/package/@web-baseline/nuxt-css-layer
|
|
52
137
|
|
package/README.zh-CN.md
CHANGED
|
@@ -2,20 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
[![npm version][npm-version-src]][npm-version-href]
|
|
4
4
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
+
[![Codecov][codecov-src]][codecov-href]
|
|
5
6
|
[![License][license-src]][license-href]
|
|
6
7
|
[![Nuxt][nuxt-src]][nuxt-href]
|
|
7
8
|
|
|
8
9
|
_✨ 在 Nuxt 中使用 CSS 级联层 ✨_
|
|
9
10
|
|
|
11
|
+
> 兼容 Nuxt 4。
|
|
12
|
+
|
|
10
13
|
- [✨ Release Notes](/CHANGELOG.md)
|
|
11
14
|
|
|
12
15
|
[English](./README.md) | **简体中文**
|
|
13
16
|
|
|
14
17
|
## 特性
|
|
15
18
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
- CSS
|
|
19
|
+
- 通过 `?layer=` 查询参数为导入的 CSS 指定层名
|
|
20
|
+
- 在 Vue 单文件组件中,`<style layer="...">` 会被转换为对应的 `?layer=` 请求参数后处理
|
|
21
|
+
- 通过规则匹配(`rules`)批量为 CSS 文件分配层名
|
|
22
|
+
- 通过服务端注入的 `@layer` 声明统一层级顺序
|
|
19
23
|
|
|
20
24
|
## 快速开始
|
|
21
25
|
|
|
@@ -27,17 +31,95 @@ npx nuxi module add @web-baseline/nuxt-css-layer
|
|
|
27
31
|
|
|
28
32
|
就是这样!现在,您可以在 Nuxt 应用程序中使用 CSS 级联层 ✨
|
|
29
33
|
|
|
34
|
+
## 使用方式
|
|
35
|
+
|
|
36
|
+
### 1)配置模块
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
// nuxt.config.ts
|
|
40
|
+
export default defineNuxtConfig({
|
|
41
|
+
modules: ['@web-baseline/nuxt-css-layer'],
|
|
42
|
+
cssLayer: {
|
|
43
|
+
rules: [
|
|
44
|
+
{
|
|
45
|
+
includes: /^node_modules\/element-plus/,
|
|
46
|
+
layerName: 'element-plus',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
cssLayerOrder: ['base', 'element-plus', 'app'],
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 2)通过导入查询参数声明层
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
// app.vue / 任意入口文件
|
|
58
|
+
import './theme.css?layer=base'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 3)在 Vue SFC 的 style 块声明层
|
|
62
|
+
|
|
63
|
+
```vue
|
|
64
|
+
<style scoped layer="app">
|
|
65
|
+
.app-root {
|
|
66
|
+
color: red;
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`importQuery` 默认开启时,会识别 SFC style 请求中的 `layer` 查询参数,因此可直接在 `<style>` 块上使用 `layer` 属性。
|
|
72
|
+
|
|
73
|
+
### 已知问题(SFC `layer` 空属性)
|
|
74
|
+
|
|
75
|
+
当在 SFC 中使用 `<style layer>`(未显式指定层名)时,受 Vite 生成 style 请求 id 的方式影响,会被转换为 `layer=true`。
|
|
76
|
+
|
|
77
|
+
由于查询参数中无法区分字符串与布尔值,该场景下最终会生成名为 `true` 的级联层。
|
|
78
|
+
|
|
79
|
+
如果你期望生成匿名层,请将层名设置为单个空格:
|
|
80
|
+
|
|
81
|
+
```vue
|
|
82
|
+
<style layer=" ">
|
|
83
|
+
/* anonymous layer */
|
|
84
|
+
</style>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 4)可选:统一全局层顺序
|
|
88
|
+
|
|
89
|
+
当配置了 `cssLayerOrder` 后,模块会在 SSR 的 `<head>` 中注入:
|
|
90
|
+
|
|
91
|
+
```css
|
|
92
|
+
@layer base, element-plus, app;
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
这样可以确保应用样式与三方库样式的层叠顺序稳定可控。
|
|
96
|
+
|
|
30
97
|
|
|
31
98
|
### 配置
|
|
32
99
|
|
|
33
100
|
| 配置项 | 描述 | 类型 | 默认值 |
|
|
34
101
|
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | ----------- |
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
| ignoreOnlyComments | 是否忽略仅包含注释的文件(参考[`@web-baseline/postcss-wrap-up-layer`](https://github.com/web-baseline/postcss-wrap-up-layer/blob/main/README.zh-CN.md#%E9%80%89%E9%A1%B9%E7%B1%BB%E5%9E%8B)) | -- | -- |
|
|
102
|
+
| importQuery | 是否启用对 `?layer=` 的解析(同时控制普通 CSS 导入与 SFC `<style layer="...">` 的层处理) | `boolean` | `true` |
|
|
103
|
+
| rules | 基于规则将 CSS 文件映射到层名(继承 [`@web-baseline/postcss-wrap-up-layer`](https://github.com/web-baseline/postcss-wrap-up-layer/blob/main/README.zh-CN.md#选项类型) 的 `rules`) | `PostcssWrapUpLayerOptions['rules']` | `[]` |
|
|
104
|
+
| ignoreOnlyComments | 是否忽略仅包含注释的文件(透传给 `postcss-wrap-up-layer`) | `boolean \| undefined` | `undefined` |
|
|
39
105
|
| cssLayerOrder | 级联层排序 | `string \| string[] \| undefined` | `undefined` |
|
|
40
106
|
|
|
107
|
+
## 工作原理
|
|
108
|
+
|
|
109
|
+
- `importQuery`:注册 PostCSS 插件,从导入查询参数读取 `layer`(例如 `a.css?layer=base`)。
|
|
110
|
+
- SFC 的 `<style layer="...">` 也会落到同一条 `?layer=` 查询参数解析链路,因此同样受 `importQuery` 开关控制。
|
|
111
|
+
- `rules`:额外注册一组基于文件路径匹配的 PostCSS 规则。
|
|
112
|
+
- `cssLayerOrder`:生成 Nitro 服务端插件,在 SSR HTML 头部注入 `@layer` 声明。
|
|
113
|
+
|
|
114
|
+
## 本地开发
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pnpm dev # 运行 playground
|
|
118
|
+
pnpm lint # ESLint 校验
|
|
119
|
+
pnpm test # 单元 + e2e 测试
|
|
120
|
+
pnpm build # 完整构建流程
|
|
121
|
+
```
|
|
122
|
+
|
|
41
123
|
|
|
42
124
|
|
|
43
125
|
<!-- Badges -->
|
|
@@ -47,6 +129,9 @@ npx nuxi module add @web-baseline/nuxt-css-layer
|
|
|
47
129
|
[npm-downloads-src]: https://img.shields.io/npm/dm/@web-baseline/nuxt-css-layer.svg?style=flat&colorA=020420&colorB=00DC82
|
|
48
130
|
[npm-downloads-href]: https://npmjs.com/package/@web-baseline/nuxt-css-layer
|
|
49
131
|
|
|
132
|
+
[codecov-src]: https://img.shields.io/codecov/c/github/web-baseline/nuxt-css-layer?style=flat&colorA=020420&colorB=00DC82
|
|
133
|
+
[codecov-href]: https://codecov.io/gh/web-baseline/nuxt-css-layer
|
|
134
|
+
|
|
50
135
|
[license-src]: https://img.shields.io/npm/l/@web-baseline/nuxt-css-layer.svg?style=flat&colorA=020420&colorB=00DC82
|
|
51
136
|
[license-href]: https://npmjs.com/package/@web-baseline/nuxt-css-layer
|
|
52
137
|
|
package/dist/module.d.mts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { PluginOptions
|
|
3
|
-
import { PluginOptions } from '@web-baseline/vite-plugin-vue-style-layer';
|
|
2
|
+
import { PluginOptions } from '@web-baseline/postcss-wrap-up-layer';
|
|
4
3
|
|
|
5
4
|
interface ModuleOptions {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
ignoreOnlyComments?: PluginOptions$1['ignoreOnlyComments'];
|
|
5
|
+
importQuery: boolean;
|
|
6
|
+
rules: PluginOptions['rules'];
|
|
7
|
+
ignoreOnlyComments?: PluginOptions['ignoreOnlyComments'];
|
|
10
8
|
cssLayerOrder?: string | string[];
|
|
11
9
|
}
|
|
12
|
-
|
|
10
|
+
interface QueryWithLayer {
|
|
11
|
+
type?: 'script' | 'template' | 'style' | 'custom';
|
|
12
|
+
layer?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
13
15
|
|
|
14
|
-
export {
|
|
16
|
+
export { _default as default };
|
|
17
|
+
export type { ModuleOptions, QueryWithLayer };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,39 +1,52 @@
|
|
|
1
1
|
import { defineNuxtModule, addVitePlugin, addTemplate, addServerPlugin } from '@nuxt/kit';
|
|
2
2
|
import WrapUpLayer from '@web-baseline/postcss-wrap-up-layer';
|
|
3
|
-
import VueStyleLayer from '@web-baseline/vite-plugin-vue-style-layer';
|
|
4
3
|
|
|
5
|
-
const module = defineNuxtModule({
|
|
4
|
+
const module$1 = defineNuxtModule({
|
|
6
5
|
meta: {
|
|
7
6
|
name: "nuxt-css-layer",
|
|
8
7
|
configKey: "cssLayer"
|
|
9
8
|
},
|
|
10
9
|
defaults: {
|
|
11
|
-
|
|
10
|
+
importQuery: true,
|
|
12
11
|
rules: []
|
|
13
12
|
},
|
|
14
13
|
setup(options) {
|
|
14
|
+
const plugins = [];
|
|
15
|
+
if (options.importQuery) {
|
|
16
|
+
plugins.push(WrapUpLayer({
|
|
17
|
+
rules: [
|
|
18
|
+
{
|
|
19
|
+
map: (relativeId) => {
|
|
20
|
+
const [, rawQuery] = relativeId.split(`?`, 2);
|
|
21
|
+
const query = Object.fromEntries(new URLSearchParams(rawQuery));
|
|
22
|
+
if (typeof query.layer === "string") {
|
|
23
|
+
return query.layer;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
ignoreOnlyComments: options.ignoreOnlyComments
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
15
32
|
if (options.rules.length > 0) {
|
|
33
|
+
plugins.push(WrapUpLayer({
|
|
34
|
+
rules: options.rules,
|
|
35
|
+
ignoreOnlyComments: options.ignoreOnlyComments
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
if (plugins.length > 0) {
|
|
16
39
|
addVitePlugin({
|
|
17
40
|
name: "vite-plugin-nuxt-css-layer--postcss",
|
|
18
41
|
config: () => ({
|
|
19
42
|
css: {
|
|
20
43
|
postcss: {
|
|
21
|
-
plugins
|
|
22
|
-
WrapUpLayer({
|
|
23
|
-
rules: options.rules,
|
|
24
|
-
ignoreOnlyComments: options.ignoreOnlyComments
|
|
25
|
-
})
|
|
26
|
-
]
|
|
44
|
+
plugins
|
|
27
45
|
}
|
|
28
46
|
}
|
|
29
47
|
})
|
|
30
48
|
});
|
|
31
49
|
}
|
|
32
|
-
if (options.sfc) {
|
|
33
|
-
addVitePlugin(VueStyleLayer({
|
|
34
|
-
includes: options.sfcIncludes
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
50
|
if (options.cssLayerOrder) {
|
|
38
51
|
const plugin = addTemplate({
|
|
39
52
|
filename: "nuxt-css-layer/css-layers.ts",
|
|
@@ -54,4 +67,4 @@ export default defineNitroPlugin((nitro) => {
|
|
|
54
67
|
}
|
|
55
68
|
});
|
|
56
69
|
|
|
57
|
-
export { module as default };
|
|
70
|
+
export { module$1 as default };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
+
export { default } from './module.mjs'
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare module '@nuxt/schema' {
|
|
6
|
-
interface NuxtConfig { ['cssLayer']?: Partial<ModuleOptions> }
|
|
7
|
-
interface NuxtOptions { ['cssLayer']?: ModuleOptions }
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare module 'nuxt/schema' {
|
|
11
|
-
interface NuxtConfig { ['cssLayer']?: Partial<ModuleOptions> }
|
|
12
|
-
interface NuxtOptions { ['cssLayer']?: ModuleOptions }
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export type { ModuleOptions, default } from './module.js'
|
|
3
|
+
export { type ModuleOptions, type QueryWithLayer } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@web-baseline/nuxt-css-layer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Use css cascade layers in Nuxt",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"types": "./dist/
|
|
10
|
-
"import": "./dist/module.mjs"
|
|
11
|
-
"require": "./dist/module.cjs"
|
|
9
|
+
"types": "./dist/module.d.mts",
|
|
10
|
+
"import": "./dist/module.mjs"
|
|
12
11
|
}
|
|
13
12
|
},
|
|
14
|
-
"main": "./dist/module.
|
|
15
|
-
"types": "./dist/types.d.ts",
|
|
13
|
+
"main": "./dist/module.mjs",
|
|
16
14
|
"files": [
|
|
17
15
|
"dist"
|
|
18
16
|
],
|
|
@@ -27,41 +25,50 @@
|
|
|
27
25
|
"nuxt-module"
|
|
28
26
|
],
|
|
29
27
|
"scripts": {
|
|
28
|
+
"prepare": "nuxt-module-build prepare",
|
|
30
29
|
"prepack": "nuxt-module-build build",
|
|
31
30
|
"dev": "nuxi dev playground",
|
|
32
31
|
"dev:build": "nuxi build playground",
|
|
33
32
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
34
|
-
"release": "
|
|
35
|
-
"build": "
|
|
33
|
+
"release": "pnpm build && pnpm publish && git push --follow-tags",
|
|
34
|
+
"build": "pnpm dev:prepare && pnpm lint && pnpm test && pnpm prepack",
|
|
36
35
|
"lint": "eslint .",
|
|
37
|
-
"test": "vitest run",
|
|
38
|
-
"test:
|
|
36
|
+
"test": "nuxi prepare test/fixtures/basic && vitest run",
|
|
37
|
+
"test:coverage": "nuxi prepare test/fixtures/basic && vitest run --coverage",
|
|
38
|
+
"test:watch": "nuxi prepare test/fixtures/basic && vitest watch",
|
|
39
39
|
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"author": "TM-SunnyDay <sunnyday@chongying.studio> (https://github.com/TM-SunnyDay/)",
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|
|
44
|
-
"url": "git+https://github.com/web-baseline/nuxt-css-layer"
|
|
44
|
+
"url": "git+https://github.com/web-baseline/nuxt-css-layer.git"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@nuxt/kit": "^
|
|
48
|
-
"@web-baseline/postcss-wrap-up-layer": "^0.
|
|
49
|
-
"@web-baseline/vite-plugin-vue-style-layer": "^0.1.0"
|
|
47
|
+
"@nuxt/kit": "^4.4.2",
|
|
48
|
+
"@web-baseline/postcss-wrap-up-layer": "^0.3.0"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
51
|
"@element-plus/nuxt": "^1.0.9",
|
|
53
|
-
"@nuxt/
|
|
54
|
-
"@nuxt/
|
|
55
|
-
"@nuxt/
|
|
56
|
-
"@nuxt/
|
|
57
|
-
"@nuxt/test-utils": "^3.12.1",
|
|
52
|
+
"@nuxt/eslint-config": "^1.15.2",
|
|
53
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
54
|
+
"@nuxt/schema": "^4.4.2",
|
|
55
|
+
"@nuxt/test-utils": "^4.0.0",
|
|
58
56
|
"@types/node": "^20.12.11",
|
|
59
|
-
"
|
|
57
|
+
"@vitest/coverage-istanbul": "^4.1.0",
|
|
58
|
+
"@vitest/ui": "^4.1.0",
|
|
60
59
|
"element-plus": "^2.7.3",
|
|
61
60
|
"eslint": "^9.2.0",
|
|
62
|
-
"nuxt": "^
|
|
61
|
+
"nuxt": "^4.4.2",
|
|
63
62
|
"typescript": "latest",
|
|
64
|
-
"vitest": "^1.
|
|
63
|
+
"vitest": "^4.1.0",
|
|
65
64
|
"vue-tsc": "^2.0.16"
|
|
65
|
+
},
|
|
66
|
+
"packageManager": "pnpm@10.6.2",
|
|
67
|
+
"pnpm": {
|
|
68
|
+
"onlyBuiltDependencies": [
|
|
69
|
+
"@parcel/watcher",
|
|
70
|
+
"esbuild",
|
|
71
|
+
"unrs-resolver"
|
|
72
|
+
]
|
|
66
73
|
}
|
|
67
74
|
}
|
package/dist/module.cjs
DELETED
package/dist/module.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { PluginOptions as PluginOptions$1 } from '@web-baseline/postcss-wrap-up-layer';
|
|
3
|
-
import { PluginOptions } from '@web-baseline/vite-plugin-vue-style-layer';
|
|
4
|
-
|
|
5
|
-
interface ModuleOptions {
|
|
6
|
-
sfc: boolean;
|
|
7
|
-
sfcIncludes?: PluginOptions['includes'];
|
|
8
|
-
rules: PluginOptions$1['rules'];
|
|
9
|
-
ignoreOnlyComments?: PluginOptions$1['ignoreOnlyComments'];
|
|
10
|
-
cssLayerOrder?: string | string[];
|
|
11
|
-
}
|
|
12
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
13
|
-
|
|
14
|
-
export { type ModuleOptions, _default as default };
|
package/dist/types.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ModuleOptions } from './module'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare module '@nuxt/schema' {
|
|
6
|
-
interface NuxtConfig { ['cssLayer']?: Partial<ModuleOptions> }
|
|
7
|
-
interface NuxtOptions { ['cssLayer']?: ModuleOptions }
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare module 'nuxt/schema' {
|
|
11
|
-
interface NuxtConfig { ['cssLayer']?: Partial<ModuleOptions> }
|
|
12
|
-
interface NuxtOptions { ['cssLayer']?: ModuleOptions }
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export type { ModuleOptions, default } from './module'
|