@servicetitan/startup 38.3.0 → 39.0.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/dist/cli/commands/mfe-list.js +1 -1
- package/dist/cli/commands/mfe-list.js.map +1 -1
- package/dist/vite/plugins/metadata-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/metadata-plugin.js +2 -1
- package/dist/vite/plugins/metadata-plugin.js.map +1 -1
- package/dist/vite/plugins/virtual-modules-plugin.d.ts +1 -0
- package/dist/vite/plugins/virtual-modules-plugin.d.ts.map +1 -1
- package/dist/vite/plugins/virtual-modules-plugin.js +12 -4
- package/dist/vite/plugins/virtual-modules-plugin.js.map +1 -1
- package/dist/webpack/configs/loaders/index.d.ts +1 -0
- package/dist/webpack/configs/loaders/index.d.ts.map +1 -1
- package/dist/webpack/configs/loaders/index.js +1 -0
- package/dist/webpack/configs/loaders/index.js.map +1 -1
- package/dist/webpack/configs/loaders/sass-loader.d.ts +9 -0
- package/dist/webpack/configs/loaders/sass-loader.d.ts.map +1 -0
- package/dist/webpack/configs/loaders/sass-loader.js +26 -0
- package/dist/webpack/configs/loaders/sass-loader.js.map +1 -0
- package/dist/webpack/configs/rules/scss-rules.js +2 -2
- package/dist/webpack/configs/rules/scss-rules.js.map +1 -1
- package/package.json +6 -6
- package/src/cli/commands/__tests__/mfe-list.test.ts +36 -14
- package/src/cli/commands/mfe-list.ts +1 -1
- package/src/vite/plugins/__tests__/metadata-plugin.test.ts +2 -1
- package/src/vite/plugins/metadata-plugin.ts +2 -1
- package/src/vite/plugins/virtual-modules-plugin.ts +2 -1
- package/src/webpack/__mocks__/style-rules.ts +6 -2
- package/src/webpack/configs/loaders/index.ts +1 -0
- package/src/webpack/configs/loaders/sass-loader.ts +15 -0
- package/src/webpack/configs/rules/scss-rules.ts +3 -3
|
@@ -157,7 +157,7 @@ class MFEList extends _types.Command {
|
|
|
157
157
|
return (0, _utils.getPackages)({
|
|
158
158
|
ignore: this.args.ignore,
|
|
159
159
|
type: _utils.PackageType.Bundle
|
|
160
|
-
}).filter(_utils.isWebComponent).map(({ name })=>name).sort((a, b)=>collator.compare(a, b));
|
|
160
|
+
}).filter(({ location })=>(0, _utils.isWebComponent)(location)).map(({ name })=>name).sort((a, b)=>collator.compare(a, b));
|
|
161
161
|
}
|
|
162
162
|
get registry() {
|
|
163
163
|
var _this_args_registry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/commands/mfe-list.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport { npmWhoAmI } from '@servicetitan/install';\nimport chalk from 'chalk';\nimport Table from 'cli-table3';\nimport readline from 'readline/promises';\nimport {\n formatRelativeDate,\n getPackages,\n isWebComponent,\n log,\n logErrors,\n PackageType,\n} from '../../utils';\nimport { isTTY, NPMPackageInfo, npmView, runCommand } from '../utils';\nimport type { entry } from './registry/mfe-list';\nimport { Command } from './types';\nimport { DEFAULT_MFE_REGISTRY } from './utils';\n\nconst collator = new Intl.Collator();\n\nexport class MFEList extends Command<typeof entry> {\n @logErrors\n async execute() {\n await this.login();\n\n this.packageNames.forEach((name, index) => {\n const info = npmView({ packageName: name, registry: this.registry });\n if (info) {\n if (index > 0) {\n process.stdout.write('\\n');\n }\n\n process.stdout.write(this.getCaption(info) + '\\n');\n const table = this.getTable(info);\n if (table) {\n process.stdout.write(table + '\\n');\n }\n }\n });\n }\n\n private getCaption(info: NPMPackageInfo) {\n return [\n chalk.bold.cyan(info.name),\n info.version && `version: ${info.version}`,\n `versions: ${Object.keys(this.getTime(info)).length}`,\n ]\n .filter(el => !!el)\n .join(' | ');\n }\n\n private getTable(info: NPMPackageInfo) {\n const times = Object.entries(this.getTime(info)).sort(\n ([, a], [, b]) => -1 * collator.compare(a, b)\n );\n const versionTags = this.getVersionTags(info);\n const versions = this.args.tagged\n ? times.filter(([version]) => !!versionTags[version])\n : times.slice(0, this.limit);\n\n /* istanbul ignore next: debug only */\n log.debug('mfe-list', () =>\n JSON.stringify({ name: info.name, versionTags, versions }, null, 2)\n );\n\n if (versions.length === 0) {\n return '';\n }\n\n const table = new Table({\n head: ['Version', 'Tag', 'When'].map(title => chalk.bold.cyan(title)),\n style: { head: [] },\n });\n\n versions.forEach(([version, timestamp]) => {\n const when = formatRelativeDate(new Date(timestamp));\n const tag = (versionTags[version] ?? []).join(', ');\n table.push([version, chalk.bold.cyan(tag), when]);\n });\n\n return table.toString();\n }\n\n private getTime(info: NPMPackageInfo) {\n const { time: { created, modified, ...time } = {} } = info;\n return time;\n }\n\n private getVersionTags({ 'dist-tags': distTags = {} }: NPMPackageInfo) {\n return Object.entries(distTags).reduce<Record<string, string[]>>(\n (result, [name, version]) => {\n result[version] ??= [];\n result[version].push(name);\n return result;\n },\n {}\n );\n }\n\n private async ask(question: string) {\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n const answer = await rl.question(question);\n rl.close();\n return answer.trim().toLowerCase();\n }\n\n private async login() {\n if (\n this.registry !== DEFAULT_MFE_REGISTRY ||\n npmWhoAmI({ registry: this.registry }) !== undefined\n ) {\n return;\n }\n\n const message = `This machine is not authorized to access ${this.registry}.`;\n if (!isTTY()) {\n throw new Error(message);\n }\n\n const answer = await this.ask(chalk.bold.cyan(`${message} Authorize? [Y/n] `));\n if (answer && answer !== 'y') {\n throw new Error('Not authorized');\n }\n\n await runCommand(`npx --yes verdaccio-okta-oauth@latest --registry=${this.registry}`, {\n quiet: true,\n });\n }\n\n private get limit() {\n if (this.args.all) {\n return Number.MAX_SAFE_INTEGER;\n }\n return this.args.limit && this.args.limit > 0 ? this.args.limit : 20;\n }\n\n private get packageNames() {\n const { _ = [], packageNames = [] } = this.args;\n if (_.length || packageNames.length) {\n return [..._, ...packageNames];\n }\n\n return getPackages({ ignore: this.args.ignore, type: PackageType.Bundle })\n .filter(isWebComponent)\n .map(({ name }) => name)\n .sort((a, b) => collator.compare(a, b));\n }\n\n private get registry() {\n return this.args.registry ?? DEFAULT_MFE_REGISTRY;\n }\n}\n"],"names":["MFEList","collator","Intl","Collator","Command","execute","login","packageNames","forEach","name","index","info","npmView","packageName","registry","process","stdout","write","getCaption","table","getTable","chalk","bold","cyan","version","Object","keys","getTime","length","filter","el","join","times","entries","sort","a","b","compare","versionTags","getVersionTags","versions","args","tagged","slice","limit","log","debug","JSON","stringify","Table","head","map","title","style","timestamp","when","formatRelativeDate","Date","tag","push","toString","time","created","modified","distTags","reduce","result","ask","question","rl","readline","createInterface","input","stdin","output","answer","close","trim","toLowerCase","DEFAULT_MFE_REGISTRY","npmWhoAmI","undefined","message","isTTY","Error","runCommand","quiet","all","Number","MAX_SAFE_INTEGER","_","getPackages","ignore","type","PackageType","Bundle","isWebComponent"],"mappings":"AAAA,uDAAuD;;;;+BAoB1CA;;;eAAAA;;;yBAnBa;8DACR;kEACA;iEACG;uBAQd;wBACoD;uBAEnC;wBACa;;;;;;;;;;;;;;;;;;;;;;;;AAErC,MAAMC,WAAW,IAAIC,KAAKC,QAAQ;AAE3B,MAAMH,gBAAgBI,cAAO;IAChC,MACMC,UAAU;QACZ,MAAM,IAAI,CAACC,KAAK;QAEhB,IAAI,CAACC,YAAY,CAACC,OAAO,CAAC,CAACC,MAAMC;YAC7B,MAAMC,OAAOC,IAAAA,eAAO,EAAC;gBAAEC,aAAaJ;gBAAMK,UAAU,IAAI,CAACA,QAAQ;YAAC;YAClE,IAAIH,MAAM;gBACN,IAAID,QAAQ,GAAG;oBACXK,QAAQC,MAAM,CAACC,KAAK,CAAC;gBACzB;gBAEAF,QAAQC,MAAM,CAACC,KAAK,CAAC,IAAI,CAACC,UAAU,CAACP,QAAQ;gBAC7C,MAAMQ,QAAQ,IAAI,CAACC,QAAQ,CAACT;gBAC5B,IAAIQ,OAAO;oBACPJ,QAAQC,MAAM,CAACC,KAAK,CAACE,QAAQ;gBACjC;YACJ;QACJ;IACJ;IAEQD,WAAWP,IAAoB,EAAE;QACrC,OAAO;YACHU,cAAK,CAACC,IAAI,CAACC,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Q,CAAC,CAAC,CAAC;QAC5E,IAAI,CAACqE,IAAAA,aAAK,KAAI;YACV,MAAM,IAAIC,MAAMF;QACpB;QAEA,MAAMP,SAAS,MAAM,IAAI,CAACR,GAAG,CAAC9C,cAAK,CAACC,IAAI,CAACC,IAAI,CAAC,GAAG2D,QAAQ,kBAAkB,CAAC;QAC5E,IAAIP,UAAUA,WAAW,KAAK;YAC1B,MAAM,IAAIS,MAAM;QACpB;QAEA,MAAMC,IAAAA,kBAAU,EAAC,CAAC,iDAAiD,EAAE,IAAI,CAACvE,QAAQ,EAAE,EAAE;YAClFwE,OAAO;QACX;IACJ;IAEA,IAAY1C,QAAQ;QAChB,IAAI,IAAI,CAACH,IAAI,CAAC8C,GAAG,EAAE;YACf,OAAOC,OAAOC,gBAAgB;QAClC;QACA,OAAO,IAAI,CAAChD,IAAI,CAACG,KAAK,IAAI,IAAI,CAACH,IAAI,CAACG,KAAK,GAAG,IAAI,IAAI,CAACH,IAAI,CAACG,KAAK,GAAG;IACtE;IAEA,IAAYrC,eAAe;QACvB,MAAM,EAAEmF,IAAI,EAAE,EAAEnF,eAAe,EAAE,EAAE,GAAG,IAAI,CAACkC,IAAI;QAC/C,IAAIiD,EAAE9D,MAAM,IAAIrB,aAAaqB,MAAM,EAAE;YACjC,OAAO;mBAAI8D;mBAAMnF;aAAa;QAClC;QAEA,OAAOoF,IAAAA,kBAAW,EAAC;YAAEC,QAAQ,IAAI,CAACnD,IAAI,CAACmD,MAAM;YAAEC,MAAMC,kBAAW,CAACC,MAAM;QAAC,GACnElE,MAAM,
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/commands/mfe-list.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport { npmWhoAmI } from '@servicetitan/install';\nimport chalk from 'chalk';\nimport Table from 'cli-table3';\nimport readline from 'readline/promises';\nimport {\n formatRelativeDate,\n getPackages,\n isWebComponent,\n log,\n logErrors,\n PackageType,\n} from '../../utils';\nimport { isTTY, NPMPackageInfo, npmView, runCommand } from '../utils';\nimport type { entry } from './registry/mfe-list';\nimport { Command } from './types';\nimport { DEFAULT_MFE_REGISTRY } from './utils';\n\nconst collator = new Intl.Collator();\n\nexport class MFEList extends Command<typeof entry> {\n @logErrors\n async execute() {\n await this.login();\n\n this.packageNames.forEach((name, index) => {\n const info = npmView({ packageName: name, registry: this.registry });\n if (info) {\n if (index > 0) {\n process.stdout.write('\\n');\n }\n\n process.stdout.write(this.getCaption(info) + '\\n');\n const table = this.getTable(info);\n if (table) {\n process.stdout.write(table + '\\n');\n }\n }\n });\n }\n\n private getCaption(info: NPMPackageInfo) {\n return [\n chalk.bold.cyan(info.name),\n info.version && `version: ${info.version}`,\n `versions: ${Object.keys(this.getTime(info)).length}`,\n ]\n .filter(el => !!el)\n .join(' | ');\n }\n\n private getTable(info: NPMPackageInfo) {\n const times = Object.entries(this.getTime(info)).sort(\n ([, a], [, b]) => -1 * collator.compare(a, b)\n );\n const versionTags = this.getVersionTags(info);\n const versions = this.args.tagged\n ? times.filter(([version]) => !!versionTags[version])\n : times.slice(0, this.limit);\n\n /* istanbul ignore next: debug only */\n log.debug('mfe-list', () =>\n JSON.stringify({ name: info.name, versionTags, versions }, null, 2)\n );\n\n if (versions.length === 0) {\n return '';\n }\n\n const table = new Table({\n head: ['Version', 'Tag', 'When'].map(title => chalk.bold.cyan(title)),\n style: { head: [] },\n });\n\n versions.forEach(([version, timestamp]) => {\n const when = formatRelativeDate(new Date(timestamp));\n const tag = (versionTags[version] ?? []).join(', ');\n table.push([version, chalk.bold.cyan(tag), when]);\n });\n\n return table.toString();\n }\n\n private getTime(info: NPMPackageInfo) {\n const { time: { created, modified, ...time } = {} } = info;\n return time;\n }\n\n private getVersionTags({ 'dist-tags': distTags = {} }: NPMPackageInfo) {\n return Object.entries(distTags).reduce<Record<string, string[]>>(\n (result, [name, version]) => {\n result[version] ??= [];\n result[version].push(name);\n return result;\n },\n {}\n );\n }\n\n private async ask(question: string) {\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n const answer = await rl.question(question);\n rl.close();\n return answer.trim().toLowerCase();\n }\n\n private async login() {\n if (\n this.registry !== DEFAULT_MFE_REGISTRY ||\n npmWhoAmI({ registry: this.registry }) !== undefined\n ) {\n return;\n }\n\n const message = `This machine is not authorized to access ${this.registry}.`;\n if (!isTTY()) {\n throw new Error(message);\n }\n\n const answer = await this.ask(chalk.bold.cyan(`${message} Authorize? [Y/n] `));\n if (answer && answer !== 'y') {\n throw new Error('Not authorized');\n }\n\n await runCommand(`npx --yes verdaccio-okta-oauth@latest --registry=${this.registry}`, {\n quiet: true,\n });\n }\n\n private get limit() {\n if (this.args.all) {\n return Number.MAX_SAFE_INTEGER;\n }\n return this.args.limit && this.args.limit > 0 ? this.args.limit : 20;\n }\n\n private get packageNames() {\n const { _ = [], packageNames = [] } = this.args;\n if (_.length || packageNames.length) {\n return [..._, ...packageNames];\n }\n\n return getPackages({ ignore: this.args.ignore, type: PackageType.Bundle })\n .filter(({ location }) => isWebComponent(location))\n .map(({ name }) => name)\n .sort((a, b) => collator.compare(a, b));\n }\n\n private get registry() {\n return this.args.registry ?? DEFAULT_MFE_REGISTRY;\n }\n}\n"],"names":["MFEList","collator","Intl","Collator","Command","execute","login","packageNames","forEach","name","index","info","npmView","packageName","registry","process","stdout","write","getCaption","table","getTable","chalk","bold","cyan","version","Object","keys","getTime","length","filter","el","join","times","entries","sort","a","b","compare","versionTags","getVersionTags","versions","args","tagged","slice","limit","log","debug","JSON","stringify","Table","head","map","title","style","timestamp","when","formatRelativeDate","Date","tag","push","toString","time","created","modified","distTags","reduce","result","ask","question","rl","readline","createInterface","input","stdin","output","answer","close","trim","toLowerCase","DEFAULT_MFE_REGISTRY","npmWhoAmI","undefined","message","isTTY","Error","runCommand","quiet","all","Number","MAX_SAFE_INTEGER","_","getPackages","ignore","type","PackageType","Bundle","location","isWebComponent"],"mappings":"AAAA,uDAAuD;;;;+BAoB1CA;;;eAAAA;;;yBAnBa;8DACR;kEACA;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AI,CAACG,KAAK,IAAI,IAAI,CAACH,IAAI,CAACG,KAAK,GAAG,IAAI,IAAI,CAACH,IAAI,CAACG,KAAK,GAAG;IACtE;IAEA,IAAYrC,eAAe;QACvB,MAAM,EAAEmF,IAAI,EAAE,EAAEnF,eAAe,EAAE,EAAE,GAAG,IAAI,CAACkC,IAAI;QAC/C,IAAIiD,EAAE9D,MAAM,IAAIrB,aAAaqB,MAAM,EAAE;YACjC,OAAO;mBAAI8D;mBAAMnF;aAAa;QAClC;QAEA,OAAOoF,IAAAA,kBAAW,EAAC;YAAEC,QAAQ,IAAI,CAACnD,IAAI,CAACmD,MAAM;YAAEC,MAAMC,kBAAW,CAACC,MAAM;QAAC,GACnElE,MAAM,CAAC,CAAC,EAAEmE,QAAQ,EAAE,GAAKC,IAAAA,qBAAc,EAACD,WACxC7C,GAAG,CAAC,CAAC,EAAE1C,IAAI,EAAE,GAAKA,MAClByB,IAAI,CAAC,CAACC,GAAGC,IAAMnC,SAASoC,OAAO,CAACF,GAAGC;IAC5C;IAEA,IAAYtB,WAAW;YACZ;QAAP,QAAO,sBAAA,IAAI,CAAC2B,IAAI,CAAC3B,QAAQ,cAAlB,iCAAA,sBAAsBiE,4BAAoB;IACrD;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/metadata-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,YAAY,EAAoB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"metadata-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/metadata-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,YAAY,EAAoB,MAAM,YAAY,CAAC;AAI5D,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CA0DxE"}
|
|
@@ -12,6 +12,7 @@ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
|
12
12
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
13
|
const _core = require("../../core");
|
|
14
14
|
const _utils = require("./utils");
|
|
15
|
+
const _virtualmodulesplugin = require("./virtual-modules-plugin");
|
|
15
16
|
function _interop_require_default(obj) {
|
|
16
17
|
return obj && obj.__esModule ? obj : {
|
|
17
18
|
default: obj
|
|
@@ -41,7 +42,7 @@ function metadataPlugin(context) {
|
|
|
41
42
|
css: [],
|
|
42
43
|
js: [
|
|
43
44
|
'@vite/client',
|
|
44
|
-
|
|
45
|
+
`@id/__x00__${_virtualmodulesplugin.VIRTUAL_PREFIX.slice(1)}./index`
|
|
45
46
|
]
|
|
46
47
|
};
|
|
47
48
|
const entrypointsPath = _path.default.join(outDir, 'entrypoints.json');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/vite/plugins/metadata-plugin.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type { Plugin } from 'vite';\nimport { BuildContext, generateMetadata } from '../../core';\nimport { getCssFileNames } from './utils';\n\nexport function metadataPlugin(context: BuildContext): Plugin | undefined {\n if (!context.package.isWebComponent) {\n return;\n }\n\n let outDir = '';\n\n return {\n name: 'st:metadata',\n configResolved(config) {\n outDir = config.build.outDir;\n },\n configureServer(server) {\n server.httpServer?.once('listening', () => {\n const address = server.httpServer?.address();\n if (!address || typeof address === 'string') {\n return;\n }\n\n const entrypoints = {\n module: true,\n port: address.port,\n css: [],\n js: ['@vite/client',
|
|
1
|
+
{"version":3,"sources":["../../../src/vite/plugins/metadata-plugin.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type { Plugin } from 'vite';\nimport { BuildContext, generateMetadata } from '../../core';\nimport { getCssFileNames } from './utils';\nimport { VIRTUAL_PREFIX } from './virtual-modules-plugin';\n\nexport function metadataPlugin(context: BuildContext): Plugin | undefined {\n if (!context.package.isWebComponent) {\n return;\n }\n\n let outDir = '';\n\n return {\n name: 'st:metadata',\n configResolved(config) {\n outDir = config.build.outDir;\n },\n configureServer(server) {\n server.httpServer?.once('listening', () => {\n const address = server.httpServer?.address();\n if (!address || typeof address === 'string') {\n return;\n }\n\n const entrypoints = {\n module: true,\n port: address.port,\n css: [],\n js: ['@vite/client', `@id/__x00__${VIRTUAL_PREFIX.slice(1)}./index`],\n };\n\n const entrypointsPath = path.join(outDir, 'entrypoints.json');\n fs.mkdirSync(path.dirname(entrypointsPath), { recursive: true });\n fs.writeFileSync(entrypointsPath, JSON.stringify(entrypoints, null, 2));\n\n generateMetadata(context);\n });\n },\n writeBundle(options, bundle) {\n if (!options.dir) {\n throw new Error(\n 'web-component build requires output.dir — output.file is not supported'\n );\n }\n\n const js: string[] = [];\n\n for (const chunk of Object.values(bundle)) {\n if (chunk.type === 'chunk' && chunk.isEntry) {\n js.push(chunk.fileName);\n }\n }\n\n const css = getCssFileNames(bundle);\n\n fs.writeFileSync(\n path.join(options.dir, 'entrypoints.json'),\n JSON.stringify({ module: true, css, js }, null, 2)\n );\n\n generateMetadata(context);\n },\n };\n}\n"],"names":["metadataPlugin","context","package","isWebComponent","outDir","name","configResolved","config","build","configureServer","server","httpServer","once","address","entrypoints","module","port","css","js","VIRTUAL_PREFIX","slice","entrypointsPath","path","join","fs","mkdirSync","dirname","recursive","writeFileSync","JSON","stringify","generateMetadata","writeBundle","options","bundle","dir","Error","chunk","Object","values","type","isEntry","push","fileName","getCssFileNames"],"mappings":";;;;+BAOgBA;;;eAAAA;;;2DAPD;6DACE;sBAE8B;uBACf;sCACD;;;;;;AAExB,SAASA,eAAeC,OAAqB;IAChD,IAAI,CAACA,QAAQC,OAAO,CAACC,cAAc,EAAE;QACjC;IACJ;IAEA,IAAIC,SAAS;IAEb,OAAO;QACHC,MAAM;QACNC,gBAAeC,MAAM;YACjBH,SAASG,OAAOC,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pDa,IAAAA,sBAAgB,EAAC9B;QACrB;IACJ;AACJ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
2
|
import { BuildContext } from '../../core';
|
|
3
|
+
export declare const VIRTUAL_PREFIX = "\0virtual-modules:";
|
|
3
4
|
export declare function virtualModulesPlugin(context: BuildContext): Plugin | undefined;
|
|
4
5
|
//# sourceMappingURL=virtual-modules-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-modules-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/virtual-modules-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,YAAY,EAAkB,MAAM,YAAY,CAAC;AAE1D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"virtual-modules-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/virtual-modules-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,YAAY,EAAkB,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,cAAc,uBAAuB,CAAC;AAEnD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAyC9E"}
|
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get VIRTUAL_PREFIX () {
|
|
13
|
+
return VIRTUAL_PREFIX;
|
|
14
|
+
},
|
|
15
|
+
get virtualModulesPlugin () {
|
|
8
16
|
return virtualModulesPlugin;
|
|
9
17
|
}
|
|
10
18
|
});
|
|
@@ -15,8 +23,8 @@ function _interop_require_default(obj) {
|
|
|
15
23
|
default: obj
|
|
16
24
|
};
|
|
17
25
|
}
|
|
26
|
+
const VIRTUAL_PREFIX = '\0virtual-modules:';
|
|
18
27
|
function virtualModulesPlugin(context) {
|
|
19
|
-
const VIRTUAL_PREFIX = '\0virtual-modules:';
|
|
20
28
|
const VIRTUAL_ID_PATTERN = new RegExp(`^${VIRTUAL_PREFIX}`);
|
|
21
29
|
const { destination } = context.package;
|
|
22
30
|
const modules = (0, _core.virtualModules)(context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/vite/plugins/virtual-modules-plugin.ts"],"sourcesContent":["import path from 'path';\nimport type { Plugin } from 'vite';\nimport { BuildContext, virtualModules } from '../../core';\n\nexport function virtualModulesPlugin(context: BuildContext): Plugin | undefined {\n const
|
|
1
|
+
{"version":3,"sources":["../../../src/vite/plugins/virtual-modules-plugin.ts"],"sourcesContent":["import path from 'path';\nimport type { Plugin } from 'vite';\nimport { BuildContext, virtualModules } from '../../core';\n\nexport const VIRTUAL_PREFIX = '\\0virtual-modules:';\n\nexport function virtualModulesPlugin(context: BuildContext): Plugin | undefined {\n const VIRTUAL_ID_PATTERN = new RegExp(`^${VIRTUAL_PREFIX}`);\n\n const { destination } = context.package;\n\n const modules = virtualModules(context);\n\n const pluginModules: Record<string, string> = {};\n\n if (modules.index) {\n pluginModules['./index'] = modules.index;\n }\n\n if (modules.designSystem) {\n pluginModules['./design-system.css'] = modules.designSystem;\n }\n\n if (Object.keys(pluginModules).length === 0) {\n return;\n }\n\n return {\n name: 'st:virtual-modules',\n resolveId(source, importer) {\n if (pluginModules[source]) {\n return VIRTUAL_PREFIX + source;\n }\n if (importer?.startsWith(VIRTUAL_PREFIX) && source.startsWith('.')) {\n const importerNoPrefix = importer.slice(VIRTUAL_PREFIX.length);\n if (pluginModules[importerNoPrefix]) {\n return path.resolve(destination, source + '.js');\n }\n }\n },\n load: {\n filter: { id: VIRTUAL_ID_PATTERN },\n handler(id) {\n return pluginModules[id.slice(VIRTUAL_PREFIX.length)];\n },\n },\n };\n}\n"],"names":["VIRTUAL_PREFIX","virtualModulesPlugin","context","VIRTUAL_ID_PATTERN","RegExp","destination","package","modules","virtualModules","pluginModules","index","designSystem","Object","keys","length","name","resolveId","source","importer","startsWith","importerNoPrefix","slice","path","resolve","load","filter","id","handler"],"mappings":";;;;;;;;;;;QAIaA;eAAAA;;QAEGC;eAAAA;;;6DANC;sBAE4B;;;;;;AAEtC,MAAMD,iBAAiB;AAEvB,SAASC,qBAAqBC,OAAqB;IACtD,MAAMC,qBAAqB,IAAIC,OAAO,CAAC,CAAC,EAAEJ,gBAAgB;IAE1D,MAAM,EAAEK,WAAW,EAAE,GAAGH,QAAQI,OAAO;IAEvC,MAAMC,UAAUC,IAAAA,oBAAc,EAACN;IAE/B,MAAMO,gBAAwC,CAAC;IAE/C,IAAIF,QAAQG,KAAK,EAAE;QACfD,aAAa,CAAC,UAAU,GAAGF,QAAQG,KAAK;IAC5C;IAEA,IAAIH,QAAQI,YAAY,EAAE;QACtBF,aAAa,CAAC,sBAAsB,GAAGF,QAAQI,YAAY;IAC/D;IAEA,IAAIC,OAAOC,IAAI,CAACJ,eAAeK,MAAM,KAAK,GAAG;QACzC;IACJ;IAEA,OAAO;QACHC,MAAM;QACNC,WAAUC,MAAM,EAAEC,QAAQ;YACtB,IAAIT,aAAa,CAACQ,OAAO,EAAE;gBACvB,OAAOjB,iBAAiBiB;YAC5B;YACA,IAAIC,CAAAA,qBAAAA,+BAAAA,SAAUC,UAAU,CAACnB,oBAAmBiB,OAAOE,UAAU,CAAC,MAAM;gBAChE,MAAMC,mBAAmBF,SAASG,KAAK,CAACrB,eAAec,MAAM;gBAC7D,IAAIL,aAAa,CAACW,iBAAiB,EAAE;oBACjC,OAAOE,aAAI,CAACC,OAAO,CAAClB,aAAaY,SAAS;gBAC9C;YACJ;QACJ;QACAO,MAAM;YACFC,QAAQ;gBAAEC,IAAIvB;YAAmB;YACjCwB,SAAQD,EAAE;gBACN,OAAOjB,aAAa,CAACiB,GAAGL,KAAK,CAACrB,eAAec,MAAM,EAAE;YACzD;QACJ;IACJ;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/loaders/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,mBAAmB,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/loaders/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,mBAAmB,SAAS,CAAC"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
_export_star(require("./css-loader"), exports);
|
|
6
6
|
_export_star(require("./less-loader"), exports);
|
|
7
|
+
_export_star(require("./sass-loader"), exports);
|
|
7
8
|
_export_star(require("./style-loader"), exports);
|
|
8
9
|
function _export_star(from, to) {
|
|
9
10
|
Object.keys(from).forEach(function(k) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/webpack/configs/loaders/index.ts"],"sourcesContent":["export * from './css-loader';\nexport * from './less-loader';\nexport * from './style-loader';\nexport type * from './types';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/webpack/configs/loaders/index.ts"],"sourcesContent":["export * from './css-loader';\nexport * from './less-loader';\nexport * from './sass-loader';\nexport * from './style-loader';\nexport type * from './types';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sass-loader.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/loaders/sass-loader.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU;;;;;;;EAczB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "sassLoader", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return sassLoader;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function sassLoader() {
|
|
12
|
+
return {
|
|
13
|
+
loader: 'sass-loader',
|
|
14
|
+
options: {
|
|
15
|
+
sassOptions: {
|
|
16
|
+
/*
|
|
17
|
+
* Turn off charset to prevent Dart Sass from injecting BOM when file
|
|
18
|
+
* contains a non-ASCII character. Concatenating multiple modules' CSS then leaves that
|
|
19
|
+
* marker in the middle of the bundle, invalidating the selector that follows it.
|
|
20
|
+
*/ charset: false
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=sass-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/webpack/configs/loaders/sass-loader.ts"],"sourcesContent":["export function sassLoader() {\n return {\n loader: 'sass-loader',\n options: {\n sassOptions: {\n /*\n * Turn off charset to prevent Dart Sass from injecting BOM when file\n * contains a non-ASCII character. Concatenating multiple modules' CSS then leaves that\n * marker in the middle of the bundle, invalidating the selector that follows it.\n */\n charset: false,\n },\n },\n };\n}\n"],"names":["sassLoader","loader","options","sassOptions","charset"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA;IACZ,OAAO;QACHC,QAAQ;QACRC,SAAS;YACLC,aAAa;gBACT;;;;iBAIC,GACDC,SAAS;YACb;QACJ;IACJ;AACJ"}
|
|
@@ -20,7 +20,7 @@ function scssRules(context) {
|
|
|
20
20
|
(0, _loaders.cssLoader)(context, {
|
|
21
21
|
esModule: true
|
|
22
22
|
}),
|
|
23
|
-
|
|
23
|
+
(0, _loaders.sassLoader)()
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
26
|
{
|
|
@@ -29,7 +29,7 @@ function scssRules(context) {
|
|
|
29
29
|
use: [
|
|
30
30
|
(0, _loaders.styleLoader)(context),
|
|
31
31
|
(0, _loaders.cssLoader)(context),
|
|
32
|
-
|
|
32
|
+
(0, _loaders.sassLoader)()
|
|
33
33
|
]
|
|
34
34
|
}
|
|
35
35
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/webpack/configs/rules/scss-rules.ts"],"sourcesContent":["import { RuleSetRule } from 'webpack';\nimport { BuildContext } from '../../../core';\nimport { cssLoader, styleLoader } from '../loaders';\n\nexport function scssRules(context: BuildContext): RuleSetRule[] {\n return [\n {\n test: /\\.module.scss$/,\n use: [\n styleLoader(context, { esModule: true }),\n cssLoader(context, { esModule: true }),\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/webpack/configs/rules/scss-rules.ts"],"sourcesContent":["import { RuleSetRule } from 'webpack';\nimport { BuildContext } from '../../../core';\nimport { cssLoader, sassLoader, styleLoader } from '../loaders';\n\nexport function scssRules(context: BuildContext): RuleSetRule[] {\n return [\n {\n test: /\\.module.scss$/,\n use: [\n styleLoader(context, { esModule: true }),\n cssLoader(context, { esModule: true }),\n sassLoader(),\n ],\n },\n {\n test: /(\\.scss)$/,\n exclude: /\\.module.scss$/,\n use: [styleLoader(context), cssLoader(context), sassLoader()],\n },\n ];\n}\n"],"names":["scssRules","context","test","use","styleLoader","esModule","cssLoader","sassLoader","exclude"],"mappings":";;;;+BAIgBA;;;eAAAA;;;yBAFmC;AAE5C,SAASA,UAAUC,OAAqB;IAC3C,OAAO;QACH;YACIC,MAAM;YACNC,KAAK;gBACDC,IAAAA,oBAAW,EAACH,SAAS;oBAAEI,UAAU;gBAAK;gBACtCC,IAAAA,kBAAS,EAACL,SAAS;oBAAEI,UAAU;gBAAK;gBACpCE,IAAAA,mBAAU;aACb;QACL;QACA;YACIL,MAAM;YACNM,SAAS;YACTL,KAAK;gBAACC,IAAAA,oBAAW,EAACH;gBAAUK,IAAAA,kBAAS,EAACL;gBAAUM,IAAAA,mBAAU;aAAG;QACjE;KACH;AACL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/startup",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "39.0.0",
|
|
4
4
|
"description": "CLI to create multi-package Lerna projects with TypeScript and React",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/uikit/startup",
|
|
6
6
|
"repository": {
|
|
@@ -103,10 +103,10 @@
|
|
|
103
103
|
"@jest/core": "~30.4.2",
|
|
104
104
|
"@jest/types": "~30.4.1",
|
|
105
105
|
"@jsdevtools/coverage-istanbul-loader": "^3.0.5",
|
|
106
|
-
"@servicetitan/eslint-config": "
|
|
107
|
-
"@servicetitan/install": "
|
|
108
|
-
"@servicetitan/startup-utils": "
|
|
109
|
-
"@servicetitan/stylelint-config": "
|
|
106
|
+
"@servicetitan/eslint-config": "39.0.0",
|
|
107
|
+
"@servicetitan/install": "39.0.0",
|
|
108
|
+
"@servicetitan/startup-utils": "39.0.0",
|
|
109
|
+
"@servicetitan/stylelint-config": "39.0.0",
|
|
110
110
|
"@svgr/webpack": "^8.1.0",
|
|
111
111
|
"@swc/cli": "^0.8.1",
|
|
112
112
|
"@swc/core": "1.15.46",
|
|
@@ -203,5 +203,5 @@
|
|
|
203
203
|
"cli": {
|
|
204
204
|
"webpack": false
|
|
205
205
|
},
|
|
206
|
-
"gitHead": "
|
|
206
|
+
"gitHead": "9138e3fcda061941b89620b9004426f5c13a89ae"
|
|
207
207
|
}
|
|
@@ -2,6 +2,7 @@ import { npmWhoAmI } from '@servicetitan/install';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import Table from 'cli-table3';
|
|
4
4
|
import { vol } from 'memfs';
|
|
5
|
+
import path from 'path';
|
|
5
6
|
import { createInterface } from 'readline/promises';
|
|
6
7
|
import { formatRelativeDate, toArray } from '../../../utils';
|
|
7
8
|
import { isTTY, npmView, runCommand } from '../../utils';
|
|
@@ -237,13 +238,11 @@ describe(`[startup] ${MFEList.name}`, () => {
|
|
|
237
238
|
test('outputs all published versions', async () => {
|
|
238
239
|
await subject();
|
|
239
240
|
|
|
240
|
-
expectTable(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
},
|
|
246
|
-
]);
|
|
241
|
+
expectTable({
|
|
242
|
+
name: mfeName,
|
|
243
|
+
tags: distTags,
|
|
244
|
+
versions: Object.entries(time),
|
|
245
|
+
});
|
|
247
246
|
});
|
|
248
247
|
});
|
|
249
248
|
|
|
@@ -253,13 +252,11 @@ describe(`[startup] ${MFEList.name}`, () => {
|
|
|
253
252
|
test('outputs specified number of versions', async () => {
|
|
254
253
|
await subject();
|
|
255
254
|
|
|
256
|
-
expectTable(
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
},
|
|
262
|
-
]);
|
|
255
|
+
expectTable({
|
|
256
|
+
name: mfeName,
|
|
257
|
+
tags: distTags,
|
|
258
|
+
versions: Object.entries(time).slice(0, args.limit),
|
|
259
|
+
});
|
|
263
260
|
});
|
|
264
261
|
});
|
|
265
262
|
|
|
@@ -269,6 +266,31 @@ describe(`[startup] ${MFEList.name}`, () => {
|
|
|
269
266
|
itOmitsTable();
|
|
270
267
|
});
|
|
271
268
|
|
|
269
|
+
describe('when MFE config is a path', () => {
|
|
270
|
+
const configFile = 'web-component.config.js';
|
|
271
|
+
|
|
272
|
+
beforeEach(() => {
|
|
273
|
+
volFromJSON({
|
|
274
|
+
[configFile]: '',
|
|
275
|
+
'packages/mfe/package.json': JSON.stringify({
|
|
276
|
+
name: mfeName,
|
|
277
|
+
cli: { 'web-component': `../../${configFile}` },
|
|
278
|
+
}),
|
|
279
|
+
});
|
|
280
|
+
jest.doMock(path.resolve(configFile), () => ({}), { virtual: true });
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
test('outputs table', async () => {
|
|
284
|
+
await subject();
|
|
285
|
+
|
|
286
|
+
expectTable({
|
|
287
|
+
name: mfeName,
|
|
288
|
+
tags: distTags,
|
|
289
|
+
versions: Object.entries(time).slice(0, DEFAULT_LIMIT),
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
|
|
272
294
|
describe('when workspace has multiple MFEs', () => {
|
|
273
295
|
const otherMfeName = `${mfeName}2`; // ensure sorts after first name
|
|
274
296
|
|
|
@@ -141,7 +141,7 @@ export class MFEList extends Command<typeof entry> {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
return getPackages({ ignore: this.args.ignore, type: PackageType.Bundle })
|
|
144
|
-
.filter(isWebComponent)
|
|
144
|
+
.filter(({ location }) => isWebComponent(location))
|
|
145
145
|
.map(({ name }) => name)
|
|
146
146
|
.sort((a, b) => collator.compare(a, b));
|
|
147
147
|
}
|
|
@@ -2,6 +2,7 @@ import { fs, vol } from 'memfs';
|
|
|
2
2
|
import type { OutputBundle } from 'rolldown';
|
|
3
3
|
import { type BuildContext, generateMetadata } from '../../../core';
|
|
4
4
|
import { metadataPlugin } from '../metadata-plugin';
|
|
5
|
+
import { VIRTUAL_PREFIX } from '../virtual-modules-plugin';
|
|
5
6
|
|
|
6
7
|
jest.mock('fs', () => fs);
|
|
7
8
|
jest.mock('../../../core', () => ({
|
|
@@ -83,7 +84,7 @@ describe(metadataPlugin.name, () => {
|
|
|
83
84
|
module: true,
|
|
84
85
|
port: defaultAddress.port,
|
|
85
86
|
css: [],
|
|
86
|
-
js: ['@vite/client',
|
|
87
|
+
js: ['@vite/client', `@id/__x00__${VIRTUAL_PREFIX.slice(1)}./index`],
|
|
87
88
|
});
|
|
88
89
|
});
|
|
89
90
|
|
|
@@ -3,6 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import type { Plugin } from 'vite';
|
|
4
4
|
import { BuildContext, generateMetadata } from '../../core';
|
|
5
5
|
import { getCssFileNames } from './utils';
|
|
6
|
+
import { VIRTUAL_PREFIX } from './virtual-modules-plugin';
|
|
6
7
|
|
|
7
8
|
export function metadataPlugin(context: BuildContext): Plugin | undefined {
|
|
8
9
|
if (!context.package.isWebComponent) {
|
|
@@ -27,7 +28,7 @@ export function metadataPlugin(context: BuildContext): Plugin | undefined {
|
|
|
27
28
|
module: true,
|
|
28
29
|
port: address.port,
|
|
29
30
|
css: [],
|
|
30
|
-
js: ['@vite/client',
|
|
31
|
+
js: ['@vite/client', `@id/__x00__${VIRTUAL_PREFIX.slice(1)}./index`],
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
const entrypointsPath = path.join(outDir, 'entrypoints.json');
|
|
@@ -2,8 +2,9 @@ import path from 'path';
|
|
|
2
2
|
import type { Plugin } from 'vite';
|
|
3
3
|
import { BuildContext, virtualModules } from '../../core';
|
|
4
4
|
|
|
5
|
+
export const VIRTUAL_PREFIX = '\0virtual-modules:';
|
|
6
|
+
|
|
5
7
|
export function virtualModulesPlugin(context: BuildContext): Plugin | undefined {
|
|
6
|
-
const VIRTUAL_PREFIX = '\0virtual-modules:';
|
|
7
8
|
const VIRTUAL_ID_PATTERN = new RegExp(`^${VIRTUAL_PREFIX}`);
|
|
8
9
|
|
|
9
10
|
const { destination } = context.package;
|
|
@@ -12,7 +12,11 @@ export const styleRules: Record<string, StyleRule> = {
|
|
|
12
12
|
'.scss': {
|
|
13
13
|
test: /(\.scss)$/,
|
|
14
14
|
exclude: /\.module.scss$/,
|
|
15
|
-
use: [
|
|
15
|
+
use: [
|
|
16
|
+
'style-loader',
|
|
17
|
+
'css-loader',
|
|
18
|
+
{ loader: 'sass-loader', options: { sassOptions: { charset: false } } },
|
|
19
|
+
],
|
|
16
20
|
},
|
|
17
21
|
'.less': {
|
|
18
22
|
test: /(\.less)$/,
|
|
@@ -64,7 +68,7 @@ export const styleRules: Record<string, StyleRule> = {
|
|
|
64
68
|
},
|
|
65
69
|
},
|
|
66
70
|
},
|
|
67
|
-
'sass-loader',
|
|
71
|
+
{ loader: 'sass-loader', options: { sassOptions: { charset: false } } },
|
|
68
72
|
],
|
|
69
73
|
},
|
|
70
74
|
'.module.less': {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function sassLoader() {
|
|
2
|
+
return {
|
|
3
|
+
loader: 'sass-loader',
|
|
4
|
+
options: {
|
|
5
|
+
sassOptions: {
|
|
6
|
+
/*
|
|
7
|
+
* Turn off charset to prevent Dart Sass from injecting BOM when file
|
|
8
|
+
* contains a non-ASCII character. Concatenating multiple modules' CSS then leaves that
|
|
9
|
+
* marker in the middle of the bundle, invalidating the selector that follows it.
|
|
10
|
+
*/
|
|
11
|
+
charset: false,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RuleSetRule } from 'webpack';
|
|
2
2
|
import { BuildContext } from '../../../core';
|
|
3
|
-
import { cssLoader, styleLoader } from '../loaders';
|
|
3
|
+
import { cssLoader, sassLoader, styleLoader } from '../loaders';
|
|
4
4
|
|
|
5
5
|
export function scssRules(context: BuildContext): RuleSetRule[] {
|
|
6
6
|
return [
|
|
@@ -9,13 +9,13 @@ export function scssRules(context: BuildContext): RuleSetRule[] {
|
|
|
9
9
|
use: [
|
|
10
10
|
styleLoader(context, { esModule: true }),
|
|
11
11
|
cssLoader(context, { esModule: true }),
|
|
12
|
-
|
|
12
|
+
sassLoader(),
|
|
13
13
|
],
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
test: /(\.scss)$/,
|
|
17
17
|
exclude: /\.module.scss$/,
|
|
18
|
-
use: [styleLoader(context), cssLoader(context),
|
|
18
|
+
use: [styleLoader(context), cssLoader(context), sassLoader()],
|
|
19
19
|
},
|
|
20
20
|
];
|
|
21
21
|
}
|