@genesislcap/vite-builder 14.429.2 → 14.430.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/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/vite.d.ts +1 -0
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +3 -1
- package/package.json +4 -3
- package/src/index.ts +10 -1
- package/src/vite.ts +3 -0
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAc3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;yBAEmB,KAAK,YAAY;AAAvC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAc3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;yBAEmB,KAAK,YAAY;AAAvC,wBA2KE"}
|
package/dist/index.js
CHANGED
|
@@ -31,11 +31,19 @@ const vite_js_1 = require("./vite.js");
|
|
|
31
31
|
* This has the added benefit of aligning with the current production app builds.
|
|
32
32
|
*/
|
|
33
33
|
exports.default = (ctx) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
+
var _a, _b, _c;
|
|
34
35
|
const { config: { app: { rootElement }, env, http, }, dirs: { cwd }, cli: { isDev, isBuild, isAnalyze, options: { open, https }, }, pkg: { description }, resolve: { alias }, } = ctx;
|
|
35
36
|
const define = (0, build_kit_1.resolveDefineConfig)(env, http, 'vite');
|
|
36
37
|
const handlebars = yield (0, vite_js_1.getHandlebarsModule)();
|
|
37
38
|
const vite = yield (0, vite_js_1.getViteModule)();
|
|
38
39
|
const publicPath = (0, build_kit_1.getPublicPath)();
|
|
40
|
+
const tsconfigPath = (0, node_path_1.resolve)(cwd, 'tsconfig.json');
|
|
41
|
+
const buildMode = (_c = (_b = (_a = ctx.config.vite) === null || _a === void 0 ? void 0 : _a.checker) === null || _b === void 0 ? void 0 : _b.buildMode) !== null && _c !== void 0 ? _c : false;
|
|
42
|
+
const checkerPlugin = (0, node_fs_1.existsSync)(tsconfigPath)
|
|
43
|
+
? (yield (0, vite_js_1.getCheckerModule)())({
|
|
44
|
+
typescript: { tsconfigPath, buildMode },
|
|
45
|
+
})
|
|
46
|
+
: null;
|
|
39
47
|
const baseHrefPlugin = {
|
|
40
48
|
name: 'genesis-base-href',
|
|
41
49
|
transformIndexHtml(html) {
|
|
@@ -47,6 +55,7 @@ exports.default = (ctx) => tslib_1.__awaiter(void 0, void 0, void 0, function* (
|
|
|
47
55
|
const config = {
|
|
48
56
|
plugins: [
|
|
49
57
|
baseHrefPlugin,
|
|
58
|
+
...(checkerPlugin ? [checkerPlugin] : []),
|
|
50
59
|
handlebars({
|
|
51
60
|
context: {
|
|
52
61
|
// Template is shared with Webpack HTML plugin, which expects the data structure below
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
export declare const getHandlebarsModule: () => Promise<(...args: any) => Promise<Plugin>>;
|
|
3
|
+
export declare const getCheckerModule: () => Promise<(...args: any) => Plugin>;
|
|
3
4
|
export declare const getViteModule: () => Promise<{
|
|
4
5
|
build: any;
|
|
5
6
|
createServer: any;
|
package/dist/vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAW9B,eAAO,MAAM,mBAAmB,0BACuC,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA,CAAC;AAE/F,eAAO,MAAM,aAAa;;;EAMzB,CAAC"}
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAW9B,eAAO,MAAM,mBAAmB,0BACuC,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA,CAAC;AAE/F,eAAO,MAAM,gBAAgB,0BACuC,GAAG,KAAK,MAAM,CAAA,CAAC;AAEnF,eAAO,MAAM,aAAa;;;EAMzB,CAAC"}
|
package/dist/vite.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getViteModule = exports.getHandlebarsModule = void 0;
|
|
3
|
+
exports.getViteModule = exports.getCheckerModule = exports.getHandlebarsModule = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
/**
|
|
6
6
|
* This is a glue layer to import the ESM modules into the commonjs plugin.
|
|
@@ -12,6 +12,8 @@ const tslib_1 = require("tslib");
|
|
|
12
12
|
const dynamicImport = new Function('specifier', 'return import(specifier)');
|
|
13
13
|
const getHandlebarsModule = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return (yield dynamicImport('vite-plugin-handlebars')).default; });
|
|
14
14
|
exports.getHandlebarsModule = getHandlebarsModule;
|
|
15
|
+
const getCheckerModule = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return (yield dynamicImport('vite-plugin-checker')).default; });
|
|
16
|
+
exports.getCheckerModule = getCheckerModule;
|
|
15
17
|
const getViteModule = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
16
18
|
const vite = yield dynamicImport('vite');
|
|
17
19
|
return {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/vite-builder",
|
|
3
3
|
"description": "Vite builder",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.430.0",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -16,10 +16,11 @@
|
|
|
16
16
|
"lint:fix": "genx lint --fix"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@genesislcap/build-kit": "14.
|
|
19
|
+
"@genesislcap/build-kit": "14.430.0",
|
|
20
20
|
"consola": "^3.0.2",
|
|
21
21
|
"copyfiles": "^2.4.1",
|
|
22
22
|
"vite": "^7.2.2",
|
|
23
|
+
"vite-plugin-checker": "^0.11.0",
|
|
23
24
|
"vite-plugin-handlebars": "2.0.0"
|
|
24
25
|
},
|
|
25
26
|
"repository": {
|
|
@@ -30,5 +31,5 @@
|
|
|
30
31
|
"publishConfig": {
|
|
31
32
|
"access": "public"
|
|
32
33
|
},
|
|
33
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "cd88c05bb6e4995f0a1ca4102345d3cb73d94c6c"
|
|
34
35
|
}
|
package/src/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '@genesislcap/build-kit';
|
|
13
13
|
import consola from 'consola';
|
|
14
14
|
import type { Plugin, UserConfig, ProxyOptions } from 'vite';
|
|
15
|
-
import { getHandlebarsModule, getViteModule } from './vite.js';
|
|
15
|
+
import { getCheckerModule, getHandlebarsModule, getViteModule } from './vite.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* There seems to be various documented issues using Vite in a monorepo setup that are impacted by various factors.
|
|
@@ -63,6 +63,14 @@ export default async (ctx: BuildContext) => {
|
|
|
63
63
|
|
|
64
64
|
const publicPath = getPublicPath();
|
|
65
65
|
|
|
66
|
+
const tsconfigPath = resolve(cwd, 'tsconfig.json');
|
|
67
|
+
const buildMode = ctx.config.vite?.checker?.buildMode ?? false;
|
|
68
|
+
const checkerPlugin = existsSync(tsconfigPath)
|
|
69
|
+
? (await getCheckerModule())({
|
|
70
|
+
typescript: { tsconfigPath, buildMode },
|
|
71
|
+
})
|
|
72
|
+
: null;
|
|
73
|
+
|
|
66
74
|
const baseHrefPlugin: Plugin = {
|
|
67
75
|
name: 'genesis-base-href',
|
|
68
76
|
transformIndexHtml(html) {
|
|
@@ -74,6 +82,7 @@ export default async (ctx: BuildContext) => {
|
|
|
74
82
|
const config: UserConfig = {
|
|
75
83
|
plugins: [
|
|
76
84
|
baseHrefPlugin,
|
|
85
|
+
...(checkerPlugin ? [checkerPlugin] : []),
|
|
77
86
|
handlebars({
|
|
78
87
|
context: {
|
|
79
88
|
// Template is shared with Webpack HTML plugin, which expects the data structure below
|
package/src/vite.ts
CHANGED
|
@@ -12,6 +12,9 @@ const dynamicImport = new Function('specifier', 'return import(specifier)');
|
|
|
12
12
|
export const getHandlebarsModule = async () =>
|
|
13
13
|
(await dynamicImport('vite-plugin-handlebars')).default as (...args: any) => Promise<Plugin>;
|
|
14
14
|
|
|
15
|
+
export const getCheckerModule = async () =>
|
|
16
|
+
(await dynamicImport('vite-plugin-checker')).default as (...args: any) => Plugin;
|
|
17
|
+
|
|
15
18
|
export const getViteModule = async () => {
|
|
16
19
|
const vite = await dynamicImport('vite');
|
|
17
20
|
return {
|