@lls/vitescripts 2.0.3 → 2.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lls/vitescripts",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "lls vite plugins",
5
5
  "main": "src/index.mjs",
6
6
  "files": [
@@ -11,7 +11,7 @@
11
11
  "prepare": "husky install || true"
12
12
  },
13
13
  "dependencies": {
14
- "lightningcss": "1.21.5"
14
+ "lightningcss": "1.22.0"
15
15
  },
16
16
  "type": "module",
17
17
  "author": "",
@@ -19,6 +19,7 @@
19
19
  "devDependencies": {
20
20
  "@lls/eslint-config-lls": "1.1.12",
21
21
  "@lls/lls-kit": "20.1.0",
22
+ "browserslist": "4.22.1",
22
23
  "husky": "8.0.3",
23
24
  "vitest": "0.34.6"
24
25
  },
package/src/index.mjs CHANGED
@@ -6,3 +6,4 @@ export { default as llsSideRefreshMetaPlugin } from './llsSideRefreshMetaPlugin.
6
6
  export { default as llsVitestMockPlugin } from './llsVitestMockPlugin.mjs'
7
7
  export { default as llsLadlePlugin } from './llsLadlePlugin.mjs'
8
8
  export { default as llsCssModuleMacroPlugin } from './llsCssModuleMacroPlugin.mjs'
9
+ export { default as postBuildAutoprefixerPlugin } from './postBuildAutoprefixerPlugin.mjs'
@@ -29,7 +29,7 @@ const llsCssModuleMacroPlugin = async ({ themeIsFreeMode, themeIsDarkMode, theme
29
29
  }
30
30
  return src
31
31
  .replace(/\${(Body[123]|Heading[123])}/g, (__, cap) => kitBag[cap])
32
- .replace(/\${getFluidSize\({(.*?)}\)}/, (__, cap) => {
32
+ .replace(/\${getFluidSize\({(.*?)}\)}/gs, (__, cap) => {
33
33
  const args = {
34
34
  minViewport: 320, // BREAKPOINT_XXS
35
35
  maxViewport: 1280, // BREAKPOINT_MD
@@ -0,0 +1,14 @@
1
+ import fs from 'fs'
2
+
3
+ const esbuildAutoprefixerPlugin = async ({ from, to }) => {
4
+ const [{ transform, browserslistToTargets }, browserslist] = await Promise.all([import('lightningcss'), import('browserslist').then(m => m.default)])
5
+ const contents = await fs.promises.readFile(from).then(async buf => {
6
+ const {code} = transform({
7
+ code: buf,
8
+ targets: browserslistToTargets(browserslist('cover 99.5%'))
9
+ })
10
+ return code.toString()
11
+ })
12
+ return fs.promises.writeFile(to, contents)
13
+ }
14
+ export default esbuildAutoprefixerPlugin