@haptiq/kit 0.1.1 → 0.2.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/lib/css.js +10 -2
  2. package/package.json +8 -5
package/lib/css.js CHANGED
@@ -8,7 +8,9 @@ import fs from 'fs';
8
8
  import path from 'path';
9
9
  import { globSync } from 'glob';
10
10
  import * as sass from 'sass';
11
- import { transform } from 'lightningcss';
11
+ import { transform, browserslistToTargets } from 'lightningcss';
12
+ import browserslist from 'browserslist';
13
+ import haptiqBrowserslistConfig from '@haptiq/browserslist-config';
12
14
 
13
15
 
14
16
  /**
@@ -25,8 +27,14 @@ import { transform } from 'lightningcss';
25
27
  * @see {@link ../examples/haptiq.config.js} for all available options
26
28
  */
27
29
  async function buildCSS(config = {}, verbose = false) {
30
+ // Use project's own browserslist config if present, otherwise fall back to @haptiq/browserslist-config
31
+ const projectConfig = browserslist.loadConfig({ path: process.cwd() });
32
+ const resolvedTargets = browserslistToTargets(
33
+ browserslist(projectConfig ?? haptiqBrowserslistConfig, { path: process.cwd() })
34
+ );
35
+
28
36
  const defaultLightningConfig = {
29
- targets: { chrome: 80, firefox: 90, safari: 14 },
37
+ targets: resolvedTargets,
30
38
  minify: true,
31
39
  sourceMap: true
32
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haptiq/kit",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Build tools for Haptiq projects.",
5
5
  "keywords": [
6
6
  "build",
@@ -10,20 +10,23 @@
10
10
  ],
11
11
  "author": "Haptiq",
12
12
  "license": "GPL-2.0-or-later",
13
- "homepage": "...",
13
+ "homepage": "https://github.com/haptiq/haptiq-kit/blob/main/packages/kit/README.md",
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "..."
16
+ "url": "git+https://github.com/haptiq/haptiq-kit.git",
17
+ "directory": "packages/kit"
17
18
  },
18
19
  "type": "module",
19
20
  "bin": {
20
21
  "kit": "bin/haptiq.kit.js"
21
22
  },
22
23
  "dependencies": {
24
+ "@haptiq/browserslist-config": "^0.1.0",
25
+ "browserslist": "^4.28.2",
23
26
  "commander": "^15.0.0",
24
- "sass": "^1.101.0",
25
- "lightningcss": "^1.32.0",
26
27
  "glob": "^13.0.6",
28
+ "lightningcss": "^1.32.0",
29
+ "sass": "^1.101.0",
27
30
  "terser": "^5.0.0"
28
31
  },
29
32
  "engines": {