b13-rocket 0.8.9 → 0.8.10

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 CHANGED
@@ -82,6 +82,11 @@ export const config = definePackageConfig({
82
82
  postcss: {
83
83
  sortMediaQueries: true, // default: true
84
84
  },
85
+ sass: {
86
+ // Optional: silence Dart Sass deprecation warnings per package
87
+ // e.g. "slash-div" (removed in Sass 2.0) and "import" (removed in Sass 3.0)
88
+ silenceDeprecations: silenceDeprecations: ['slash-div', 'import', 'color-functions', 'global-builtin', 'mixed-decls', 'strict-unary'],
89
+ },
85
90
  viteConfig: {
86
91
  // Override Vite config for this package
87
92
  resolve: {
@@ -106,6 +111,18 @@ export const config = definePackageConfig({
106
111
  });
107
112
  ```
108
113
 
114
+ Silence specific Dart Sass deprecation warnings for one package:
115
+
116
+ ```js
117
+ export const config = definePackageConfig({
118
+ name: 'legacy-package',
119
+ // ...
120
+ sass: {
121
+ silenceDeprecations: ['slash-div', 'import', 'color-functions', 'global-builtin', 'mixed-decls', 'strict-unary'],
122
+ },
123
+ });
124
+ ```
125
+
109
126
  ---
110
127
 
111
128
  ## Extract CSS
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export function definePackageConfig({ name = '', input = '', output = '', root = '', viteConfig = {}, postcss = {} }) {
1
+ export function definePackageConfig({ name = '', input = '', output = '', root = '', viteConfig = {}, postcss = {}, sass = {} }) {
2
2
 
3
3
  return {
4
4
  name,
@@ -7,5 +7,6 @@ export function definePackageConfig({ name = '', input = '', output = '', root =
7
7
  root,
8
8
  viteConfig,
9
9
  postcss,
10
+ sass,
10
11
  };
11
12
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "b13-rocket",
3
3
  "description": "FE CLI build tool",
4
- "version": "0.8.9",
4
+ "version": "0.8.10",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=v16.13.0",
package/src/build.js CHANGED
@@ -2,6 +2,18 @@ import { build as viteBuild, defineConfig, mergeConfig , createServer, loadEnv}
2
2
  import { createDefaultViteConfig } from './vite/vite.config.js';
3
3
  import fs from 'node:fs';
4
4
 
5
+ const normalizeSassSilenceDeprecations = (silenceDeprecations) => {
6
+ if (typeof silenceDeprecations === 'string') {
7
+ return [silenceDeprecations];
8
+ }
9
+
10
+ if (!Array.isArray(silenceDeprecations)) {
11
+ return [];
12
+ }
13
+
14
+ return [...new Set(silenceDeprecations.filter(value => typeof value === 'string' && value.length > 0))];
15
+ };
16
+
5
17
  // post process manifest json
6
18
  // remove all css files starting with 'external-' from manifest.json entry file
7
19
  const postProcessManifest = (manifestPath = '') => {
@@ -37,6 +49,7 @@ const postProcessManifest = (manifestPath = '') => {
37
49
  async function vite(config = {}, sharedViteConfig = {}, enableServer = false) {
38
50
  const defaultViteConfig = createDefaultViteConfig({
39
51
  sortMediaQueries: config?.postcss?.sortMediaQueries !== false,
52
+ sassSilenceDeprecations: normalizeSassSilenceDeprecations(config?.sass?.silenceDeprecations),
40
53
  });
41
54
 
42
55
  let viteConfig = mergeConfig(
@@ -76,16 +89,24 @@ async function vite(config = {}, sharedViteConfig = {}, enableServer = false) {
76
89
  viteConfig.mode = 'development';
77
90
 
78
91
  if (process.env.DDEV_PRIMARY_URL !== undefined) {
92
+ const hmrServerDefaults = {
93
+ host: true,
94
+ origin: `${process.env.DDEV_PRIMARY_URL.replace(/:\d+$/, '')}:${vitePort}`,
95
+ cors: {
96
+ origin: /https?:\/\/([A-Za-z0-9\-.]+)?(\.ddev\.site)(?::\d+)?$/,
97
+ },
98
+ };
99
+ const userServerConfig = viteConfig?.server || {};
100
+ const mergedServerConfig = mergeConfig(
101
+ hmrServerDefaults,
102
+ userServerConfig,
103
+ false,
104
+ );
105
+
79
106
  const server = await createServer({
80
107
  ...viteConfig,
81
108
  configFile: false,
82
- server: {
83
- host: true,
84
- origin: `${process.env.DDEV_PRIMARY_URL.replace(/:\d+$/, '')}:${vitePort}`,
85
- cors: {
86
- origin: /https?:\/\/([A-Za-z0-9\-.]+)?(\.ddev\.site)(?::\d+)?$/,
87
- },
88
- },
109
+ server: mergedServerConfig,
89
110
  })
90
111
  await server.listen();
91
112
  console.log(`${config.name} HMR is ready 🚀`);
@@ -11,7 +11,7 @@ import browserslist from 'browserslist';
11
11
  const mode = 'production';
12
12
  const browserslistConfig = browserslist.loadConfig({ path: process.cwd() }) ?? browserslist.defaults
13
13
 
14
- export function createDefaultViteConfig({ sortMediaQueries = true } = {}) {
14
+ export function createDefaultViteConfig({ sortMediaQueries = true, sassSilenceDeprecations = [] } = {}) {
15
15
  return defineConfig({
16
16
  mode,
17
17
  publicDir: false,
@@ -66,6 +66,7 @@ export function createDefaultViteConfig({ sortMediaQueries = true } = {}) {
66
66
  scss: {
67
67
  api: 'modern',
68
68
  additionalData: `$mode: ${mode};`,
69
+ ...(sassSilenceDeprecations.length > 0 ? { silenceDeprecations: sassSilenceDeprecations } : {}),
69
70
  },
70
71
  },
71
72
  },