sku 15.12.2 → 15.13.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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # sku
2
2
 
3
+ ## 15.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - `webpack`: Add support for Vite-style query parameters when importing SVG files ([#1538](https://github.com/seek-oss/sku/pull/1538))
8
+
9
+ To support migration from webpack to Vite, SVG imports in webpack now support the same `raw`, `inline` and `url` query parameters as Vite. This allows you to specify how the SVG should be imported: as a raw string, a base64 data URL, or an asset URL. See [the image asset docs] for more information.
10
+
11
+ If your application is still using webpack, it is recommended to run the following codemod to automatically migrate all SVG imports to use the `raw` query parameter:
12
+
13
+ ```sh
14
+ pnpm dlx @sku-lib/codemod svg-import-query-param .
15
+ ```
16
+
17
+ This will ensure consistent SVG import behaviour when the time comes to migrate your application to Vite. The `url` and `inline` query parameters can also be used, however they aren't a drop-in replacement for the existing import behaviour (i.e. without any query paramters).
18
+
19
+ [the image asset docs]: https://seek-oss.github.io/sku/#/./docs/extra-features?id=importing-image-assets
20
+
21
+ ### Patch Changes
22
+
23
+ - `vite`: Align asset inline limit with webpack ([#1538](https://github.com/seek-oss/sku/pull/1538))
24
+
25
+ To align with sku's webpack config, image assets imported in a Vite app that are smaller than 10,000 bytes will now be inlined as base64-encoded [`data` URLs](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data). Previously the limit was 4,096 bytes.
26
+
27
+ - `vocab`: Set `projectRoot` in vocab config to fix crash with `tinyglobby@0.2.16` ([#1542](https://github.com/seek-oss/sku/pull/1542))
28
+
3
29
  ## 15.12.2
4
30
 
5
31
  ### Patch Changes
@@ -1981,6 +1981,10 @@ const validateOptions = (options) => {
1981
1981
  //#region src/config/targets.json
1982
1982
  var browserslistNodeTarget = "node 22.19.0";
1983
1983
 
1984
+ //#endregion
1985
+ //#region src/services/bundlerConstants.ts
1986
+ const assetsInlineLimitBytes = 1e4;
1987
+
1984
1988
  //#endregion
1985
1989
  //#region src/services/webpack/config/plugins/skuWebpackPlugin.ts
1986
1990
  var SkuWebpackPlugin = class {
@@ -2084,13 +2088,34 @@ var SkuWebpackPlugin = class {
2084
2088
  include: this.include,
2085
2089
  type: "asset",
2086
2090
  generator: { emit: target === "browser" },
2087
- parser: { dataUrlCondition: { maxSize: 1e4 } }
2091
+ parser: { dataUrlCondition: { maxSize: assetsInlineLimitBytes } }
2088
2092
  },
2089
2093
  {
2090
2094
  test: SVG,
2091
2095
  include: this.include,
2092
2096
  type: "asset/source",
2093
2097
  use: makeSvgLoaders()
2098
+ },
2099
+ {
2100
+ test: SVG,
2101
+ resourceQuery: /raw/,
2102
+ include: this.include,
2103
+ type: "asset/source",
2104
+ use: makeSvgLoaders()
2105
+ },
2106
+ {
2107
+ test: SVG,
2108
+ resourceQuery: /inline/,
2109
+ include: this.include,
2110
+ type: "asset/inline",
2111
+ use: makeSvgLoaders()
2112
+ },
2113
+ {
2114
+ test: SVG,
2115
+ resourceQuery: /url/,
2116
+ include: this.include,
2117
+ type: "asset/resource",
2118
+ use: makeSvgLoaders()
2094
2119
  }
2095
2120
  ];
2096
2121
  compiler.options.module.rules.push(...rules);
@@ -2200,6 +2225,7 @@ const getVocabConfig = ({ languages }) => {
2200
2225
  return null;
2201
2226
  }
2202
2227
  const result = {
2228
+ projectRoot: process.cwd(),
2203
2229
  devLanguage: "en",
2204
2230
  ignore: ["node_modules/sku/**", "node_modules/vocab/**"],
2205
2231
  languages,
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "15.12.2";
2
+ var version = "15.13.0";
3
3
  var package_default = {
4
4
  name: "sku",
5
5
  version,
@@ -0,0 +1,5 @@
1
+ //#region src/services/bundlerConstants.ts
2
+ const assetsInlineLimitBytes = 1e4;
3
+
4
+ //#endregion
5
+ export { assetsInlineLimitBytes };
@@ -2,6 +2,7 @@ import { __require } from "../../../_virtual/rolldown_runtime.mjs";
2
2
  import { makePluginName } from "../helpers/makePluginName.mjs";
3
3
  import { createOutDir, renderEntryChunkName } from "../helpers/bundleConfig.mjs";
4
4
  import browserslistToEsbuild from "../helpers/browserslist-to-esbuild.mjs";
5
+ import { assetsInlineLimitBytes } from "../../bundlerConstants.mjs";
5
6
  import { createVocabChunks } from "@vocab/vite/chunks";
6
7
 
7
8
  //#region src/services/vite/plugins/build.ts
@@ -16,6 +17,7 @@ const buildPlugin = ({ skuContext }) => {
16
17
  build: {
17
18
  target: browserslistToEsbuild(skuContext.supportedBrowsers),
18
19
  assetsDir: "",
20
+ assetsInlineLimit: assetsInlineLimitBytes,
19
21
  rolldownOptions: { output: { codeSplitting: { groups: [{ name: (id, ctx) => {
20
22
  const languageChunkName = createVocabChunks(id, ctx);
21
23
  if (languageChunkName) return languageChunkName;
@@ -9,6 +9,7 @@ const getVocabConfig = ({ languages }) => {
9
9
  return null;
10
10
  }
11
11
  const result = {
12
+ projectRoot: process.cwd(),
12
13
  devLanguage: "en",
13
14
  ignore: ["node_modules/sku/**", "node_modules/vocab/**"],
14
15
  languages,
@@ -1,6 +1,7 @@
1
1
  import { defaultCompilePackages, detectedCompilePackagePaths } from "./context/defaultCompilePackages.mjs";
2
2
  import { rootResolutionFileExtensions } from "./config/fileResolutionExtensions.mjs";
3
3
  import { browserslistNodeTarget } from "./config/targets.mjs";
4
+ import { assetsInlineLimitBytes } from "./services/bundlerConstants.mjs";
4
5
  import { makeExternalCssLoaders, makeJsLoaders, makeSvgLoaders } from "./services/webpack/config/utils/loaders.mjs";
5
6
  import { resolvePackage } from "./services/webpack/config/utils/resolvePackage.mjs";
6
7
  import { IMAGE, JAVASCRIPT, SVG, TYPESCRIPT } from "./services/webpack/config/utils/index.mjs";
@@ -111,13 +112,34 @@ var SkuWebpackPlugin = class {
111
112
  include: this.include,
112
113
  type: "asset",
113
114
  generator: { emit: target === "browser" },
114
- parser: { dataUrlCondition: { maxSize: 1e4 } }
115
+ parser: { dataUrlCondition: { maxSize: assetsInlineLimitBytes } }
115
116
  },
116
117
  {
117
118
  test: SVG,
118
119
  include: this.include,
119
120
  type: "asset/source",
120
121
  use: makeSvgLoaders()
122
+ },
123
+ {
124
+ test: SVG,
125
+ resourceQuery: /raw/,
126
+ include: this.include,
127
+ type: "asset/source",
128
+ use: makeSvgLoaders()
129
+ },
130
+ {
131
+ test: SVG,
132
+ resourceQuery: /inline/,
133
+ include: this.include,
134
+ type: "asset/inline",
135
+ use: makeSvgLoaders()
136
+ },
137
+ {
138
+ test: SVG,
139
+ resourceQuery: /url/,
140
+ include: this.include,
141
+ type: "asset/resource",
142
+ use: makeSvgLoaders()
121
143
  }
122
144
  ];
123
145
  compiler.options.module.rules.push(...rules);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sku",
3
- "version": "15.12.2",
3
+ "version": "15.13.0",
4
4
  "description": "Front-end development toolkit, powered by Webpack, Babel, Vanilla Extract and Jest",
5
5
  "types": "./dist/index.d.mts",
6
6
  "bin": {
@@ -200,8 +200,8 @@
200
200
  "react-dom": "^19.1.0",
201
201
  "type-fest": "^5.0.0",
202
202
  "vitest": "^4.1.0",
203
- "@sku-private/utils": "0.0.0",
204
- "@sku-private/tsdown": "0.0.0"
203
+ "@sku-private/tsdown": "0.0.0",
204
+ "@sku-private/utils": "0.0.0"
205
205
  },
206
206
  "scripts": {
207
207
  "postinstall": "node ./scripts/postinstall.js",