@liquidlight/vite-framework 1.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/README.md +13 -0
- package/dist/cjs/baseConfig.d.ts +2 -0
- package/dist/cjs/baseConfig.js +70 -0
- package/dist/cjs/baseConfig.js.map +1 -0
- package/dist/cjs/configuration.d.ts +2 -0
- package/dist/cjs/configuration.js +9 -0
- package/dist/cjs/configuration.js.map +1 -0
- package/dist/cjs/index.d.ts +8 -0
- package/dist/cjs/index.js +34 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/types.d.ts +2 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils.d.ts +8 -0
- package/dist/cjs/utils.js +48 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/esm/baseConfig.d.ts +2 -0
- package/dist/esm/baseConfig.js +64 -0
- package/dist/esm/baseConfig.js.map +1 -0
- package/dist/esm/configuration.d.ts +2 -0
- package/dist/esm/configuration.js +6 -0
- package/dist/esm/configuration.js.map +1 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types.d.ts +2 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils.d.ts +8 -0
- package/dist/esm/utils.js +43 -0
- package/dist/esm/utils.js.map +1 -0
- package/package.json +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Vite Framework
|
|
2
|
+
|
|
3
|
+
`@liquidlight/vite-framework` is an opinionated Vite configuration package for TYPO3 projects. It wraps and pre-configures a standard set of Vite plugins and PostCSS tools so you don't have to repeat boilerplate across projects.
|
|
4
|
+
|
|
5
|
+
What it provides out of the box:
|
|
6
|
+
|
|
7
|
+
- TYPO3 integration via `vite-plugin-typo3` for asset manifest handling
|
|
8
|
+
- SVG spritemap generation (`@spiriit/vite-plugin-svg-spritemap`), with automatic `px → em` conversion in generated Sass variables/mixins
|
|
9
|
+
- PostCSS pipeline: autoprefixer, custom media queries, media query sorting, and CSS minification (cssnano)
|
|
10
|
+
- Sass support with Composer vendor paths pre-resolved so TYPO3 site-package Sass can be imported directly
|
|
11
|
+
- A `liquidlight/` path alias resolving into `vendor/liquidlight/` for clean cross-extension imports
|
|
12
|
+
|
|
13
|
+
**For installation & usage, see the [📚 Documentation](https://liquidlight.github.io/vite-framework/).**
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.baseConfig = void 0;
|
|
7
|
+
const vite_plugin_typo3_1 = __importDefault(require("vite-plugin-typo3"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
// Plugins
|
|
10
|
+
const vite_plugin_svg_spritemap_1 = __importDefault(require("@spiriit/vite-plugin-svg-spritemap"));
|
|
11
|
+
const autoprefixer_1 = __importDefault(require("autoprefixer"));
|
|
12
|
+
const cssnano_1 = __importDefault(require("cssnano"));
|
|
13
|
+
// @ts-ignore postcss-custom-media doesn't provide types
|
|
14
|
+
const postcss_custom_media_1 = __importDefault(require("postcss-custom-media"));
|
|
15
|
+
// @ts-ignore postcss-sort-media-queries doesn't provide types
|
|
16
|
+
const postcss_sort_media_queries_1 = __importDefault(require("postcss-sort-media-queries"));
|
|
17
|
+
// Functions
|
|
18
|
+
const utils_js_1 = require("./utils.js");
|
|
19
|
+
exports.baseConfig = {
|
|
20
|
+
plugins: [
|
|
21
|
+
(0, vite_plugin_typo3_1.default)(),
|
|
22
|
+
(0, vite_plugin_svg_spritemap_1.default)('./app/sites/site_package/Resources/Private/Sprite/*.svg', {
|
|
23
|
+
injectSvgOnDev: true,
|
|
24
|
+
styles: {
|
|
25
|
+
lang: 'scss',
|
|
26
|
+
filename: './app/sites/site_package/Resources/Private/Css/src/_sprite.scss',
|
|
27
|
+
include: ['mixin', 'variables'],
|
|
28
|
+
names: {
|
|
29
|
+
mixin: 'viteSprite',
|
|
30
|
+
},
|
|
31
|
+
callback: ({ content }) => {
|
|
32
|
+
const BODY_SIZE = 16;
|
|
33
|
+
content = content.replace(/(?:width|height):\s*(\d+)px/g, (match, p1) => {
|
|
34
|
+
// Divide the captured number by 16 and format to 2 decimal places
|
|
35
|
+
const valueInEm = (p1 / BODY_SIZE).toFixed(2);
|
|
36
|
+
// Return the new string with 'em'
|
|
37
|
+
return `${match.split(':')[0]}: ${valueInEm}em`;
|
|
38
|
+
});
|
|
39
|
+
return content;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
(0, utils_js_1.fixSpritemapPathPlugin)(),
|
|
44
|
+
],
|
|
45
|
+
resolve: {
|
|
46
|
+
alias: {
|
|
47
|
+
// Resolve TYPO3 extension imports like "liquidlight/foundation/..." into vendor dir
|
|
48
|
+
liquidlight: path_1.default.resolve('vendor/liquidlight'),
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
css: {
|
|
52
|
+
preprocessorOptions: {
|
|
53
|
+
scss: {
|
|
54
|
+
includePaths: [
|
|
55
|
+
// Allow Sass imports from Composer-installed TYPO3 site packages
|
|
56
|
+
path_1.default.resolve('vendor'),
|
|
57
|
+
],
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
postcss: {
|
|
61
|
+
plugins: [
|
|
62
|
+
(0, autoprefixer_1.default)(),
|
|
63
|
+
(0, postcss_custom_media_1.default)(),
|
|
64
|
+
(0, postcss_sort_media_queries_1.default)(),
|
|
65
|
+
(0, cssnano_1.default)({ preset: 'default' })
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=baseConfig.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G,EAAE;QACJ,mBAAmB,EAAE;YACpB,IAAI,EAAE;gBACL,YAAY,EAAE;oBACb,iEAAiE;oBACjE,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;iBACtB;aACD;SACD;QACD,OAAO,EAAE;YACR,OAAO,EAAE;gBACR,IAAA,sBAAY,GAAE;gBACd,IAAA,8BAAkB,GAAE;gBACpB,IAAA,oCAAuB,GAAE;gBACzB,IAAA,iBAAO,EAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;aAC9B;SACD;KACD;CACD,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
const baseConfig_js_1 = require("./baseConfig.js");
|
|
5
|
+
const utils_js_1 = require("./utils.js");
|
|
6
|
+
function default_1(configOverride = {}) {
|
|
7
|
+
return (0, utils_js_1.deepMerge)({}, baseConfig_js_1.baseConfig, configOverride);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/configuration.ts"],"names":[],"mappings":";;AAQA,4BAIC;AAPD,mDAA6C;AAC7C,yCAAuC;AAEvC,mBACC,iBAA6B,EAAE;IAE/B,OAAO,IAAA,oBAAS,EAAC,EAAE,EAAE,0BAAU,EAAE,cAAc,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.configuration = exports.baseConfig = void 0;
|
|
21
|
+
/**
|
|
22
|
+
* ====
|
|
23
|
+
* Exports
|
|
24
|
+
* ====
|
|
25
|
+
*/
|
|
26
|
+
// Vite exports to simplify includes
|
|
27
|
+
__exportStar(require("vite"), exports);
|
|
28
|
+
// The base configuration
|
|
29
|
+
var baseConfig_js_1 = require("./baseConfig.js");
|
|
30
|
+
Object.defineProperty(exports, "baseConfig", { enumerable: true, get: function () { return baseConfig_js_1.baseConfig; } });
|
|
31
|
+
// The generated config
|
|
32
|
+
var configuration_js_1 = require("./configuration.js");
|
|
33
|
+
Object.defineProperty(exports, "configuration", { enumerable: true, get: function () { return __importDefault(configuration_js_1).default; } });
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oCAAoC;AACpC,uCAAqB;AAErB,yBAAyB;AACzB,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AAEnB,uBAAuB;AACvB,uDAA8D;AAArD,kIAAA,OAAO,OAAiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PluginOption } from "vite";
|
|
2
|
+
import type { PlainObject } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Functions
|
|
5
|
+
*/
|
|
6
|
+
export declare function fixSpritemapPathPlugin(): PluginOption[];
|
|
7
|
+
export declare function deepMerge<T extends PlainObject>(target: T, ...sources: PlainObject[]): T;
|
|
8
|
+
export declare function isObject(item: any): item is PlainObject;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fixSpritemapPathPlugin = fixSpritemapPathPlugin;
|
|
4
|
+
exports.deepMerge = deepMerge;
|
|
5
|
+
exports.isObject = isObject;
|
|
6
|
+
/**
|
|
7
|
+
* Functions
|
|
8
|
+
*/
|
|
9
|
+
function fixSpritemapPathPlugin() {
|
|
10
|
+
return [{
|
|
11
|
+
name: 'fix-spritemap-path',
|
|
12
|
+
apply: 'build',
|
|
13
|
+
enforce: 'post',
|
|
14
|
+
generateBundle(_, bundle) {
|
|
15
|
+
const spritemapRegex = /url\((["']?)\/assets\/spritemap([^"')]+)\1\)/g;
|
|
16
|
+
for (const asset of Object.values(bundle)) {
|
|
17
|
+
if (asset.type !== 'asset' || !asset.fileName.endsWith('.css') || typeof asset.source !== 'string') {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
asset.source = asset.source.replace(spritemapRegex, 'url($1spritemap$2$1)');
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
}];
|
|
24
|
+
}
|
|
25
|
+
// Allow deep merging of objects
|
|
26
|
+
function deepMerge(target, ...sources) {
|
|
27
|
+
if (!sources.length)
|
|
28
|
+
return target;
|
|
29
|
+
const source = sources.shift();
|
|
30
|
+
if (isObject(target) && isObject(source)) {
|
|
31
|
+
for (const key in source) {
|
|
32
|
+
if (isObject(source[key])) {
|
|
33
|
+
if (!target[key])
|
|
34
|
+
Object.assign(target, { [key]: {} });
|
|
35
|
+
deepMerge(target[key], source[key]);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
Object.assign(target, { [key]: source[key] });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return deepMerge(target, ...sources);
|
|
43
|
+
}
|
|
44
|
+
// Detect if a variable is an object
|
|
45
|
+
function isObject(item) {
|
|
46
|
+
return (item && typeof item === 'object' && !Array.isArray(item));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;AAQA,wDAiBC;AAGD,8BAgBC;AAGD,4BAEC;AA5CD;;GAEG;AACH,SAAgB,sBAAsB;IACrC,OAAO,CAAC;YACP,IAAI,EAAE,oBAAoB;YAC1B,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,MAAM;YACf,cAAc,CAAC,CAAC,EAAE,MAAM;gBACvB,MAAM,cAAc,GAAG,+CAA+C,CAAC;gBAEvE,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC3C,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;wBACpG,SAAS;oBACV,CAAC;oBAED,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAAC;gBAC7E,CAAC;YACF,CAAC;SACD,CAAC,CAAA;AACH,CAAC;AAED,gCAAgC;AAChC,SAAgB,SAAS,CAAwB,MAAS,EAAE,GAAG,OAAsB;IACpF,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IACnC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAiB,CAAC;IAE9C,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1C,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;YAC1B,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAC3B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;oBAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBACvD,SAAS,CAAC,MAAM,CAAC,GAAG,CAAgB,EAAE,MAAM,CAAC,GAAG,CAAgB,CAAC,CAAC;YACnE,CAAC;iBAAM,CAAC;gBACP,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC/C,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,SAAS,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;AACtC,CAAC;AAED,oCAAoC;AACpC,SAAgB,QAAQ,CAAC,IAAS;IACjC,OAAO,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import typo3 from "vite-plugin-typo3";
|
|
2
|
+
import path from "path";
|
|
3
|
+
// Plugins
|
|
4
|
+
import VitePluginSvgSpritemap from '@spiriit/vite-plugin-svg-spritemap';
|
|
5
|
+
import autoprefixer from 'autoprefixer';
|
|
6
|
+
import cssnano from 'cssnano';
|
|
7
|
+
// @ts-ignore postcss-custom-media doesn't provide types
|
|
8
|
+
import postcssCustomMedia from 'postcss-custom-media';
|
|
9
|
+
// @ts-ignore postcss-sort-media-queries doesn't provide types
|
|
10
|
+
import postcssSortMediaQueries from 'postcss-sort-media-queries';
|
|
11
|
+
// Functions
|
|
12
|
+
import { fixSpritemapPathPlugin } from './utils.js';
|
|
13
|
+
export const baseConfig = {
|
|
14
|
+
plugins: [
|
|
15
|
+
typo3(),
|
|
16
|
+
VitePluginSvgSpritemap('./app/sites/site_package/Resources/Private/Sprite/*.svg', {
|
|
17
|
+
injectSvgOnDev: true,
|
|
18
|
+
styles: {
|
|
19
|
+
lang: 'scss',
|
|
20
|
+
filename: './app/sites/site_package/Resources/Private/Css/src/_sprite.scss',
|
|
21
|
+
include: ['mixin', 'variables'],
|
|
22
|
+
names: {
|
|
23
|
+
mixin: 'viteSprite',
|
|
24
|
+
},
|
|
25
|
+
callback: ({ content }) => {
|
|
26
|
+
const BODY_SIZE = 16;
|
|
27
|
+
content = content.replace(/(?:width|height):\s*(\d+)px/g, (match, p1) => {
|
|
28
|
+
// Divide the captured number by 16 and format to 2 decimal places
|
|
29
|
+
const valueInEm = (p1 / BODY_SIZE).toFixed(2);
|
|
30
|
+
// Return the new string with 'em'
|
|
31
|
+
return `${match.split(':')[0]}: ${valueInEm}em`;
|
|
32
|
+
});
|
|
33
|
+
return content;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
fixSpritemapPathPlugin(),
|
|
38
|
+
],
|
|
39
|
+
resolve: {
|
|
40
|
+
alias: {
|
|
41
|
+
// Resolve TYPO3 extension imports like "liquidlight/foundation/..." into vendor dir
|
|
42
|
+
liquidlight: path.resolve('vendor/liquidlight'),
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
css: {
|
|
46
|
+
preprocessorOptions: {
|
|
47
|
+
scss: {
|
|
48
|
+
includePaths: [
|
|
49
|
+
// Allow Sass imports from Composer-installed TYPO3 site packages
|
|
50
|
+
path.resolve('vendor'),
|
|
51
|
+
],
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
postcss: {
|
|
55
|
+
plugins: [
|
|
56
|
+
autoprefixer(),
|
|
57
|
+
postcssCustomMedia(),
|
|
58
|
+
postcssSortMediaQueries(),
|
|
59
|
+
cssnano({ preset: 'default' })
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=baseConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseConfig.js","sourceRoot":"","sources":["../../src/baseConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,UAAU;AACV,OAAO,sBAAsB,MAAM,oCAAoC,CAAA;AACvE,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,wDAAwD;AACxD,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,8DAA8D;AAC9D,OAAO,uBAAuB,MAAM,4BAA4B,CAAC;AAEjE,YAAY;AACZ,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAEnD,MAAM,CAAC,MAAM,UAAU,GAAe;IACrC,OAAO,EAAE;QACR,KAAK,EAAE;QACP,sBAAsB,CAAC,yDAAyD,EAAE;YACjF,cAAc,EAAE,IAAI;YACpB,MAAM,EAAE;gBACP,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,iEAAiE;gBAC3E,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;gBAC/B,KAAK,EAAE;oBACN,KAAK,EAAE,YAAY;iBACnB;gBACD,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;oBACzB,MAAM,SAAS,GAAG,EAAE,CAAC;oBAErB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,8BAA8B,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;wBACvE,kEAAkE;wBAClE,MAAM,SAAS,GAAG,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;wBAE9C,kCAAkC;wBAClC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC;oBACjD,CAAC,CAAC,CAAC;oBAEH,OAAO,OAAO,CAAA;gBACf,CAAC;aAGD;SACD,CAAC;QACF,sBAAsB,EAAE;KACxB;IACD,OAAO,EAAE;QACR,KAAK,EAAE;YACN,oFAAoF;YACpF,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;SAC/C;KACD;IACD,GAAG,EAAE;QACJ,mBAAmB,EAAE;YACpB,IAAI,EAAE;gBACL,YAAY,EAAE;oBACb,iEAAiE;oBACjE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;iBACtB;aACD;SACD;QACD,OAAO,EAAE;YACR,OAAO,EAAE;gBACR,YAAY,EAAE;gBACd,kBAAkB,EAAE;gBACpB,uBAAuB,EAAE;gBACzB,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;aAC9B;SACD;KACD;CACD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/configuration.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,CAAC,OAAO,WACb,iBAA6B,EAAE;IAE/B,OAAO,SAAS,CAAC,EAAE,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ====
|
|
3
|
+
* Exports
|
|
4
|
+
* ====
|
|
5
|
+
*/
|
|
6
|
+
// Vite exports to simplify includes
|
|
7
|
+
export * from 'vite';
|
|
8
|
+
// The base configuration
|
|
9
|
+
export { baseConfig } from './baseConfig.js';
|
|
10
|
+
// The generated config
|
|
11
|
+
export { default as configuration } from './configuration.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oCAAoC;AACpC,cAAc,MAAM,CAAC;AAErB,yBAAyB;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,uBAAuB;AACvB,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PluginOption } from "vite";
|
|
2
|
+
import type { PlainObject } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Functions
|
|
5
|
+
*/
|
|
6
|
+
export declare function fixSpritemapPathPlugin(): PluginOption[];
|
|
7
|
+
export declare function deepMerge<T extends PlainObject>(target: T, ...sources: PlainObject[]): T;
|
|
8
|
+
export declare function isObject(item: any): item is PlainObject;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Functions
|
|
3
|
+
*/
|
|
4
|
+
export function fixSpritemapPathPlugin() {
|
|
5
|
+
return [{
|
|
6
|
+
name: 'fix-spritemap-path',
|
|
7
|
+
apply: 'build',
|
|
8
|
+
enforce: 'post',
|
|
9
|
+
generateBundle(_, bundle) {
|
|
10
|
+
const spritemapRegex = /url\((["']?)\/assets\/spritemap([^"')]+)\1\)/g;
|
|
11
|
+
for (const asset of Object.values(bundle)) {
|
|
12
|
+
if (asset.type !== 'asset' || !asset.fileName.endsWith('.css') || typeof asset.source !== 'string') {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
asset.source = asset.source.replace(spritemapRegex, 'url($1spritemap$2$1)');
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
}];
|
|
19
|
+
}
|
|
20
|
+
// Allow deep merging of objects
|
|
21
|
+
export function deepMerge(target, ...sources) {
|
|
22
|
+
if (!sources.length)
|
|
23
|
+
return target;
|
|
24
|
+
const source = sources.shift();
|
|
25
|
+
if (isObject(target) && isObject(source)) {
|
|
26
|
+
for (const key in source) {
|
|
27
|
+
if (isObject(source[key])) {
|
|
28
|
+
if (!target[key])
|
|
29
|
+
Object.assign(target, { [key]: {} });
|
|
30
|
+
deepMerge(target[key], source[key]);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
Object.assign(target, { [key]: source[key] });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return deepMerge(target, ...sources);
|
|
38
|
+
}
|
|
39
|
+
// Detect if a variable is an object
|
|
40
|
+
export function isObject(item) {
|
|
41
|
+
return (item && typeof item === 'object' && !Array.isArray(item));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACrC,OAAO,CAAC;YACP,IAAI,EAAE,oBAAoB;YAC1B,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,MAAM;YACf,cAAc,CAAC,CAAC,EAAE,MAAM;gBACvB,MAAM,cAAc,GAAG,+CAA+C,CAAC;gBAEvE,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC3C,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,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O,CAAC,IAAI,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@liquidlight/vite-framework",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Liquid Light Vite Framework",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/cjs/index.js",
|
|
7
|
+
"types": "./dist/cjs/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/esm/index.d.ts",
|
|
12
|
+
"default": "./dist/esm/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/cjs/index.d.ts",
|
|
16
|
+
"default": "./dist/cjs/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"dist/*",
|
|
23
|
+
"dist/**/*"
|
|
24
|
+
],
|
|
25
|
+
"homepage": "https://github.com/liquidlight/vite-framework#readme",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/liquidlight/vite-framework.git"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/liquidlight/vite-framework/issues"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"clean": "rm -rf ./dist",
|
|
35
|
+
"build": "npm run clean && tsc -p ./tsconfig.esm.json && tsc -p ./tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
36
|
+
"prepack": "npm run build",
|
|
37
|
+
"prepare": "npm run build",
|
|
38
|
+
"lint": "eslint ."
|
|
39
|
+
},
|
|
40
|
+
"author": "Mike Street",
|
|
41
|
+
"license": "ISC",
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@spiriit/vite-plugin-svg-spritemap": "^5.0.0",
|
|
44
|
+
"autoprefixer": "^10.4.22",
|
|
45
|
+
"cssnano": "^7.1.2",
|
|
46
|
+
"postcss-custom-media": "^11.0.6",
|
|
47
|
+
"postcss-sort-media-queries": "^5.2.0",
|
|
48
|
+
"sass": "^1.94.2",
|
|
49
|
+
"vite": "^7.2.7",
|
|
50
|
+
"vite-plugin-typo3": "^2.1.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
54
|
+
"@eslint/js": "^9.21.0",
|
|
55
|
+
"@types/node": "^22.13.4",
|
|
56
|
+
"eslint": "^9.21.0",
|
|
57
|
+
"typescript": "^5.7.3",
|
|
58
|
+
"typescript-eslint": "^8.24.1"
|
|
59
|
+
}
|
|
60
|
+
}
|