@ms-cloudpack/bundler-utilities 0.4.2 → 0.4.3

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.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Get a webpack/rspack `RuleSetRule` for handling css/sass files.
3
+ */
4
+ export declare function getCssRule(fileType: 'css' | 'sass'): {
5
+ oneOf: Array<{
6
+ test: RegExp;
7
+ use: Array<string | {
8
+ loader: string;
9
+ options: Record<string, any>;
10
+ }>;
11
+ }>;
12
+ };
13
+ //# sourceMappingURL=getCssRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCssRule.d.ts","sourceRoot":"","sources":["../src/getCssRule.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,KAAK,GAAG,MAAM,GAAG;IACpD,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QAEb,GAAG,EAAE,KAAK,CAAC,MAAM,GAAG;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;SAAE,CAAC,CAAC;KACvE,CAAC,CAAC;CACJ,CA4CA"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Get a webpack/rspack `RuleSetRule` for handling css/sass files.
3
+ */
4
+ export function getCssRule(fileType) {
5
+ return {
6
+ oneOf: ['global', 'module', 'plain'].map((type) => ({
7
+ // These are used within oneOf (pick first matching rule), so we don't need `exclude`
8
+ test: new RegExp(`${type === 'plain' ? '' : `\\.${type}`}\\.${fileType === 'sass' ? 's[ac]ss' : 'css'}$`, 'i'),
9
+ // With webpack/rspack, it's possible to set sideEffects: true to force all CSS imports to be
10
+ // treated as having side effects regardless of sideEffects in package.json. However, ori
11
+ // doesn't seem to have an equivalent setting, so we skip it here for consistency.
12
+ use: [
13
+ 'style-loader',
14
+ {
15
+ loader: 'css-loader',
16
+ options: {
17
+ modules: type === 'plain'
18
+ ? // TODO: determine whether we want CSS modules parsing/exports for plain CSS
19
+ // (we didn't enable it in webpack previously)
20
+ undefined
21
+ : {
22
+ mode: type === 'module' ? 'local' : 'global',
23
+ localIdentName: '[local]__[hash:base64]',
24
+ // TODO: once upgraded to css-loader v7 with some bug fixes, investigate
25
+ // enabling this (previously we used v6's default value of false)
26
+ namedExport: false,
27
+ // Consider this too:
28
+ // // Include global classes/IDs in exports
29
+ // exportGlobals: true,
30
+ },
31
+ },
32
+ },
33
+ ...(fileType === 'sass'
34
+ ? [
35
+ {
36
+ loader: 'sass-loader',
37
+ options: {
38
+ // spammy, non-actionable warning
39
+ sassOptions: { silenceDeprecations: ['legacy-js-api'] },
40
+ },
41
+ },
42
+ ]
43
+ : []),
44
+ ],
45
+ })),
46
+ };
47
+ }
48
+ //# sourceMappingURL=getCssRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCssRule.js","sourceRoot":"","sources":["../src/getCssRule.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,QAAwB;IAOjD,OAAO;QACL,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAClD,qFAAqF;YACrF,IAAI,EAAE,IAAI,MAAM,CAAC,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,MAAM,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,GAAG,CAAC;YAC9G,6FAA6F;YAC7F,yFAAyF;YACzF,kFAAkF;YAClF,GAAG,EAAE;gBACH,cAAc;gBACd;oBACE,MAAM,EAAE,YAAY;oBACpB,OAAO,EAAE;wBACP,OAAO,EACL,IAAI,KAAK,OAAO;4BACd,CAAC,CAAC,4EAA4E;gCAC5E,8CAA8C;gCAC9C,SAAS;4BACX,CAAC,CAAC;gCACE,IAAI,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;gCAC5C,cAAc,EAAE,wBAAwB;gCACxC,wEAAwE;gCACxE,iEAAiE;gCACjE,WAAW,EAAE,KAAK;gCAClB,qBAAqB;gCACrB,2CAA2C;gCAC3C,uBAAuB;6BACxB;qBACR;iBACF;gBACD,GAAG,CAAC,QAAQ,KAAK,MAAM;oBACrB,CAAC,CAAC;wBACE;4BACE,MAAM,EAAE,aAAa;4BACrB,OAAO,EAAE;gCACP,iCAAiC;gCACjC,WAAW,EAAE,EAAE,mBAAmB,EAAE,CAAC,eAAe,CAAC,EAAE;6BACxD;yBACF;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;aACR;SACF,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Get a webpack/rspack `RuleSetRule` for handling css/sass files.\n */\nexport function getCssRule(fileType: 'css' | 'sass'): {\n oneOf: Array<{\n test: RegExp;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- matching webpack RuleSetRule\n use: Array<string | { loader: string; options: Record<string, any> }>;\n }>;\n} {\n return {\n oneOf: ['global', 'module', 'plain'].map((type) => ({\n // These are used within oneOf (pick first matching rule), so we don't need `exclude`\n test: new RegExp(`${type === 'plain' ? '' : `\\\\.${type}`}\\\\.${fileType === 'sass' ? 's[ac]ss' : 'css'}$`, 'i'),\n // With webpack/rspack, it's possible to set sideEffects: true to force all CSS imports to be\n // treated as having side effects regardless of sideEffects in package.json. However, ori\n // doesn't seem to have an equivalent setting, so we skip it here for consistency.\n use: [\n 'style-loader',\n {\n loader: 'css-loader',\n options: {\n modules:\n type === 'plain'\n ? // TODO: determine whether we want CSS modules parsing/exports for plain CSS\n // (we didn't enable it in webpack previously)\n undefined\n : {\n mode: type === 'module' ? 'local' : 'global',\n localIdentName: '[local]__[hash:base64]',\n // TODO: once upgraded to css-loader v7 with some bug fixes, investigate\n // enabling this (previously we used v6's default value of false)\n namedExport: false,\n // Consider this too:\n // // Include global classes/IDs in exports\n // exportGlobals: true,\n },\n },\n },\n ...(fileType === 'sass'\n ? [\n {\n loader: 'sass-loader',\n options: {\n // spammy, non-actionable warning\n sassOptions: { silenceDeprecations: ['legacy-js-api'] },\n },\n },\n ]\n : []),\n ],\n })),\n };\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -2,4 +2,5 @@ export { defaultTargetSyntax, base64AssetExtensions } from './constants.js';
2
2
  export { getModuleSearchPaths } from './getModuleSearchPaths.js';
