@forsakringskassan/vite-lib-config 1.7.13 → 1.8.1
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/bin/{build-vue-lib.js → build-vue-lib.mjs} +1 -1
- package/dist/api-extractor.js +75 -96
- package/dist/{cli.js → cli.mjs} +26 -29
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/{vite.config.js → vite.config.cjs} +122 -158
- package/dist/vite.config.mjs +12530 -0
- package/package.json +7 -6
package/dist/{cli.js → cli.mjs}
RENAMED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
1
3
|
var __create = Object.create;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
3
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
9
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
10
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
11
|
+
}) : x)(function(x) {
|
|
12
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
+
});
|
|
15
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
8
16
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
17
|
};
|
|
10
|
-
var __export = (target, all) => {
|
|
11
|
-
for (var name in all)
|
|
12
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
-
};
|
|
14
18
|
var __copyProps = (to, from, except, desc) => {
|
|
15
19
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
20
|
for (let key of __getOwnPropNames(from))
|
|
@@ -27,14 +31,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
31
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
32
|
mod
|
|
29
33
|
));
|
|
30
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
34
|
|
|
32
35
|
// node_modules/picocolors/picocolors.js
|
|
33
36
|
var require_picocolors = __commonJS({
|
|
34
|
-
"node_modules/picocolors/picocolors.js"(
|
|
37
|
+
"node_modules/picocolors/picocolors.js"(exports, module) {
|
|
35
38
|
var argv = process.argv || [];
|
|
36
39
|
var env = process.env;
|
|
37
|
-
var isColorSupported = !("NO_COLOR" in env || argv.includes("--no-color")) && ("FORCE_COLOR" in env || argv.includes("--color") || process.platform === "win32" ||
|
|
40
|
+
var isColorSupported = !("NO_COLOR" in env || argv.includes("--no-color")) && ("FORCE_COLOR" in env || argv.includes("--color") || process.platform === "win32" || __require != null && __require("tty").isatty(1) && env.TERM !== "dumb" || "CI" in env);
|
|
38
41
|
var formatter = (open, close, replace = open) => (input) => {
|
|
39
42
|
let string = "" + input;
|
|
40
43
|
let index = string.indexOf(close, open.length);
|
|
@@ -81,28 +84,23 @@ var require_picocolors = __commonJS({
|
|
|
81
84
|
bgWhite: init("\x1B[47m", "\x1B[49m")
|
|
82
85
|
};
|
|
83
86
|
};
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
module.exports = createColors();
|
|
88
|
+
module.exports.createColors = createColors;
|
|
86
89
|
}
|
|
87
90
|
});
|
|
88
91
|
|
|
89
92
|
// src/cli.ts
|
|
90
|
-
var cli_exports = {};
|
|
91
|
-
__export(cli_exports, {
|
|
92
|
-
cli: () => cli
|
|
93
|
-
});
|
|
94
|
-
module.exports = __toCommonJS(cli_exports);
|
|
95
|
-
var import_promises = __toESM(require("node:fs/promises"));
|
|
96
|
-
var import_node_fs = require("node:fs");
|
|
97
|
-
var import_vite = require("vite");
|
|
98
93
|
var import_picocolors = __toESM(require_picocolors());
|
|
99
|
-
|
|
94
|
+
import fs from "node:fs/promises";
|
|
95
|
+
import { existsSync } from "node:fs";
|
|
96
|
+
import { build as viteBuild, createLogger } from "vite";
|
|
97
|
+
import * as babel from "@babel/core";
|
|
100
98
|
var cjsSrcFile = "temp/index.cjs.js";
|
|
101
99
|
var esSrcFile = "temp/index.es.js";
|
|
102
100
|
var dstDir = "lib";
|
|
103
101
|
var cjsDstFile = `${dstDir}/index.cjs.js`;
|
|
104
102
|
var esDstFile = `${dstDir}/index.es.js`;
|
|
105
|
-
var logger =
|
|
103
|
+
var logger = createLogger();
|
|
106
104
|
function displayTime(time) {
|
|
107
105
|
if (time < 1e3) {
|
|
108
106
|
return `${time}ms`;
|
|
@@ -141,18 +139,18 @@ async function transpile(src, dst) {
|
|
|
141
139
|
}
|
|
142
140
|
const { code, map } = result;
|
|
143
141
|
await Promise.all([
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
fs.writeFile(dst, code ?? "", "utf-8"),
|
|
143
|
+
fs.writeFile(dstMap, JSON.stringify(map), "utf-8")
|
|
146
144
|
]);
|
|
147
|
-
const stat = await Promise.all([
|
|
145
|
+
const stat = await Promise.all([fs.stat(dst), fs.stat(dstMap)]);
|
|
148
146
|
const size = stat.map((it) => prettySize(it.size));
|
|
149
147
|
logger.info(`${src} -> ${dst} ${import_picocolors.default.bold(size[0])} | map: ${size[1]}`);
|
|
150
148
|
}
|
|
151
149
|
async function cli() {
|
|
152
150
|
const startTime = Date.now();
|
|
153
|
-
await (
|
|
154
|
-
if (!
|
|
155
|
-
await
|
|
151
|
+
await viteBuild();
|
|
152
|
+
if (!existsSync(dstDir)) {
|
|
153
|
+
await fs.mkdir(dstDir);
|
|
156
154
|
}
|
|
157
155
|
console.log();
|
|
158
156
|
console.log(
|
|
@@ -167,7 +165,6 @@ async function cli() {
|
|
|
167
165
|
console.log();
|
|
168
166
|
console.log(import_picocolors.default.green(`Build successful (${duration}) \u{1F389}`));
|
|
169
167
|
}
|
|
170
|
-
|
|
171
|
-
0 && (module.exports = {
|
|
168
|
+
export {
|
|
172
169
|
cli
|
|
173
|
-
}
|
|
170
|
+
};
|