esbuild-helpers 0.0.10 → 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 +2 -3
- package/config_devserver.ts +4 -9
- package/config_electron.ts +3 -6
- package/config_nodejs.ts +1 -9
- package/config_nodejs_debug.ts +3 -9
- package/config_nodejs_event.ts +3 -6
- package/config_nodejs_prod.ts +3 -7
- package/dist/builder.js +24 -12
- package/dist/builder.js.map +1 -1
- package/dist/exported.d.ts +0 -1
- package/dist/exported.js +1 -3
- package/dist/exported.js.map +1 -1
- package/package.json +11 -13
- package/tailwind.config.js +1 -1
- package/test/package-lock.json +6721 -0
- package/test/package.json +48 -0
- package/dist/minifyHTMLLiteralsPlugin.d.ts +0 -4
- package/dist/minifyHTMLLiteralsPlugin.js +0 -100
- package/dist/minifyHTMLLiteralsPlugin.js.map +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "esbuild-helpers",
|
|
3
|
+
"version": "1.0.0-next.1",
|
|
4
|
+
"description": "Simple helper lib to help make js bundles for web, nodejs server and electron",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"rimraf": "./node_modules/rimraf/bin.js",
|
|
7
|
+
"build": "rimraf dist/ && tsc --project tsconfig-build.json",
|
|
8
|
+
"nodejs:dev": "ts-node config_nodejs",
|
|
9
|
+
"nodejs:prod": "ts-node config_nodejs_prod",
|
|
10
|
+
"nodejs:prod:run": "ts-node config_nodejs_prod && node ./dist_nodejs/index.js",
|
|
11
|
+
"nodejs:debug": "ts-node config_nodejs_debug",
|
|
12
|
+
"nodejs:events": "ts-node config_nodejs_event",
|
|
13
|
+
"devserver": "ts-node config_devserver",
|
|
14
|
+
"electron:dev": "ts-node config_electron",
|
|
15
|
+
"typechecker": "ts-node config_type",
|
|
16
|
+
"copy": "ts-node config_copy"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [],
|
|
19
|
+
"author": "Vegar Ringdal",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"chokidar": "^3.5.3",
|
|
23
|
+
"express": "^4.18.2",
|
|
24
|
+
"fast-glob": "^3.2.12",
|
|
25
|
+
"rimraf": "^4.0.7",
|
|
26
|
+
"ws": "^8.12.0",
|
|
27
|
+
"zlib": "^1.0.5"
|
|
28
|
+
},
|
|
29
|
+
"main": "dist/exported.js",
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/compression": "^1.7.2",
|
|
32
|
+
"compression": "^1.7.4",
|
|
33
|
+
"@types/express": "^4.17.15",
|
|
34
|
+
"@types/rimraf": "^3.0.2",
|
|
35
|
+
"@types/ws": "^8.5.4",
|
|
36
|
+
"cssnano": "^5.1.14",
|
|
37
|
+
"custom-elements-hmr-polyfill": "^1.0.3",
|
|
38
|
+
"electron": "^22.0.2",
|
|
39
|
+
"electron-squirrel-startup": "^1.0.0",
|
|
40
|
+
"esbuild": "^0.17.0",
|
|
41
|
+
"lit-html": "^2.6.1",
|
|
42
|
+
"postcss": "^8.4.21",
|
|
43
|
+
"minify-html-literals": "^1.3.5",
|
|
44
|
+
"tailwindcss": "^3.2.4",
|
|
45
|
+
"ts-node": "^10.9.1",
|
|
46
|
+
"typescript": "^4.9.4"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.minifyHTMLLiteralsPlugin = void 0;
|
|
43
|
-
var fs_1 = __importDefault(require("fs"));
|
|
44
|
-
var path_1 = __importDefault(require("path"));
|
|
45
|
-
var minifyHTMLLiterals;
|
|
46
|
-
try {
|
|
47
|
-
minifyHTMLLiterals = require("minify-html-literals");
|
|
48
|
-
}
|
|
49
|
-
catch (err) { }
|
|
50
|
-
var readFile = function (file) {
|
|
51
|
-
return new Promise(function (resolve, reject) {
|
|
52
|
-
fs_1.default.readFile(path_1.default.resolve(file), null, function (err, data) {
|
|
53
|
-
if (err) {
|
|
54
|
-
reject(err);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
resolve(data);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
function minifyHTMLLiteralsPlugin(config) {
|
|
63
|
-
if (config === void 0) { config = {}; }
|
|
64
|
-
return {
|
|
65
|
-
name: "minifyHTMLLiterals-Plugin",
|
|
66
|
-
setup: function (build) {
|
|
67
|
-
var _this = this;
|
|
68
|
-
build.onLoad({ filter: /\.ts$/ }, function (args) {
|
|
69
|
-
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
|
|
70
|
-
var text, result;
|
|
71
|
-
return __generator(this, function (_a) {
|
|
72
|
-
switch (_a.label) {
|
|
73
|
-
case 0: return [4 /*yield*/, readFile(args.path)];
|
|
74
|
-
case 1:
|
|
75
|
-
text = _a.sent();
|
|
76
|
-
try {
|
|
77
|
-
result = minifyHTMLLiterals(text, config);
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
if (!minifyHTMLLiterals) {
|
|
81
|
-
console.log("\nminify HTML Literals module is missing, try npm install minify-html-literals\n", args.path, "\n");
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
console.log(e, result);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (!result) {
|
|
88
|
-
resolve(undefined);
|
|
89
|
-
}
|
|
90
|
-
resolve({ contents: result === null || result === void 0 ? void 0 : result.code, loader: "ts" });
|
|
91
|
-
return [2 /*return*/];
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}); });
|
|
95
|
-
});
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
exports.minifyHTMLLiteralsPlugin = minifyHTMLLiteralsPlugin;
|
|
100
|
-
//# sourceMappingURL=minifyHTMLLiteralsPlugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"minifyHTMLLiteralsPlugin.js","sourceRoot":"","sources":["../src/minifyHTMLLiteralsPlugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAoB;AACpB,8CAAwB;AAExB,IAAI,kBAAuB,CAAC;AAC5B,IAAI;IACF,kBAAkB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACtD;AAAC,OAAO,GAAG,EAAE,GAAE;AAEhB,IAAM,QAAQ,GAAG,UAAC,IAAY;IAC5B,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QACjC,YAAE,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAC,GAAQ,EAAE,IAAS;YACxD,IAAI,GAAG,EAAE;gBACP,MAAM,CAAC,GAAG,CAAC,CAAC;aACb;iBAAM;gBACL,OAAO,CAAC,IAAI,CAAC,CAAC;aACf;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,SAAgB,wBAAwB,CAAC,MAAW;IAAX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