3
3
  export { getSwcConfig } from './getSwcConfig.js';
4
4
  export { shouldExternalizePackage } from './shouldExternalizePackage.js';
5
+ export { getCssRule } from './getCssRule.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
package/lib/index.js CHANGED
@@ -2,4 +2,5 @@ export { defaultTargetSyntax, base64AssetExtensions } from './constants.js';
2
2
  export { getModuleSearchPaths } from './getModuleSearchPaths.js';
3
3
  export { getSwcConfig } from './getSwcConfig.js';
4
4
  export { shouldExternalizePackage } from './shouldExternalizePackage.js';
5
+ export { getCssRule } from './getCssRule.js';
5
6
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC","sourcesContent":["export { defaultTargetSyntax, base64AssetExtensions } from './constants.js';\nexport { getModuleSearchPaths } from './getModuleSearchPaths.js';\nexport { getSwcConfig } from './getSwcConfig.js';\nexport { shouldExternalizePackage } from './shouldExternalizePackage.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { defaultTargetSyntax, base64AssetExtensions } from './constants.js';\nexport { getModuleSearchPaths } from './getModuleSearchPaths.js';\nexport { getSwcConfig } from './getSwcConfig.js';\nexport { shouldExternalizePackage } from './shouldExternalizePackage.js';\nexport { getCssRule } from './getCssRule.js';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/bundler-utilities",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Utilities used by multiple bundlers.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,14 +15,14 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@ms-cloudpack/json-utilities": "^0.1.10",
18
- "@ms-cloudpack/package-utilities": "^12.3.17",
18
+ "@ms-cloudpack/package-utilities": "^12.3.18",
19
19
  "@ms-cloudpack/path-string-parsing": "^1.2.7",
20
- "@ms-cloudpack/path-utilities": "^3.1.11",
20
+ "@ms-cloudpack/path-utilities": "^3.1.12",
21
21
  "get-tsconfig": "^4.7.2",
22
22
  "tsconfig-to-swcconfig": "^2.7.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@ms-cloudpack/common-types": "^0.26.1",
25
+ "@ms-cloudpack/common-types": "^0.26.2",
26
26
  "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
27
27
  "@ms-cloudpack/scripts": "^0.0.1",
28
28
  "@ms-cloudpack/test-utilities": "^0.5.0",