@8medusa/framework 2.7.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 +0 -0
- package/dist/build-tools/compiler.d.ts +64 -0
- package/dist/build-tools/compiler.d.ts.map +1 -0
- package/dist/build-tools/compiler.js +419 -0
- package/dist/build-tools/compiler.js.map +1 -0
- package/dist/build-tools/index.d.ts +2 -0
- package/dist/build-tools/index.d.ts.map +1 -0
- package/dist/build-tools/index.js +18 -0
- package/dist/build-tools/index.js.map +1 -0
- package/dist/config/config.d.ts +34 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +134 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +21 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +11 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +35 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/types.d.ts +2 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +3 -0
- package/dist/config/types.js.map +1 -0
- package/dist/container.d.ts +3 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/container.js +21 -0
- package/dist/container.js.map +1 -0
- package/dist/database/index.d.ts +3 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +19 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/pg-connection-loader.d.ts +6 -0
- package/dist/database/pg-connection-loader.d.ts.map +1 -0
- package/dist/database/pg-connection-loader.js +43 -0
- package/dist/database/pg-connection-loader.js.map +1 -0
- package/dist/feature-flags/feature-flag-loader.d.ts +8 -0
- package/dist/feature-flags/feature-flag-loader.d.ts.map +1 -0
- package/dist/feature-flags/feature-flag-loader.js +81 -0
- package/dist/feature-flags/feature-flag-loader.js.map +1 -0
- package/dist/feature-flags/flag-router.d.ts +32 -0
- package/dist/feature-flags/flag-router.d.ts.map +1 -0
- package/dist/feature-flags/flag-router.js +67 -0
- package/dist/feature-flags/flag-router.js.map +1 -0
- package/dist/feature-flags/index.d.ts +5 -0
- package/dist/feature-flags/index.d.ts.map +1 -0
- package/dist/feature-flags/index.js +21 -0
- package/dist/feature-flags/index.js.map +1 -0
- package/dist/feature-flags/types.d.ts +31 -0
- package/dist/feature-flags/types.d.ts.map +1 -0
- package/dist/feature-flags/types.js +3 -0
- package/dist/feature-flags/types.js.map +1 -0
- package/dist/http/express-loader.d.ts +8 -0
- package/dist/http/express-loader.d.ts.map +1 -0
- package/dist/http/express-loader.js +128 -0
- package/dist/http/express-loader.js.map +1 -0
- package/dist/http/index.d.ts +15 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +31 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/middleware-file-loader.d.ts +33 -0
- package/dist/http/middleware-file-loader.d.ts.map +1 -0
- package/dist/http/middleware-file-loader.js +173 -0
- package/dist/http/middleware-file-loader.js.map +1 -0
- package/dist/http/middlewares/apply-default-filters.d.ts +3 -0
- package/dist/http/middlewares/apply-default-filters.d.ts.map +1 -0
- package/dist/http/middlewares/apply-default-filters.js +32 -0
- package/dist/http/middlewares/apply-default-filters.js.map +1 -0
- package/dist/http/middlewares/apply-params-as-filters.d.ts +5 -0
- package/dist/http/middlewares/apply-params-as-filters.d.ts.map +1 -0
- package/dist/http/middlewares/apply-params-as-filters.js +14 -0
- package/dist/http/middlewares/apply-params-as-filters.js.map +1 -0
- package/dist/http/middlewares/authenticate-middleware.d.ts +13 -0
- package/dist/http/middlewares/authenticate-middleware.d.ts.map +1 -0
- package/dist/http/middlewares/authenticate-middleware.js +136 -0
- package/dist/http/middlewares/authenticate-middleware.js.map +1 -0
- package/dist/http/middlewares/bodyparser.d.ts +13 -0
- package/dist/http/middlewares/bodyparser.d.ts.map +1 -0
- package/dist/http/middlewares/bodyparser.js +62 -0
- package/dist/http/middlewares/bodyparser.js.map +1 -0
- package/dist/http/middlewares/clear-filters-by-key.d.ts +3 -0
- package/dist/http/middlewares/clear-filters-by-key.d.ts.map +1 -0
- package/dist/http/middlewares/clear-filters-by-key.js +12 -0
- package/dist/http/middlewares/clear-filters-by-key.js.map +1 -0
- package/dist/http/middlewares/ensure-publishable-api-key.d.ts +3 -0
- package/dist/http/middlewares/ensure-publishable-api-key.d.ts.map +1 -0
- package/dist/http/middlewares/ensure-publishable-api-key.js +45 -0
- package/dist/http/middlewares/ensure-publishable-api-key.js.map +1 -0
- package/dist/http/middlewares/error-handler.d.ts +21 -0
- package/dist/http/middlewares/error-handler.d.ts.map +1 -0
- package/dist/http/middlewares/error-handler.js +85 -0
- package/dist/http/middlewares/error-handler.js.map +1 -0
- package/dist/http/middlewares/exception-formatter.d.ts +9 -0
- package/dist/http/middlewares/exception-formatter.d.ts.map +1 -0
- package/dist/http/middlewares/exception-formatter.js +36 -0
- package/dist/http/middlewares/exception-formatter.js.map +1 -0
- package/dist/http/middlewares/index.d.ts +8 -0
- package/dist/http/middlewares/index.d.ts.map +1 -0
- package/dist/http/middlewares/index.js +24 -0
- package/dist/http/middlewares/index.js.map +1 -0
- package/dist/http/middlewares/set-context.d.ts +3 -0
- package/dist/http/middlewares/set-context.d.ts.map +1 -0
- package/dist/http/middlewares/set-context.js +18 -0
- package/dist/http/middlewares/set-context.js.map +1 -0
- package/dist/http/router.d.ts +28 -0
- package/dist/http/router.d.ts.map +1 -0
- package/dist/http/router.js +252 -0
- package/dist/http/router.js.map +1 -0
- package/dist/http/routes-finder.d.ts +22 -0
- package/dist/http/routes-finder.d.ts.map +1 -0
- package/dist/http/routes-finder.js +62 -0
- package/dist/http/routes-finder.js.map +1 -0
- package/dist/http/routes-loader.d.ts +30 -0
- package/dist/http/routes-loader.d.ts.map +1 -0
- package/dist/http/routes-loader.js +203 -0
- package/dist/http/routes-loader.js.map +1 -0
- package/dist/http/routes-sorter.d.ts +105 -0
- package/dist/http/routes-sorter.d.ts.map +1 -0
- package/dist/http/routes-sorter.js +146 -0
- package/dist/http/routes-sorter.js.map +1 -0
- package/dist/http/types.d.ts +164 -0
- package/dist/http/types.d.ts.map +1 -0
- package/dist/http/types.js +16 -0
- package/dist/http/types.js.map +1 -0
- package/dist/http/utils/define-middlewares.d.ts +22 -0
- package/dist/http/utils/define-middlewares.d.ts.map +1 -0
- package/dist/http/utils/define-middlewares.js +27 -0
- package/dist/http/utils/define-middlewares.js.map +1 -0
- package/dist/http/utils/get-query-config.d.ts +42 -0
- package/dist/http/utils/get-query-config.d.ts.map +1 -0
- package/dist/http/utils/get-query-config.js +183 -0
- package/dist/http/utils/get-query-config.js.map +1 -0
- package/dist/http/utils/http-compression.d.ts +5 -0
- package/dist/http/utils/http-compression.d.ts.map +1 -0
- package/dist/http/utils/http-compression.js +33 -0
- package/dist/http/utils/http-compression.js.map +1 -0
- package/dist/http/utils/maybe-apply-link-filter.d.ts +8 -0
- package/dist/http/utils/maybe-apply-link-filter.d.ts.map +1 -0
- package/dist/http/utils/maybe-apply-link-filter.js +68 -0
- package/dist/http/utils/maybe-apply-link-filter.js.map +1 -0
- package/dist/http/utils/refetch-entities.d.ts +5 -0
- package/dist/http/utils/refetch-entities.d.ts.map +1 -0
- package/dist/http/utils/refetch-entities.js +29 -0
- package/dist/http/utils/refetch-entities.js.map +1 -0
- package/dist/http/utils/restricted-fields.d.ts +6 -0
- package/dist/http/utils/restricted-fields.d.ts.map +1 -0
- package/dist/http/utils/restricted-fields.js +30 -0
- package/dist/http/utils/restricted-fields.js.map +1 -0
- package/dist/http/utils/unless-path.d.ts +9 -0
- package/dist/http/utils/unless-path.d.ts.map +1 -0
- package/dist/http/utils/unless-path.js +19 -0
- package/dist/http/utils/unless-path.js.map +1 -0
- package/dist/http/utils/validate-body.d.ts +5 -0
- package/dist/http/utils/validate-body.d.ts.map +1 -0
- package/dist/http/utils/validate-body.js +23 -0
- package/dist/http/utils/validate-body.js.map +1 -0
- package/dist/http/utils/validate-query.d.ts +6 -0
- package/dist/http/utils/validate-query.d.ts.map +1 -0
- package/dist/http/utils/validate-query.js +79 -0
- package/dist/http/utils/validate-query.js.map +1 -0
- package/dist/http/utils/wrap-handler.d.ts +3 -0
- package/dist/http/utils/wrap-handler.d.ts.map +1 -0
- package/dist/http/utils/wrap-handler.js +26 -0
- package/dist/http/utils/wrap-handler.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs/index.d.ts +2 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +18 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/job-loader.d.ts +42 -0
- package/dist/jobs/job-loader.d.ts.map +1 -0
- package/dist/jobs/job-loader.js +78 -0
- package/dist/jobs/job-loader.js.map +1 -0
- package/dist/links/index.d.ts +2 -0
- package/dist/links/index.d.ts.map +1 -0
- package/dist/links/index.js +18 -0
- package/dist/links/index.js.map +1 -0
- package/dist/links/link-loader.d.ts +10 -0
- package/dist/links/link-loader.d.ts.map +1 -0
- package/dist/links/link-loader.js +74 -0
- package/dist/links/link-loader.js.map +1 -0
- package/dist/logger/index.d.ts +3 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +9 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/medusa-app-loader.d.ts +51 -0
- package/dist/medusa-app-loader.d.ts.map +1 -0
- package/dist/medusa-app-loader.js +189 -0
- package/dist/medusa-app-loader.js.map +1 -0
- package/dist/migrations/index.d.ts +3 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +19 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/migrator.d.ts +38 -0
- package/dist/migrations/migrator.d.ts.map +1 -0
- package/dist/migrations/migrator.js +129 -0
- package/dist/migrations/migrator.js.map +1 -0
- package/dist/migrations/run-migration-scripts.d.ts +17 -0
- package/dist/migrations/run-migration-scripts.d.ts.map +1 -0
- package/dist/migrations/run-migration-scripts.js +94 -0
- package/dist/migrations/run-migration-scripts.js.map +1 -0
- package/dist/mikro-orm-cli/bin.d.ts +14 -0
- package/dist/mikro-orm-cli/bin.d.ts.map +1 -0
- package/dist/mikro-orm-cli/bin.js +54 -0
- package/dist/mikro-orm-cli/bin.js.map +1 -0
- package/dist/modules-sdk/index.d.ts +2 -0
- package/dist/modules-sdk/index.d.ts.map +1 -0
- package/dist/modules-sdk/index.js +18 -0
- package/dist/modules-sdk/index.js.map +1 -0
- package/dist/orchestration/index.d.ts +2 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +18 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/subscribers/index.d.ts +3 -0
- package/dist/subscribers/index.d.ts.map +1 -0
- package/dist/subscribers/index.js +19 -0
- package/dist/subscribers/index.js.map +1 -0
- package/dist/subscribers/subscriber-loader.d.ts +12 -0
- package/dist/subscribers/subscriber-loader.d.ts.map +1 -0
- package/dist/subscribers/subscriber-loader.js +147 -0
- package/dist/subscribers/subscriber-loader.js.map +1 -0
- package/dist/subscribers/types.d.ts +15 -0
- package/dist/subscribers/types.d.ts.map +1 -0
- package/dist/subscribers/types.js +3 -0
- package/dist/subscribers/types.js.map +1 -0
- package/dist/telemetry/index.d.ts +50 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +81 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/types/container.d.ts +62 -0
- package/dist/types/container.d.ts.map +1 -0
- package/dist/types/container.js +3 -0
- package/dist/types/container.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/resource-loader.d.ts +26 -0
- package/dist/utils/resource-loader.d.ts.map +1 -0
- package/dist/utils/resource-loader.js +78 -0
- package/dist/utils/resource-loader.js.map +1 -0
- package/dist/workflows/index.d.ts +3 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +19 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/workflow-loader.d.ts +12 -0
- package/dist/workflows/workflow-loader.d.ts.map +1 -0
- package/dist/workflows/workflow-loader.js +24 -0
- package/dist/workflows/workflow-loader.js.map +1 -0
- package/dist/workflows-sdk/composer.d.ts +2 -0
- package/dist/workflows-sdk/composer.d.ts.map +1 -0
- package/dist/workflows-sdk/composer.js +18 -0
- package/dist/workflows-sdk/composer.js.map +1 -0
- package/dist/workflows-sdk/index.d.ts +3 -0
- package/dist/workflows-sdk/index.d.ts.map +1 -0
- package/dist/workflows-sdk/index.js +19 -0
- package/dist/workflows-sdk/index.js.map +1 -0
- package/dist/zod/index.d.ts +2 -0
- package/dist/zod/index.d.ts.map +1 -0
- package/dist/zod/index.js +18 -0
- package/dist/zod/index.js.map +1 -0
- package/dist/zod/zod-helpers.d.ts +3 -0
- package/dist/zod/zod-helpers.d.ts.map +1 -0
- package/dist/zod/zod-helpers.js +95 -0
- package/dist/zod/zod-helpers.js.map +1 -0
- package/package.json +133 -0
package/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { AdminOptions, Logger } from "@8medusa/types";
|
|
2
|
+
import type tsStatic from "typescript";
|
|
3
|
+
/**
|
|
4
|
+
* The compiler exposes the opinionated APIs for compiling Medusa
|
|
5
|
+
* applications and plugins. You can perform the following
|
|
6
|
+
* actions.
|
|
7
|
+
*
|
|
8
|
+
* - loadTSConfigFile: Load and parse the TypeScript config file. All errors
|
|
9
|
+
* will be reported using the logger.
|
|
10
|
+
*
|
|
11
|
+
* - buildAppBackend: Compile the Medusa application backend source code to the
|
|
12
|
+
* ".medusa/server" directory. The admin source and integration-tests are
|
|
13
|
+
* skipped.
|
|
14
|
+
*
|
|
15
|
+
* - buildAppFrontend: Compile the admin extensions using the "@medusjs/admin-bundler"
|
|
16
|
+
* package. Admin can be compiled for self hosting (aka adminOnly), or can be compiled
|
|
17
|
+
* to be bundled with the backend output.
|
|
18
|
+
*/
|
|
19
|
+
export declare class Compiler {
|
|
20
|
+
#private;
|
|
21
|
+
constructor(projectRoot: string, logger: Logger);
|
|
22
|
+
/**
|
|
23
|
+
* Loads and parses the TypeScript config file. In case of an error, the errors
|
|
24
|
+
* will be logged using the logger and undefined it returned
|
|
25
|
+
*/
|
|
26
|
+
loadTSConfigFile(): Promise<tsStatic.ParsedCommandLine | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Builds the application backend source code using
|
|
29
|
+
* TypeScript's official compiler. Also performs
|
|
30
|
+
* type-checking
|
|
31
|
+
*/
|
|
32
|
+
buildAppBackend(tsConfig: tsStatic.ParsedCommandLine): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Builds the frontend source code of a Medusa application
|
|
35
|
+
* using the "@8medusa/admin-bundler" package.
|
|
36
|
+
*/
|
|
37
|
+
buildAppFrontend(adminOnly: boolean, tsConfig: tsStatic.ParsedCommandLine, adminBundler: {
|
|
38
|
+
build: (options: AdminOptions & {
|
|
39
|
+
sources: string[];
|
|
40
|
+
plugins: string[];
|
|
41
|
+
outDir: string;
|
|
42
|
+
}) => Promise<void>;
|
|
43
|
+
}): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Compiles the plugin source code to JavaScript using the
|
|
46
|
+
* TypeScript's official compiler
|
|
47
|
+
*/
|
|
48
|
+
buildPluginBackend(tsConfig: tsStatic.ParsedCommandLine): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Compiles the backend source code of a plugin project in watch
|
|
51
|
+
* mode. Type-checking is disabled to keep compilation fast.
|
|
52
|
+
*
|
|
53
|
+
* The "onFileChange" argument can be used to get notified when
|
|
54
|
+
* a file has changed.
|
|
55
|
+
*/
|
|
56
|
+
developPluginBackend(transformer: (filePath: string) => Promise<string>, onFileChange?: (filePath: string, action: "add" | "change" | "unlink") => void): Promise<void>;
|
|
57
|
+
buildPluginAdminExtensions(bundler: {
|
|
58
|
+
plugin: (options: {
|
|
59
|
+
root: string;
|
|
60
|
+
outDir: string;
|
|
61
|
+
}) => Promise<void>;
|
|
62
|
+
}): Promise<boolean>;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../src/build-tools/compiler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAKxE,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAA;AAEtC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,QAAQ;;gBASP,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IA2L/C;;;OAGG;IACG,gBAAgB,IAAI,OAAO,CAAC,QAAQ,CAAC,iBAAiB,GAAG,SAAS,CAAC;IA2CzE;;;;OAIG;IACG,eAAe,CACnB,QAAQ,EAAE,QAAQ,CAAC,iBAAiB,GACnC,OAAO,CAAC,OAAO,CAAC;IAmDnB;;;OAGG;IACG,gBAAgB,CACpB,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,QAAQ,CAAC,iBAAiB,EACpC,YAAY,EAAE;QACZ,KAAK,EAAE,CACL,OAAO,EAAE,YAAY,GAAG;YACtB,OAAO,EAAE,MAAM,EAAE,CAAA;YACjB,OAAO,EAAE,MAAM,EAAE,CAAA;YACjB,MAAM,EAAE,MAAM,CAAA;SACf,KACE,OAAO,CAAC,IAAI,CAAC,CAAA;KACnB,GACA,OAAO,CAAC,OAAO,CAAC;IA0EnB;;;OAGG;IACG,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,iBAAiB;IA8C7D;;;;;;OAMG;IACG,oBAAoB,CACxB,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,EAClD,YAAY,CAAC,EAAE,CACb,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,KAChC,IAAI;IA8DL,0BAA0B,CAAC,OAAO,EAAE;QACxC,MAAM,EAAE,CAAC,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;KACrE;CAkBF"}
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
var _Compiler_instances, _Compiler_logger, _Compiler_projectRoot, _Compiler_tsConfigPath, _Compiler_pluginsDistFolder, _Compiler_backendIgnoreFiles, _Compiler_adminOnlyDistFolder, _Compiler_tsCompiler, _Compiler_trackDuration, _Compiler_computeDist, _Compiler_loadTSCompiler, _Compiler_copy, _Compiler_copyPkgManagerFiles, _Compiler_clean, _Compiler_isScriptFile, _Compiler_loadMedusaConfig, _Compiler_printDiagnostics, _Compiler_emitBuildOutput;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.Compiler = void 0;
|
|
19
|
+
const utils_1 = require("@8medusa/utils");
|
|
20
|
+
const chokidar_1 = __importDefault(require("chokidar"));
|
|
21
|
+
const promises_1 = require("fs/promises");
|
|
22
|
+
const path_1 = __importDefault(require("path"));
|
|
23
|
+
/**
|
|
24
|
+
* The compiler exposes the opinionated APIs for compiling Medusa
|
|
25
|
+
* applications and plugins. You can perform the following
|
|
26
|
+
* actions.
|
|
27
|
+
*
|
|
28
|
+
* - loadTSConfigFile: Load and parse the TypeScript config file. All errors
|
|
29
|
+
* will be reported using the logger.
|
|
30
|
+
*
|
|
31
|
+
* - buildAppBackend: Compile the Medusa application backend source code to the
|
|
32
|
+
* ".medusa/server" directory. The admin source and integration-tests are
|
|
33
|
+
* skipped.
|
|
34
|
+
*
|
|
35
|
+
* - buildAppFrontend: Compile the admin extensions using the "@medusjs/admin-bundler"
|
|
36
|
+
* package. Admin can be compiled for self hosting (aka adminOnly), or can be compiled
|
|
37
|
+
* to be bundled with the backend output.
|
|
38
|
+
*/
|
|
39
|
+
class Compiler {
|
|
40
|
+
constructor(projectRoot, logger) {
|
|
41
|
+
_Compiler_instances.add(this);
|
|
42
|
+
_Compiler_logger.set(this, void 0);
|
|
43
|
+
_Compiler_projectRoot.set(this, void 0);
|
|
44
|
+
_Compiler_tsConfigPath.set(this, void 0);
|
|
45
|
+
_Compiler_pluginsDistFolder.set(this, void 0);
|
|
46
|
+
_Compiler_backendIgnoreFiles.set(this, void 0);
|
|
47
|
+
_Compiler_adminOnlyDistFolder.set(this, void 0);
|
|
48
|
+
_Compiler_tsCompiler.set(this, void 0);
|
|
49
|
+
__classPrivateFieldSet(this, _Compiler_projectRoot, projectRoot, "f");
|
|
50
|
+
__classPrivateFieldSet(this, _Compiler_logger, logger, "f");
|
|
51
|
+
__classPrivateFieldSet(this, _Compiler_tsConfigPath, path_1.default.join(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), "tsconfig.json"), "f");
|
|
52
|
+
__classPrivateFieldSet(this, _Compiler_adminOnlyDistFolder, path_1.default.join(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), ".medusa/admin"), "f");
|
|
53
|
+
__classPrivateFieldSet(this, _Compiler_pluginsDistFolder, path_1.default.join(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), ".medusa/server"), "f");
|
|
54
|
+
__classPrivateFieldSet(this, _Compiler_backendIgnoreFiles, [
|
|
55
|
+
"integration-tests",
|
|
56
|
+
"test",
|
|
57
|
+
"unit-tests",
|
|
58
|
+
"src/admin",
|
|
59
|
+
], "f");
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Loads and parses the TypeScript config file. In case of an error, the errors
|
|
63
|
+
* will be logged using the logger and undefined it returned
|
|
64
|
+
*/
|
|
65
|
+
async loadTSConfigFile() {
|
|
66
|
+
const ts = await __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_loadTSCompiler).call(this);
|
|
67
|
+
let tsConfigErrors = [];
|
|
68
|
+
const tsConfig = ts.getParsedCommandLineOfConfigFile(__classPrivateFieldGet(this, _Compiler_tsConfigPath, "f"), {
|
|
69
|
+
inlineSourceMap: true,
|
|
70
|
+
excludes: [],
|
|
71
|
+
}, {
|
|
72
|
+
...ts.sys,
|
|
73
|
+
useCaseSensitiveFileNames: true,
|
|
74
|
+
getCurrentDirectory: () => __classPrivateFieldGet(this, _Compiler_projectRoot, "f"),
|
|
75
|
+
onUnRecoverableConfigFileDiagnostic: (error) => (tsConfigErrors = [error]),
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* Push errors from the tsConfig parsed output to the
|
|
79
|
+
* tsConfigErrors array.
|
|
80
|
+
*/
|
|
81
|
+
if (tsConfig?.errors.length) {
|
|
82
|
+
tsConfigErrors.push(...tsConfig.errors);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Display all config errors using the diagnostics reporter
|
|
86
|
+
*/
|
|
87
|
+
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_printDiagnostics).call(this, ts, tsConfigErrors);
|
|
88
|
+
/**
|
|
89
|
+
* Return undefined when there are errors in parsing the config
|
|
90
|
+
* file
|
|
91
|
+
*/
|
|
92
|
+
if (tsConfigErrors.length) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
return tsConfig;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Builds the application backend source code using
|
|
99
|
+
* TypeScript's official compiler. Also performs
|
|
100
|
+
* type-checking
|
|
101
|
+
*/
|
|
102
|
+
async buildAppBackend(tsConfig) {
|
|
103
|
+
const tracker = __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_trackDuration).call(this);
|
|
104
|
+
const dist = __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_computeDist).call(this, tsConfig);
|
|
105
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info("Compiling backend source...");
|
|
106
|
+
/**
|
|
107
|
+
* Step 1: Cleanup existing build output
|
|
108
|
+
*/
|
|
109
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info(`Removing existing "${path_1.default.relative(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), dist)}" folder`);
|
|
110
|
+
await __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_clean).call(this, dist);
|
|
111
|
+
/**
|
|
112
|
+
* Step 2: Compile TypeScript source code
|
|
113
|
+
*/
|
|
114
|
+
const { emitResult, diagnostics } = await __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_emitBuildOutput).call(this, tsConfig, __classPrivateFieldGet(this, _Compiler_backendIgnoreFiles, "f"), dist);
|
|
115
|
+
/**
|
|
116
|
+
* Exit early if no output is written to the disk
|
|
117
|
+
*/
|
|
118
|
+
if (emitResult.emitSkipped) {
|
|
119
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").warn("Backend build completed without emitting any output");
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Step 3: Copy package manager files to the output folder
|
|
124
|
+
*/
|
|
125
|
+
await __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_copyPkgManagerFiles).call(this, dist);
|
|
126
|
+
/**
|
|
127
|
+
* Notify about the state of build
|
|
128
|
+
*/
|
|
129
|
+
if (diagnostics.length) {
|
|
130
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").warn(`Backend build completed with errors (${tracker.getSeconds()}s)`);
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info(`Backend build completed successfully (${tracker.getSeconds()}s)`);
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Builds the frontend source code of a Medusa application
|
|
138
|
+
* using the "@8medusa/admin-bundler" package.
|
|
139
|
+
*/
|
|
140
|
+
async buildAppFrontend(adminOnly, tsConfig, adminBundler) {
|
|
141
|
+
const tracker = __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_trackDuration).call(this);
|
|
142
|
+
/**
|
|
143
|
+
* Step 1: Load the medusa config file to read
|
|
144
|
+
* admin options
|
|
145
|
+
*/
|
|
146
|
+
const configFile = await __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_loadMedusaConfig).call(this);
|
|
147
|
+
if (!configFile) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Return early when admin is disabled and we are trying to
|
|
152
|
+
* create a bundled build for the admin.
|
|
153
|
+
*/
|
|
154
|
+
if (configFile.configModule.admin.disable && !adminOnly) {
|
|
155
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info("Skipping admin build, since its disabled inside the medusa-config file");
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Warn when we are creating an admin only build, but forgot to disable
|
|
160
|
+
* the admin inside the config file
|
|
161
|
+
*/
|
|
162
|
+
if (!configFile.configModule.admin.disable && adminOnly) {
|
|
163
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").warn(`You are building using the flag --admin-only but the admin is enabled in your medusa-config, If you intend to host the dashboard separately you should disable the admin in your medusa config`);
|
|
164
|
+
}
|
|
165
|
+
const plugins = await (0, utils_1.getResolvedPlugins)(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), configFile.configModule, true);
|
|
166
|
+
const adminSources = plugins
|
|
167
|
+
.map((plugin) => plugin.admin?.type === "local" ? plugin.admin.resolve : undefined)
|
|
168
|
+
.filter(Boolean);
|
|
169
|
+
const adminPlugins = plugins
|
|
170
|
+
.map((plugin) => plugin.admin?.type === "package" ? plugin.admin.resolve : undefined)
|
|
171
|
+
.filter(Boolean);
|
|
172
|
+
try {
|
|
173
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info("Compiling frontend source...");
|
|
174
|
+
await adminBundler.build({
|
|
175
|
+
disable: false,
|
|
176
|
+
sources: adminSources,
|
|
177
|
+
plugins: adminPlugins,
|
|
178
|
+
...configFile.configModule.admin,
|
|
179
|
+
outDir: adminOnly
|
|
180
|
+
? __classPrivateFieldGet(this, _Compiler_adminOnlyDistFolder, "f")
|
|
181
|
+
: path_1.default.join(__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_computeDist).call(this, tsConfig), "./public/admin"),
|
|
182
|
+
});
|
|
183
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info(`Frontend build completed successfully (${tracker.getSeconds()}s)`);
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").error("Unable to compile frontend source");
|
|
188
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").error(error);
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Compiles the plugin source code to JavaScript using the
|
|
194
|
+
* TypeScript's official compiler
|
|
195
|
+
*/
|
|
196
|
+
async buildPluginBackend(tsConfig) {
|
|
197
|
+
const tracker = __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_trackDuration).call(this);
|
|
198
|
+
const dist = ".medusa/server";
|
|
199
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info("Compiling plugin source...");
|
|
200
|
+
/**
|
|
201
|
+
* Step 1: Cleanup existing build output
|
|
202
|
+
*/
|
|
203
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info(`Removing existing "${path_1.default.relative(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), dist)}" folder`);
|
|
204
|
+
await __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_clean).call(this, dist);
|
|
205
|
+
/**
|
|
206
|
+
* Step 2: Compile TypeScript source code
|
|
207
|
+
*/
|
|
208
|
+
const { emitResult, diagnostics } = await __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_emitBuildOutput).call(this, tsConfig, __classPrivateFieldGet(this, _Compiler_backendIgnoreFiles, "f"), dist);
|
|
209
|
+
/**
|
|
210
|
+
* Exit early if no output is written to the disk
|
|
211
|
+
*/
|
|
212
|
+
if (emitResult.emitSkipped) {
|
|
213
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").warn("Plugin build completed without emitting any output");
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Notify about the state of build
|
|
218
|
+
*/
|
|
219
|
+
if (diagnostics.length) {
|
|
220
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").warn(`Plugin build completed with errors (${tracker.getSeconds()}s)`);
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info(`Plugin build completed successfully (${tracker.getSeconds()}s)`);
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Compiles the backend source code of a plugin project in watch
|
|
228
|
+
* mode. Type-checking is disabled to keep compilation fast.
|
|
229
|
+
*
|
|
230
|
+
* The "onFileChange" argument can be used to get notified when
|
|
231
|
+
* a file has changed.
|
|
232
|
+
*/
|
|
233
|
+
async developPluginBackend(transformer, onFileChange) {
|
|
234
|
+
const fs = new utils_1.FileSystem(__classPrivateFieldGet(this, _Compiler_pluginsDistFolder, "f"));
|
|
235
|
+
await fs.createJson("medusa-plugin-options.json", {
|
|
236
|
+
srcDir: path_1.default.join(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), "src"),
|
|
237
|
+
});
|
|
238
|
+
const watcher = chokidar_1.default.watch(["."], {
|
|
239
|
+
ignoreInitial: true,
|
|
240
|
+
cwd: __classPrivateFieldGet(this, _Compiler_projectRoot, "f"),
|
|
241
|
+
ignored: [
|
|
242
|
+
/(^|[\\/\\])\../,
|
|
243
|
+
"node_modules",
|
|
244
|
+
"dist",
|
|
245
|
+
"static",
|
|
246
|
+
"private",
|
|
247
|
+
".medusa/**/*",
|
|
248
|
+
...__classPrivateFieldGet(this, _Compiler_backendIgnoreFiles, "f"),
|
|
249
|
+
],
|
|
250
|
+
});
|
|
251
|
+
watcher.on("add", async (file) => {
|
|
252
|
+
if (!__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_isScriptFile).call(this, file)) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const relativePath = path_1.default.relative(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), file);
|
|
256
|
+
const outputPath = relativePath.replace(/\.ts$/, ".js");
|
|
257
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info(`${relativePath} updated: Republishing changes`);
|
|
258
|
+
await fs.create(outputPath, await transformer(file));
|
|
259
|
+
onFileChange?.(file, "add");
|
|
260
|
+
});
|
|
261
|
+
watcher.on("change", async (file) => {
|
|
262
|
+
if (!__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_isScriptFile).call(this, file)) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const relativePath = path_1.default.relative(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), file);
|
|
266
|
+
const outputPath = relativePath.replace(/\.ts$/, ".js");
|
|
267
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info(`${relativePath} updated: Republishing changes`);
|
|
268
|
+
await fs.create(outputPath, await transformer(file));
|
|
269
|
+
onFileChange?.(file, "change");
|
|
270
|
+
});
|
|
271
|
+
watcher.on("unlink", async (file) => {
|
|
272
|
+
if (!__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_isScriptFile).call(this, file)) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const relativePath = path_1.default.relative(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), file);
|
|
276
|
+
const outputPath = relativePath.replace(/\.ts$/, ".js");
|
|
277
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info(`${relativePath} removed: Republishing changes`);
|
|
278
|
+
await fs.remove(outputPath);
|
|
279
|
+
onFileChange?.(file, "unlink");
|
|
280
|
+
});
|
|
281
|
+
watcher.on("ready", () => {
|
|
282
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info("watching for file changes");
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
async buildPluginAdminExtensions(bundler) {
|
|
286
|
+
const tracker = __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_trackDuration).call(this);
|
|
287
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info("Compiling plugin admin extensions...");
|
|
288
|
+
try {
|
|
289
|
+
await bundler.plugin({
|
|
290
|
+
root: __classPrivateFieldGet(this, _Compiler_projectRoot, "f"),
|
|
291
|
+
outDir: __classPrivateFieldGet(this, _Compiler_pluginsDistFolder, "f"),
|
|
292
|
+
});
|
|
293
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").info(`Plugin admin extensions build completed successfully (${tracker.getSeconds()}s)`);
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
catch (error) {
|
|
297
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").error(`Plugin admin extensions build failed`, error);
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
exports.Compiler = Compiler;
|
|
303
|
+
_Compiler_logger = new WeakMap(), _Compiler_projectRoot = new WeakMap(), _Compiler_tsConfigPath = new WeakMap(), _Compiler_pluginsDistFolder = new WeakMap(), _Compiler_backendIgnoreFiles = new WeakMap(), _Compiler_adminOnlyDistFolder = new WeakMap(), _Compiler_tsCompiler = new WeakMap(), _Compiler_instances = new WeakSet(), _Compiler_trackDuration = function _Compiler_trackDuration() {
|
|
304
|
+
const startTime = process.hrtime();
|
|
305
|
+
return {
|
|
306
|
+
getSeconds() {
|
|
307
|
+
const duration = process.hrtime(startTime);
|
|
308
|
+
return (duration[0] + duration[1] / 1e9).toFixed(2);
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
}, _Compiler_computeDist = function _Compiler_computeDist(tsConfig) {
|
|
312
|
+
const distFolder = tsConfig.options.outDir ?? ".medusa/server";
|
|
313
|
+
return path_1.default.isAbsolute(distFolder)
|
|
314
|
+
? distFolder
|
|
315
|
+
: path_1.default.join(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), distFolder);
|
|
316
|
+
}, _Compiler_loadTSCompiler =
|
|
317
|
+
/**
|
|
318
|
+
* Imports and stores a reference to the TypeScript compiler.
|
|
319
|
+
* We dynamically import "typescript", since its is a dev
|
|
320
|
+
* only dependency
|
|
321
|
+
*/
|
|
322
|
+
async function _Compiler_loadTSCompiler() {
|
|
323
|
+
if (!__classPrivateFieldGet(this, _Compiler_tsCompiler, "f")) {
|
|
324
|
+
__classPrivateFieldSet(this, _Compiler_tsCompiler, await import("typescript"), "f");
|
|
325
|
+
}
|
|
326
|
+
return __classPrivateFieldGet(this, _Compiler_tsCompiler, "f");
|
|
327
|
+
}, _Compiler_copy =
|
|
328
|
+
/**
|
|
329
|
+
* Copies the file to the destination without throwing any
|
|
330
|
+
* errors if the source file is missing
|
|
331
|
+
*/
|
|
332
|
+
async function _Compiler_copy(source, destination) {
|
|
333
|
+
let sourceExists = false;
|
|
334
|
+
try {
|
|
335
|
+
await (0, promises_1.access)(source, promises_1.constants.F_OK);
|
|
336
|
+
sourceExists = true;
|
|
337
|
+
}
|
|
338
|
+
catch (error) {
|
|
339
|
+
if (error.code !== "ENOENT") {
|
|
340
|
+
throw error;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (sourceExists) {
|
|
344
|
+
await (0, promises_1.copyFile)(path_1.default.join(source), path_1.default.join(destination));
|
|
345
|
+
}
|
|
346
|
+
}, _Compiler_copyPkgManagerFiles =
|
|
347
|
+
/**
|
|
348
|
+
* Copies package manager files from the project root
|
|
349
|
+
* to the specified dist folder
|
|
350
|
+
*/
|
|
351
|
+
async function _Compiler_copyPkgManagerFiles(dist) {
|
|
352
|
+
/**
|
|
353
|
+
* Copying package manager files
|
|
354
|
+
*/
|
|
355
|
+
await __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_copy).call(this, path_1.default.join(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), "package.json"), path_1.default.join(dist, "package.json"));
|
|
356
|
+
await __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_copy).call(this, path_1.default.join(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), "yarn.lock"), path_1.default.join(dist, "yarn.lock"));
|
|
357
|
+
await __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_copy).call(this, path_1.default.join(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), "pnpm.lock"), path_1.default.join(dist, "pnpm.lock"));
|
|
358
|
+
await __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_copy).call(this, path_1.default.join(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), "package-lock.json"), path_1.default.join(dist, "package-lock.json"));
|
|
359
|
+
}, _Compiler_clean =
|
|
360
|
+
/**
|
|
361
|
+
* Removes the directory and its children recursively and
|
|
362
|
+
* ignores any errors
|
|
363
|
+
*/
|
|
364
|
+
async function _Compiler_clean(path) {
|
|
365
|
+
await (0, promises_1.rm)(path, { recursive: true }).catch(() => { });
|
|
366
|
+
}, _Compiler_isScriptFile = function _Compiler_isScriptFile(filePath) {
|
|
367
|
+
if (filePath.endsWith(".ts") && !filePath.endsWith(".d.ts")) {
|
|
368
|
+
return true;
|
|
369
|
+
}
|
|
370
|
+
return filePath.endsWith(".js");
|
|
371
|
+
}, _Compiler_loadMedusaConfig =
|
|
372
|
+
/**
|
|
373
|
+
* Loads the medusa config file and prints the error to
|
|
374
|
+
* the console (in case of any errors). Otherwise, the
|
|
375
|
+
* file path and the parsed config is returned
|
|
376
|
+
*/
|
|
377
|
+
async function _Compiler_loadMedusaConfig() {
|
|
378
|
+
const { configModule, configFilePath, error } = await (0, utils_1.getConfigFile)(__classPrivateFieldGet(this, _Compiler_projectRoot, "f"), "medusa-config");
|
|
379
|
+
if (error) {
|
|
380
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").error(`Failed to load medusa-config.(js|ts) file`);
|
|
381
|
+
__classPrivateFieldGet(this, _Compiler_logger, "f").error(error);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
return { configFilePath, configModule };
|
|
385
|
+
}, _Compiler_printDiagnostics = function _Compiler_printDiagnostics(ts, diagnostics) {
|
|
386
|
+
if (diagnostics.length) {
|
|
387
|
+
console.error(ts.formatDiagnosticsWithColorAndContext(diagnostics, ts.createCompilerHost({})));
|
|
388
|
+
}
|
|
389
|
+
}, _Compiler_emitBuildOutput =
|
|
390
|
+
/**
|
|
391
|
+
* Given a tsconfig file, this method will write the compiled
|
|
392
|
+
* output to the specified destination
|
|
393
|
+
*/
|
|
394
|
+
async function _Compiler_emitBuildOutput(tsConfig, chunksToIgnore, dist) {
|
|
395
|
+
const ts = await __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_loadTSCompiler).call(this);
|
|
396
|
+
const filesToCompile = tsConfig.fileNames.filter((fileName) => {
|
|
397
|
+
return !chunksToIgnore.some((chunk) => fileName.includes(`${chunk}/`));
|
|
398
|
+
});
|
|
399
|
+
/**
|
|
400
|
+
* Create emit program to compile and emit output
|
|
401
|
+
*/
|
|
402
|
+
const program = ts.createProgram(filesToCompile, {
|
|
403
|
+
...tsConfig.options,
|
|
404
|
+
...{
|
|
405
|
+
outDir: dist,
|
|
406
|
+
inlineSourceMap: !tsConfig.options.sourceMap,
|
|
407
|
+
},
|
|
408
|
+
});
|
|
409
|
+
const emitResult = program.emit();
|
|
410
|
+
const diagnostics = ts
|
|
411
|
+
.getPreEmitDiagnostics(program)
|
|
412
|
+
.concat(emitResult.diagnostics);
|
|
413
|
+
/**
|
|
414
|
+
* Log errors (if any)
|
|
415
|
+
*/
|
|
416
|
+
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_printDiagnostics).call(this, ts, diagnostics);
|
|
417
|
+
return { emitResult, diagnostics };
|
|
418
|
+
};
|
|
419
|
+
//# sourceMappingURL=compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.js","sourceRoot":"","sources":["../../src/build-tools/compiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,0CAA8E;AAC9E,wDAA+B;AAC/B,0CAA6D;AAC7D,gDAAuB;AAGvB;;;;;;;;;;;;;;;GAeG;AACH,MAAa,QAAQ;IASnB,YAAY,WAAmB,EAAE,MAAc;;QAR/C,mCAAe;QACf,wCAAoB;QACpB,yCAAqB;QACrB,8CAA0B;QAC1B,+CAA6B;QAC7B,gDAA4B;QAC5B,uCAA6B;QAG3B,uBAAA,IAAI,yBAAgB,WAAW,MAAA,CAAA;QAC/B,uBAAA,IAAI,oBAAW,MAAM,MAAA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/C,GAAG,QAAQ,CAAC,OAAO;QACnB,GAAG;YACD,MAAM,EAAE,IAAI;YACZ,eAAe,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS;SAC7C;KACF,CAAC,CAAA;IAEF,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,CAAA;IACjC,MAAM,WAAW,GAAG,EAAE;SACnB,qBAAqB,CAAC,OAAO,CAAC;SAC9B,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;IAEjC;;OAEG;IACH,uBAAA,IAAI,uDAAkB,MAAtB,IAAI,EAAmB,EAAE,EAAE,WAAW,CAAC,CAAA;IAEvC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/build-tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./compiler"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/build-tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ConfigModule } from "./types";
|
|
2
|
+
export declare class ConfigManager {
|
|
3
|
+
#private;
|
|
4
|
+
get config(): ConfigModule;
|
|
5
|
+
get baseDir(): string;
|
|
6
|
+
get isProduction(): boolean;
|
|
7
|
+
constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Rejects an error either by throwing when in production or by logging the error as a warning
|
|
10
|
+
* @param error
|
|
11
|
+
* @protected
|
|
12
|
+
*/
|
|
13
|
+
protected rejectErrors(error: string): never | void;
|
|
14
|
+
/**
|
|
15
|
+
* Builds the http config object and assign the defaults if needed
|
|
16
|
+
* @param projectConfig
|
|
17
|
+
* @protected
|
|
18
|
+
*/
|
|
19
|
+
protected buildHttpConfig(projectConfig: Partial<ConfigModule["projectConfig"]>): ConfigModule["projectConfig"]["http"];
|
|
20
|
+
/**
|
|
21
|
+
* Normalizes the project config object and assign the defaults if needed
|
|
22
|
+
* @param projectConfig
|
|
23
|
+
* @protected
|
|
24
|
+
*/
|
|
25
|
+
protected normalizeProjectConfig(projectConfig: Partial<ConfigModule["projectConfig"]>): ConfigModule["projectConfig"];
|
|
26
|
+
/**
|
|
27
|
+
* Prepare the full configuration after validation and normalization
|
|
28
|
+
*/
|
|
29
|
+
loadConfig({ projectConfig, baseDir, }: {
|
|
30
|
+
projectConfig: Partial<ConfigModule>;
|
|
31
|
+
baseDir: string;
|
|
32
|
+
}): ConfigModule;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAItC,qBAAa,aAAa;;IA8BxB,IAAI,MAAM,IAAI,YAAY,CAOzB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,YAAY,IAAI,OAAO,CAE1B;;IAID;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI;IAQnD;;;;OAIG;IACH,SAAS,CAAC,eAAe,CACvB,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,GACpD,YAAY,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC;IAqCxC;;;;OAIG;IACH,SAAS,CAAC,sBAAsB,CAC9B,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,GACpD,YAAY,CAAC,eAAe,CAAC;IA+BhC;;OAEG;IACH,UAAU,CAAC,EACT,aAAkB,EAClB,OAAO,GACR,EAAE;QACD,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;QACpC,OAAO,EAAE,MAAM,CAAA;KAChB,GAAG,YAAY;CAmBjB"}
|