@goldstack/template-ssr-server-compile-bundle 0.1.1 → 0.1.2
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.
|
@@ -1,21 +1,28 @@
|
|
|
1
|
+
import type { BuildOptions } from 'esbuild';
|
|
1
2
|
import { APIGatewayProxyResultV2 } from 'aws-lambda';
|
|
3
|
+
export interface ESBuildConfiguration {
|
|
4
|
+
createBuildOptions: (includeCss: boolean) => BuildOptions;
|
|
5
|
+
}
|
|
2
6
|
export interface CompileBundleResponse {
|
|
3
7
|
bundle: string;
|
|
4
8
|
sourceMap?: string;
|
|
5
9
|
metaFile?: string;
|
|
6
10
|
}
|
|
7
|
-
export declare const compileBundle: ({ entryPoint, metaFile, sourceMap, initialProperties, includeCss, }: {
|
|
11
|
+
export declare const compileBundle: ({ entryPoint, metaFile, sourceMap, initialProperties, includeCss, esbuildConfig, }: {
|
|
8
12
|
entryPoint: string;
|
|
9
13
|
metaFile?: boolean | undefined;
|
|
10
14
|
sourceMap?: boolean | undefined;
|
|
11
15
|
initialProperties?: any;
|
|
12
16
|
includeCss: boolean;
|
|
17
|
+
esbuildConfig: ESBuildConfiguration;
|
|
13
18
|
}) => Promise<CompileBundleResponse>;
|
|
14
|
-
export declare const bundleResponse: ({ entryPoint, initialProperties, }: {
|
|
19
|
+
export declare const bundleResponse: ({ entryPoint, initialProperties, esbuildConfig, }: {
|
|
15
20
|
entryPoint: string;
|
|
16
21
|
initialProperties?: any;
|
|
22
|
+
esbuildConfig: ESBuildConfiguration;
|
|
17
23
|
}) => Promise<APIGatewayProxyResultV2>;
|
|
18
|
-
export declare const sourceMapResponse: ({ entryPoint, }: {
|
|
24
|
+
export declare const sourceMapResponse: ({ entryPoint, esbuildConfig, }: {
|
|
19
25
|
entryPoint: string;
|
|
26
|
+
esbuildConfig: ESBuildConfiguration;
|
|
20
27
|
}) => Promise<APIGatewayProxyResultV2>;
|
|
21
28
|
//# sourceMappingURL=templateSSRServerCompileBundle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateSSRServerCompileBundle.d.ts","sourceRoot":"","sources":["../../src/templateSSRServerCompileBundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templateSSRServerCompileBundle.d.ts","sourceRoot":"","sources":["../../src/templateSSRServerCompileBundle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,SAAS,CAAC;AAErE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAIrD,MAAM,WAAW,oBAAoB;IACnC,kBAAkB,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,YAAY,CAAC;CAC3D;AAYD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAsBD,eAAO,MAAM,aAAa;gBAQZ,MAAM;;;wBAGE,GAAG;gBACX,OAAO;mBACJ,oBAAoB;MACjC,QAAQ,qBAAqB,CAyChC,CAAC;AAEF,eAAO,MAAM,cAAc;gBAKb,MAAM;wBACE,GAAG;mBACR,oBAAoB;MACjC,QAAQ,uBAAuB,CAmBlC,CAAC;AAoBF,eAAO,MAAM,iBAAiB;gBAIhB,MAAM;mBACH,oBAAoB;MACjC,QAAQ,uBAAuB,CAsBlC,CAAC"}
|
|
@@ -1,37 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.sourceMapResponse = exports.bundleResponse = exports.compileBundle = void 0;
|
|
7
4
|
const esbuild_1 = require("esbuild");
|
|
8
|
-
const esbuild_plugin_pnp_1 = require("@yarnpkg/esbuild-plugin-pnp");
|
|
9
|
-
const esbuild_css_modules_client_plugin_1 = __importDefault(require("esbuild-css-modules-client-plugin"));
|
|
10
5
|
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
11
6
|
const path_1 = require("path");
|
|
12
|
-
const sharedConfig = (includeCss) => {
|
|
13
|
-
return {
|
|
14
|
-
plugins: [
|
|
15
|
-
(0, esbuild_css_modules_client_plugin_1.default)({
|
|
16
|
-
excludeCSSInject: !includeCss,
|
|
17
|
-
}),
|
|
18
|
-
(0, esbuild_plugin_pnp_1.pnpPlugin)(),
|
|
19
|
-
],
|
|
20
|
-
bundle: true,
|
|
21
|
-
outfile: '/dist/tmp/bundle.js',
|
|
22
|
-
external: [
|
|
23
|
-
'esbuild',
|
|
24
|
-
'@yarnpkg/esbuild-plugin-pnp',
|
|
25
|
-
'@swc/core',
|
|
26
|
-
'@swc/jest',
|
|
27
|
-
'@goldstack/template-ssr-server', // this is only required on the server side
|
|
28
|
-
],
|
|
29
|
-
minify: true,
|
|
30
|
-
platform: 'browser',
|
|
31
|
-
format: 'iife',
|
|
32
|
-
treeShaking: true,
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
7
|
const getEsBuildConfig = (entryPoint) => {
|
|
36
8
|
const esbuildConfig = (0, utils_sh_1.readToType)('./esbuild.config.json');
|
|
37
9
|
const esbuildLocalPath = (0, utils_sh_1.changeExtension)((0, path_1.dirname)(entryPoint), '.esbuild.config.json');
|
|
@@ -46,9 +18,9 @@ const getOutput = (extension, result) => {
|
|
|
46
18
|
const output = Buffer.from(matchedFiles[0].contents).toString('utf-8');
|
|
47
19
|
return output;
|
|
48
20
|
};
|
|
49
|
-
const compileBundle = async ({ entryPoint, metaFile, sourceMap, initialProperties, includeCss, }) => {
|
|
21
|
+
const compileBundle = async ({ entryPoint, metaFile, sourceMap, initialProperties, includeCss, esbuildConfig, }) => {
|
|
50
22
|
const res = await (0, esbuild_1.build)({
|
|
51
|
-
...
|
|
23
|
+
...esbuildConfig.createBuildOptions(includeCss),
|
|
52
24
|
entryPoints: [entryPoint],
|
|
53
25
|
metafile: metaFile,
|
|
54
26
|
sourcemap: sourceMap ? 'inline' : undefined,
|
|
@@ -83,11 +55,12 @@ const compileBundle = async ({ entryPoint, metaFile, sourceMap, initialPropertie
|
|
|
83
55
|
return result;
|
|
84
56
|
};
|
|
85
57
|
exports.compileBundle = compileBundle;
|
|
86
|
-
const bundleResponse = async ({ entryPoint, initialProperties, }) => {
|
|
58
|
+
const bundleResponse = async ({ entryPoint, initialProperties, esbuildConfig, }) => {
|
|
87
59
|
const res = await (0, exports.compileBundle)({
|
|
88
60
|
entryPoint,
|
|
89
61
|
initialProperties,
|
|
90
62
|
includeCss: true,
|
|
63
|
+
esbuildConfig,
|
|
91
64
|
});
|
|
92
65
|
return {
|
|
93
66
|
statusCode: 201,
|
|
@@ -115,9 +88,9 @@ const removeSourceMap = (output) => {
|
|
|
115
88
|
const withoutSourceMap = output.substring(0, startContent);
|
|
116
89
|
return withoutSourceMap;
|
|
117
90
|
};
|
|
118
|
-
const sourceMapResponse = async ({ entryPoint, }) => {
|
|
91
|
+
const sourceMapResponse = async ({ entryPoint, esbuildConfig, }) => {
|
|
119
92
|
const res = await (0, esbuild_1.build)({
|
|
120
|
-
...
|
|
93
|
+
...esbuildConfig.createBuildOptions(false),
|
|
121
94
|
entryPoints: [entryPoint],
|
|
122
95
|
sourcemap: 'inline',
|
|
123
96
|
...getEsBuildConfig(entryPoint),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateSSRServerCompileBundle.js","sourceRoot":"","sources":["../../src/templateSSRServerCompileBundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templateSSRServerCompileBundle.js","sourceRoot":"","sources":["../../src/templateSSRServerCompileBundle.ts"],"names":[],"mappings":";;;AAAA,qCAAgC;AAIhC,kDAAkE;AAClE,+BAA+B;AAM/B,MAAM,gBAAgB,GAAG,CAAC,UAAkB,EAAgB,EAAE;IAC5D,MAAM,aAAa,GAAG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AC,CAAC;IAE/C,OAAO;QACL,UAAU,EAAE,GAAG;QACf,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,eAAe,EAAE,qCAAqC;YACtD,MAAM,EAAE,UAAU;YAClB,MAAM,EAAE,GAAG;SACZ;QACD,IAAI,EAAE,aAAa;KACpB,CAAC;AACJ,CAAC,CAAC;AA5BW,QAAA,iBAAiB,qBA4B5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goldstack/template-ssr-server-compile-bundle",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Utility for compiling client side bundles for SSR application",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"goldstack",
|
|
@@ -36,30 +36,28 @@
|
|
|
36
36
|
"version:apply:force": "yarn version $@ && yarn version apply"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@goldstack/infra": "0.3.
|
|
40
|
-
"@goldstack/infra-aws": "0.3.
|
|
41
|
-
"@goldstack/utils-aws-lambda": "0.1.
|
|
42
|
-
"@goldstack/utils-esbuild": "0.4.
|
|
43
|
-
"@goldstack/utils-package": "0.3.
|
|
44
|
-
"@goldstack/utils-package-config-embedded": "0.4.
|
|
45
|
-
"@goldstack/utils-sh": "0.4.
|
|
46
|
-
"@goldstack/utils-template": "0.3.
|
|
47
|
-
"@goldstack/utils-terraform": "0.3.
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"esbuild-css-modules-client-plugin": "0.1.4",
|
|
51
|
-
"lambda-compression": "0.1.2",
|
|
39
|
+
"@goldstack/infra": "0.3.39",
|
|
40
|
+
"@goldstack/infra-aws": "0.3.48",
|
|
41
|
+
"@goldstack/utils-aws-lambda": "0.1.38",
|
|
42
|
+
"@goldstack/utils-esbuild": "0.4.4",
|
|
43
|
+
"@goldstack/utils-package": "0.3.42",
|
|
44
|
+
"@goldstack/utils-package-config-embedded": "0.4.6",
|
|
45
|
+
"@goldstack/utils-sh": "0.4.34",
|
|
46
|
+
"@goldstack/utils-template": "0.3.38",
|
|
47
|
+
"@goldstack/utils-terraform": "0.3.72",
|
|
48
|
+
"esbuild": "^0.15.5",
|
|
49
|
+
"lambda-compression": "0.1.3",
|
|
52
50
|
"react": "^18.2.0",
|
|
53
51
|
"react-dom": "^18.2.0",
|
|
54
52
|
"source-map-support": "^0.5.21"
|
|
55
53
|
},
|
|
56
54
|
"devDependencies": {
|
|
57
55
|
"@goldstack/utils-docs-cli": "0.3.11",
|
|
58
|
-
"@goldstack/utils-git": "0.1.
|
|
59
|
-
"@goldstack/utils-package-config-generate": "0.2.
|
|
56
|
+
"@goldstack/utils-git": "0.1.37",
|
|
57
|
+
"@goldstack/utils-package-config-generate": "0.2.18",
|
|
60
58
|
"@types/aws-lambda": "^8.10.88",
|
|
61
|
-
"@types/jest": "^
|
|
62
|
-
"@types/node": "^
|
|
59
|
+
"@types/jest": "^28.1.8",
|
|
60
|
+
"@types/node": "^18.7.13",
|
|
63
61
|
"@types/react": "^18.0.15",
|
|
64
62
|
"@types/sha256": "^0",
|
|
65
63
|
"@types/yargs": "^17.0.10",
|