@simplysm/sd-cli 11.0.3 → 11.0.5

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 (50) hide show
  1. package/dist/build-cluster.js +1 -1
  2. package/dist/build-cluster.js.map +1 -1
  3. package/dist/build-tools/SdLinter.js +2 -2
  4. package/dist/build-tools/SdLinter.js.map +1 -1
  5. package/dist/build-tools/SdNgBundler.d.ts +23 -0
  6. package/dist/build-tools/SdNgBundler.js +331 -0
  7. package/dist/build-tools/SdNgBundler.js.map +1 -0
  8. package/dist/build-tools/SdTsBundler.d.ts +15 -0
  9. package/dist/build-tools/SdTsBundler.js +96 -0
  10. package/dist/build-tools/SdTsBundler.js.map +1 -0
  11. package/dist/build-tools/SdTsCompiler.d.ts +28 -0
  12. package/dist/build-tools/SdTsCompiler.js +212 -0
  13. package/dist/build-tools/SdTsCompiler.js.map +1 -0
  14. package/dist/builders/SdCliClientBuilder.d.ts +4 -2
  15. package/dist/builders/SdCliClientBuilder.js +60 -297
  16. package/dist/builders/SdCliClientBuilder.js.map +1 -1
  17. package/dist/builders/SdCliServerBuilder.js +79 -216
  18. package/dist/builders/SdCliServerBuilder.js.map +1 -1
  19. package/dist/builders/SdCliTsLibBuilder.d.ts +0 -1
  20. package/dist/builders/SdCliTsLibBuilder.js +35 -33
  21. package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
  22. package/dist/commons.d.ts +7 -0
  23. package/dist/entry/SdCliProject.js +13 -10
  24. package/dist/entry/SdCliProject.js.map +1 -1
  25. package/dist/index.d.ts +3 -1
  26. package/dist/index.js +3 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/server-worker.js +3 -0
  29. package/dist/server-worker.js.map +1 -1
  30. package/dist/utils/SdCliBuildResultUtil.d.ts +1 -1
  31. package/dist/utils/SdCliBuildResultUtil.js +4 -4
  32. package/dist/utils/SdCliBuildResultUtil.js.map +1 -1
  33. package/package.json +14 -12
  34. package/src/build-cluster.ts +1 -1
  35. package/src/build-tools/SdLinter.ts +2 -2
  36. package/src/build-tools/SdNgBundler.ts +404 -0
  37. package/src/build-tools/SdTsBundler.ts +106 -0
  38. package/src/build-tools/SdTsCompiler.ts +304 -0
  39. package/src/builders/SdCliClientBuilder.ts +75 -322
  40. package/src/builders/SdCliServerBuilder.ts +95 -243
  41. package/src/builders/SdCliTsLibBuilder.ts +39 -40
  42. package/src/commons.ts +6 -0
  43. package/src/entry/SdCliProject.ts +17 -12
  44. package/src/index.ts +3 -1
  45. package/src/server-worker.ts +3 -0
  46. package/src/utils/SdCliBuildResultUtil.ts +4 -4
  47. package/dist/build-tools/SdTsIncrementalBuilder.d.ts +0 -31
  48. package/dist/build-tools/SdTsIncrementalBuilder.js +0 -126
  49. package/dist/build-tools/SdTsIncrementalBuilder.js.map +0 -1
  50. package/src/build-tools/SdTsIncrementalBuilder.ts +0 -207
@@ -0,0 +1,404 @@
1
+ import {
2
+ createCompilerPlugin,
3
+ SourceFileCache
4
+ } from "@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin";
5
+ import {NormalizedApplicationBuildOptions} from "@angular-devkit/build-angular/src/builders/application/options";
6
+ import path from "path";
7
+ import {CrossOrigin} from "@angular-devkit/build-angular/src/builders/application/schema";
8
+ import {BundlerContext} from "@angular-devkit/build-angular/src/tools/esbuild/bundler-context";
9
+ import esbuild from "esbuild";
10
+ import {createCompilerPluginOptions} from "@angular-devkit/build-angular/src/tools/esbuild/compiler-plugin-options";
11
+ import {FsUtil, Logger, PathUtil} from "@simplysm/sd-core-node";
12
+ import {fileURLToPath} from "url";
13
+ import {createVirtualModulePlugin} from "@angular-devkit/build-angular/src/tools/esbuild/virtual-module-plugin";
14
+ import {
15
+ createSourcemapIgnorelistPlugin
16
+ } from "@angular-devkit/build-angular/src/tools/esbuild/sourcemap-ignorelist-plugin";
17
+ import nodeStdLibBrowser from "node-stdlib-browser";
18
+ import nodeStdLibBrowserPlugin from "node-stdlib-browser/helpers/esbuild/plugin";
19
+ import {ExecutionResult} from "@angular-devkit/build-angular/src/tools/esbuild/bundler-execution-result";
20
+ import {INpmConfig, ISdCliPackageBuildResult} from "../commons";
21
+ import {generateIndexHtml} from "@angular-devkit/build-angular/src/tools/esbuild/index-html-generator";
22
+ import {copyAssets} from "@angular-devkit/build-angular/src/utils/copy-assets";
23
+ import {extractLicenses} from "@angular-devkit/build-angular/src/tools/esbuild/license-extractor";
24
+ import {augmentAppWithServiceWorkerEsbuild} from "@angular-devkit/build-angular/src/utils/service-worker";
25
+ import {createGlobalStylesBundleOptions} from "@angular-devkit/build-angular/src/tools/esbuild/global-styles";
26
+
27
+ export class SdNgBundler {
28
+ private readonly _logger = Logger.get(["simplysm", "sd-cli", "SdNgEsbuildBuilder"]);
29
+
30
+ private readonly _sourceFileCache = new SourceFileCache();
31
+ private readonly _options: NormalizedApplicationBuildOptions;
32
+
33
+ private _contexts: BundlerContext[] | undefined;
34
+
35
+ private readonly _outputCache = new Map<string, string | number>();
36
+
37
+ public constructor(private readonly _opt: { dev: boolean, builderType: string, pkgPath: string }) {
38
+ this._options = this._getOptions(_opt);
39
+ }
40
+
41
+ public removeCache(filePaths: string[]): void {
42
+ this._sourceFileCache.invalidate(filePaths);
43
+ }
44
+
45
+ public async bundleAsync(): Promise<{
46
+ filePaths: string[],
47
+ results: ISdCliPackageBuildResult[]
48
+ }> {
49
+ if (!this._contexts) {
50
+ this._contexts = [];
51
+ this._contexts.push(await this._getAppContextAsync());
52
+ this._contexts.push(this._getStyleContext());
53
+ }
54
+
55
+ //-- build
56
+ const bundlingResult = await BundlerContext.bundleAll(this._contexts);
57
+
58
+ const results = [
59
+ ...bundlingResult.warnings.map((warn) => ({
60
+ filePath: warn.location?.file !== undefined ? path.resolve(this._opt.pkgPath, warn.location.file) : undefined,
61
+ line: warn.location?.line,
62
+ char: warn.location?.column,
63
+ code: undefined,
64
+ severity: "warning" as const,
65
+ message: warn.text.replace(/^(NG|TS)[0-9]+: /, ""),
66
+ type: "build" as const
67
+ })),
68
+ ...bundlingResult.errors?.map((err) => ({
69
+ filePath: err.location?.file !== undefined ? path.resolve(this._opt.pkgPath, err.location.file) : undefined,
70
+ line: err.location?.line,
71
+ char: err.location?.column !== undefined ? err.location.column + 1 : undefined,
72
+ code: undefined,
73
+ severity: "error" as const,
74
+ message: err.text.replace(/^[^:]*: /, ""),
75
+ type: "build" as const
76
+ })) ?? []
77
+ ];
78
+ if (bundlingResult.errors) {
79
+ return {
80
+ filePaths: [
81
+ ...this._sourceFileCache.typeScriptFileCache.keys(),
82
+ ...this._sourceFileCache.babelFileCache.keys()
83
+ ],
84
+ results
85
+ };
86
+ }
87
+
88
+ const executionResult = new ExecutionResult(this._contexts, this._sourceFileCache);
89
+ executionResult.outputFiles.push(...bundlingResult.outputFiles);
90
+
91
+ //-- index
92
+ if (this._options.indexHtmlOptions) {
93
+ const genIndexHtmlResult = await generateIndexHtml(
94
+ bundlingResult.initialFiles,
95
+ executionResult,
96
+ this._options
97
+ );
98
+ if (genIndexHtmlResult.warnings.length > 0) {
99
+ this._logger.warn(...genIndexHtmlResult.warnings);
100
+ }
101
+ if (genIndexHtmlResult.errors.length > 0) {
102
+ this._logger.warn(...genIndexHtmlResult.errors);
103
+ }
104
+
105
+ executionResult.addOutputFile(this._options.indexHtmlOptions!.output, genIndexHtmlResult.content);
106
+ }
107
+
108
+ //-- copy assets
109
+ if (this._options.assets) {
110
+ executionResult.assetFiles.push(...(await copyAssets(this._options.assets!, [], this._options.workspaceRoot)));
111
+ }
112
+
113
+ //-- extract 3rdpartylicenses
114
+ if (this._options.extractLicenses) {
115
+ executionResult.addOutputFile('3rdpartylicenses.txt', await extractLicenses(bundlingResult.metafile, this._options.workspaceRoot));
116
+ }
117
+
118
+ //-- service worker
119
+ if (this._options.serviceWorker !== undefined) {
120
+ try {
121
+ const serviceWorkerResult = await augmentAppWithServiceWorkerEsbuild(
122
+ this._options.workspaceRoot,
123
+ this._options.serviceWorker,
124
+ this._options.baseHref ?? '/',
125
+ executionResult.outputFiles,
126
+ executionResult.assetFiles
127
+ );
128
+ executionResult.addOutputFile('ngsw.json', serviceWorkerResult.manifest);
129
+ executionResult.assetFiles.push(...serviceWorkerResult.assetFiles);
130
+ }
131
+ catch (error) {
132
+ this._logger.error(error instanceof Error ? error.message : `${error}`);
133
+
134
+ return {
135
+ filePaths: [
136
+ ...this._sourceFileCache.typeScriptFileCache.keys(),
137
+ ...this._sourceFileCache.babelFileCache.keys()
138
+ ],
139
+ results
140
+ };
141
+ }
142
+ }
143
+
144
+ //-- write
145
+
146
+ const distPath = path.resolve(this._options.outputPath, "dist", ...(this._opt.builderType === "web" ? [] : [this._opt.builderType]));
147
+ for (const outputFile of executionResult.outputFiles) {
148
+ const distFilePath = path.resolve(distPath, outputFile.path);
149
+
150
+ const prev = this._outputCache.get(distFilePath);
151
+ if (prev !== Buffer.from(outputFile.contents).toString("base64")) {
152
+ await FsUtil.writeFileAsync(distFilePath, outputFile.contents);
153
+ this._outputCache.set(distFilePath, Buffer.from(outputFile.contents).toString("base64"));
154
+ }
155
+ }
156
+ for (const assetFile of executionResult.assetFiles) {
157
+ const prev = this._outputCache.get(assetFile.source);
158
+ const curr = FsUtil.lstat(assetFile.source).mtime.getTime();
159
+ if (prev !== curr) {
160
+ await FsUtil.copyAsync(assetFile.source, path.resolve(distPath, assetFile.destination));
161
+ this._outputCache.set(assetFile.source, curr);
162
+ }
163
+ }
164
+
165
+ return {
166
+ filePaths: [
167
+ ...this._sourceFileCache.typeScriptFileCache.keys(),
168
+ ...this._sourceFileCache.babelFileCache.keys()
169
+ ],
170
+ results
171
+ };
172
+ }
173
+
174
+ private async _getAppContextAsync(): Promise<BundlerContext> {
175
+ const esbuildOption = await this._getEsBuildOptionsAsync();
176
+
177
+ return new BundlerContext(
178
+ this._options.workspaceRoot,
179
+ true,
180
+ esbuildOption
181
+ );
182
+ }
183
+
184
+ private _getStyleContext(): BundlerContext {
185
+ const esbuildOptions = createGlobalStylesBundleOptions(
186
+ this._options,
187
+ [
188
+ 'chrome117.0', 'chrome116.0',
189
+ 'edge117.0', 'edge116.0',
190
+ 'firefox118.0', 'firefox115.0',
191
+ 'ios17.0', 'ios16.6',
192
+ 'ios16.5', 'ios16.4',
193
+ 'ios16.3', 'ios16.2',
194
+ 'ios16.1', 'ios16.0',
195
+ 'safari17.0', 'safari16.6',
196
+ 'safari16.5', 'safari16.4',
197
+ 'safari16.3', 'safari16.2',
198
+ 'safari16.1', 'safari16.0'
199
+ ],
200
+ true,
201
+ this._sourceFileCache.loadResultCache
202
+ );
203
+
204
+ return new BundlerContext(
205
+ this._options.workspaceRoot,
206
+ true,
207
+ esbuildOptions!,
208
+ () => true
209
+ );
210
+ }
211
+
212
+ private async _getEsBuildOptionsAsync(): Promise<esbuild.BuildOptions> {
213
+ const pkgNpmConf: INpmConfig = FsUtil.readJson(path.resolve(this._options.workspaceRoot, "package.json"));
214
+
215
+ const {pluginOptions, styleOptions} = createCompilerPluginOptions(
216
+ this._options,
217
+ [
218
+ 'chrome117.0', 'chrome116.0',
219
+ 'edge117.0', 'edge116.0',
220
+ 'firefox118.0', 'firefox115.0',
221
+ 'ios17.0', 'ios16.6',
222
+ 'ios16.5', 'ios16.4',
223
+ 'ios16.3', 'ios16.2',
224
+ 'ios16.1', 'ios16.0',
225
+ 'safari17.0', 'safari16.6',
226
+ 'safari16.5', 'safari16.4',
227
+ 'safari16.3', 'safari16.2',
228
+ 'safari16.1', 'safari16.0'
229
+ ],
230
+ this._sourceFileCache,
231
+ );
232
+
233
+ return {
234
+ absWorkingDir: this._options.workspaceRoot,
235
+ bundle: true,
236
+ keepNames: true,
237
+ format: 'esm',
238
+ assetNames: 'media/[name]',
239
+ conditions: ['es2020', 'es2015', 'module'],
240
+ resolveExtensions: ['.ts', '.tsx', '.mjs', '.js'],
241
+ metafile: true,
242
+ legalComments: this._options.watch ? 'eof' : 'none',
243
+ logLevel: 'silent',
244
+ minifyIdentifiers: !this._options.watch,
245
+ minifySyntax: !this._options.watch,
246
+ minifyWhitespace: !this._options.watch,
247
+ pure: ['forwardRef'],
248
+ outdir: this._options.outputPath,
249
+ outExtension: undefined,
250
+ sourcemap: this._options.watch,
251
+ splitting: true,
252
+ chunkNames: 'chunk-[hash]',
253
+ tsconfig: this._options.tsconfig,
254
+ external: [],
255
+ write: false,
256
+ preserveSymlinks: false,
257
+ define: {
258
+ ...!this._options.watch ? {ngDevMode: 'false'} : {},
259
+ ngJitMode: 'false',
260
+ global: 'global',
261
+ process: 'process',
262
+ Buffer: 'Buffer',
263
+ 'process.env.SD_VERSION': JSON.stringify(pkgNpmConf.version),
264
+ },
265
+ platform: 'browser',
266
+ mainFields: ['es2020', 'es2015', 'browser', 'module', 'main'],
267
+ entryNames: '[name]',
268
+ entryPoints: {
269
+ ...this._options.entryPoints,
270
+ polyfills: 'angular:polyfills'
271
+ },
272
+ target: [
273
+ 'chrome117.0', 'chrome116.0',
274
+ 'edge117.0', 'edge116.0',
275
+ 'firefox118.0', 'firefox115.0',
276
+ 'ios17.0', 'ios16.6',
277
+ 'ios16.5', 'ios16.4',
278
+ 'ios16.3', 'ios16.2',
279
+ 'ios16.1', 'ios16.0',
280
+ 'safari17.0', 'safari16.6',
281
+ 'safari16.5', 'safari16.4',
282
+ 'safari16.3', 'safari16.2',
283
+ 'safari16.1', 'safari16.0'
284
+ ],
285
+ supported: {'async-await': false, 'object-rest-spread': false},
286
+ loader: {
287
+ ".png": "file",
288
+ ".jpeg": "file",
289
+ ".jpg": "file",
290
+ ".jfif": "file",
291
+ ".gif": "file",
292
+ ".svg": "file",
293
+ ".woff": "file",
294
+ ".woff2": "file",
295
+ ".ttf": "file",
296
+ ".eot": "file",
297
+ ".ico": "file",
298
+ ".otf": "file",
299
+ ".csv": "file",
300
+ ".xlsx": "file",
301
+ ".xls": "file",
302
+ ".pptx": "file",
303
+ ".ppt": "file",
304
+ ".docx": "file",
305
+ ".doc": "file",
306
+ ".zip": "file",
307
+ ".pfx": "file",
308
+ ".pkl": "file"
309
+ },
310
+ inject: [PathUtil.posix(fileURLToPath(await import.meta.resolve!("node-stdlib-browser/helpers/esbuild/shim")))],
311
+ plugins: [
312
+ createVirtualModulePlugin({
313
+ namespace: "angular:polyfills",
314
+ loadContent: () => ({
315
+ contents: `import "./src/polyfills.ts";`,
316
+ loader: 'js',
317
+ resolveDir: this._options.workspaceRoot
318
+ })
319
+ }) as esbuild.Plugin,
320
+ createSourcemapIgnorelistPlugin(),
321
+ createCompilerPlugin(
322
+ pluginOptions,
323
+ styleOptions
324
+ ) as esbuild.Plugin,
325
+ nodeStdLibBrowserPlugin(nodeStdLibBrowser)
326
+ ]
327
+ };
328
+ }
329
+
330
+ private _getOptions(opt: { dev: boolean, builderType: string, pkgPath: string }): NormalizedApplicationBuildOptions {
331
+ const mainFilePath = path.resolve(opt.pkgPath, "src/main.ts");
332
+ const tsconfigFilePath = path.resolve(opt.pkgPath, "tsconfig.json");
333
+ const indexHtmlFilePath = path.resolve(opt.pkgPath, "src/index.html");
334
+ const swFilePath = path.resolve(opt.pkgPath, "ngsw-config.json");
335
+
336
+ const cacheBasePath = path.resolve(opt.pkgPath, ".cache");
337
+
338
+ const pkgName = path.basename(opt.pkgPath);
339
+
340
+ return {
341
+ advancedOptimizations: true,
342
+ allowedCommonJsDependencies: [],
343
+ baseHref: `/${pkgName}/`,
344
+ cacheOptions: {
345
+ enabled: true,
346
+ basePath: cacheBasePath,
347
+ path: path.resolve(cacheBasePath, opt.builderType)
348
+ },
349
+ crossOrigin: CrossOrigin.None,
350
+ deleteOutputPath: true,
351
+ externalDependencies: [],
352
+ extractLicenses: !opt.dev,
353
+ inlineStyleLanguage: 'scss',
354
+ jit: false,
355
+ stats: false,
356
+ polyfills: ["./src/polyfills.ts"],
357
+ poll: undefined,
358
+ progress: true,
359
+ externalPackages: opt.dev ? true : undefined,
360
+ preserveSymlinks: false,
361
+ stylePreprocessorOptions: {includePaths: []},
362
+ subresourceIntegrity: false,
363
+ serverEntryPoint: undefined,
364
+ prerenderOptions: undefined,
365
+ appShellOptions: undefined,
366
+ ssrOptions: undefined,
367
+ verbose: false,
368
+ watch: opt.dev,
369
+ workspaceRoot: opt.pkgPath,
370
+ entryPoints: {main: mainFilePath},
371
+ optimizationOptions: {
372
+ scripts: !opt.dev,
373
+ styles: {minify: !opt.dev, inlineCritical: !opt.dev},
374
+ fonts: {inline: !opt.dev}
375
+ },
376
+ outputPath: opt.pkgPath,
377
+ outExtension: undefined,
378
+ sourcemapOptions: {vendor: false, hidden: false, scripts: opt.dev, styles: opt.dev},
379
+ tsconfig: tsconfigFilePath,
380
+ projectRoot: opt.pkgPath,
381
+ assets: [
382
+ {glob: 'favicon.ico', input: 'src', output: ''},
383
+ {glob: '**/*', input: 'src\\assets', output: 'assets'}
384
+ ],
385
+ outputNames: {bundles: '[name]', media: 'media/[name]'},
386
+ fileReplacements: undefined,
387
+ globalStyles: [{name: 'styles', files: ["src/styles.scss"], initial: true}],
388
+ globalScripts: [],
389
+ serviceWorker: FsUtil.exists(swFilePath) ? swFilePath : undefined,
390
+ indexHtmlOptions: {
391
+ input: indexHtmlFilePath,
392
+ output: 'index.html',
393
+ insertionOrder: [
394
+ ['runtime', true],
395
+ ['polyfills', true],
396
+ ['styles', false],
397
+ ['vendor', true],
398
+ ['main', true]
399
+ ]
400
+ },
401
+ tailwindConfiguration: undefined
402
+ };
403
+ }
404
+ }
@@ -0,0 +1,106 @@
1
+ import {ISdCliPackageBuildResult} from "../commons";
2
+ import esbuild from "esbuild";
3
+ import path from "path";
4
+ import esbuildPluginTsc from "esbuild-plugin-tsc";
5
+
6
+ export class SdTsBundler {
7
+ private _context?: esbuild.BuildContext;
8
+
9
+ public constructor(private readonly _opt: {
10
+ dev: boolean;
11
+ pkgPath: string;
12
+ entryPoints: string[];
13
+ external?: string[];
14
+ }) {
15
+ }
16
+
17
+ public async bundleAsync(): Promise<ISdCliPackageBuildResult[]> {
18
+ if (!this._context) {
19
+ const options = this.getOptions();
20
+ this._context = await esbuild.context(options);
21
+ }
22
+ const results = await this._context.rebuild();
23
+ return this._convertResults(results);
24
+ }
25
+
26
+ public getOptions(): esbuild.BuildOptions {
27
+ return {
28
+ entryPoints: this._opt.entryPoints,
29
+ keepNames: true,
30
+ bundle: true,
31
+ sourcemap: this._opt.dev,
32
+ target: "node16",
33
+ mainFields: ['es2020', 'es2015', 'module', 'main'],
34
+ conditions: ["es2020", "es2015", "module"],
35
+ tsconfig: path.resolve(this._opt.pkgPath, "tsconfig.json"),
36
+ write: true,
37
+ outdir: path.resolve(this._opt.pkgPath, "dist"),
38
+ format: "esm",
39
+ resolveExtensions: [".js", ".mjs", ".cjs", ".ts"],
40
+ preserveSymlinks: false,
41
+ loader: {
42
+ ".png": "file",
43
+ ".jpeg": "file",
44
+ ".jpg": "file",
45
+ ".jfif": "file",
46
+ ".gif": "file",
47
+ ".svg": "file",
48
+ ".woff": "file",
49
+ ".woff2": "file",
50
+ ".ttf": "file",
51
+ ".eot": "file",
52
+ ".ico": "file",
53
+ ".otf": "file",
54
+ ".csv": "file",
55
+ ".xlsx": "file",
56
+ ".xls": "file",
57
+ ".pptx": "file",
58
+ ".ppt": "file",
59
+ ".docx": "file",
60
+ ".doc": "file",
61
+ ".zip": "file",
62
+ ".pfx": "file",
63
+ ".pkl": "file"
64
+ },
65
+ platform: "node",
66
+ logLevel: "silent",
67
+ external: this._opt.external,
68
+ banner: {
69
+ js: `
70
+ import __path__ from 'path';
71
+ import { fileURLToPath as __fileURLToPath__ } from 'url';
72
+ import { createRequire as __createRequire__ } from 'module';
73
+
74
+ const require = __createRequire__(import.meta.url);
75
+ const __filename = __fileURLToPath__(import.meta.url);
76
+ const __dirname = __path__.dirname(__filename);`.trim()
77
+ },
78
+ plugins: [
79
+ esbuildPluginTsc()
80
+ ]
81
+ };
82
+ }
83
+
84
+ private _convertResults(result: esbuild.BuildResult): ISdCliPackageBuildResult[] {
85
+ return [
86
+ ...result.warnings.map((warn) => ({
87
+ type: "build" as const,
88
+ filePath: warn.location?.file !== undefined ? path.resolve(warn.location.file) : undefined,
89
+ line: warn.location?.line,
90
+ char: warn.location?.column,
91
+ code: undefined,
92
+ severity: "warning" as const,
93
+ message: warn.text
94
+ })),
95
+ ...result.errors.map((err) => ({
96
+ type: "build" as const,
97
+ filePath: err.location?.file !== undefined ? path.resolve(err.location.file) : undefined,
98
+ line: err.location?.line,
99
+ char: err.location?.column !== undefined ? err.location.column + 1 : undefined,
100
+ code: undefined,
101
+ severity: "error" as const,
102
+ message: err.text
103
+ }))
104
+ ];
105
+ }
106
+ }