eddev 0.2.65 → 0.2.67-beta1
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/admin/components/ImageWell.d.ts +2 -3
- package/admin/components/ImageWell.js +39 -51
- package/admin/defineField.d.ts +2 -2
- package/admin/defineWidget.d.ts +1 -1
- package/admin/defineWidget.js +2 -2
- package/admin/index.js +5 -1
- package/admin/installFieldTypes.js +26 -26
- package/admin/runWidgets.js +17 -28
- package/admin/selectMedia.d.ts +2 -2
- package/admin/selectMedia.js +1 -1
- package/blocks/ContentBlocks.d.ts +6 -6
- package/blocks/ContentBlocks.js +58 -66
- package/blocks/ErrorBoundaryEditor.d.ts +1 -1
- package/blocks/ErrorBoundaryEditor.js +16 -45
- package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
- package/blocks/ErrorBoundaryFrontend.js +16 -45
- package/blocks/InspectorControls.d.ts +1 -1
- package/blocks/InspectorControls.js +3 -3
- package/blocks/blockAttributes.d.ts +2 -2
- package/blocks/blockAttributes.js +24 -44
- package/blocks/index.js +5 -1
- package/blocks/inlineEditing.d.ts +7 -7
- package/blocks/inlineEditing.js +36 -55
- package/blocks/installGutenbergHooks.js +48 -68
- package/build/babel/plugin-name-defined-components.js +15 -16
- package/build/build-favicon.js +11 -62
- package/build/clean.js +5 -52
- package/build/create-codegen-worker.js +78 -33
- package/build/create-serverless-dev-worker.js +61 -39
- package/build/create-webpack-worker.js +65 -33
- package/build/file-tree.d.ts +2 -2
- package/build/file-tree.js +12 -12
- package/build/get-webpack-config.js +341 -395
- package/build/graphql-codegen/graphql-codegen-files.js +31 -25
- package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
- package/build/graphql-codegen/graphql-codegen-queries.js +102 -99
- package/build/manifests/manifest-blocks.d.ts +1 -1
- package/build/manifests/manifest-blocks.js +37 -29
- package/build/manifests/manifest-fields.d.ts +1 -1
- package/build/manifests/manifest-fields.js +23 -21
- package/build/manifests/manifest-views.d.ts +1 -1
- package/build/manifests/manifest-views.js +32 -25
- package/build/manifests/manifest-widgets.d.ts +1 -1
- package/build/manifests/manifest-widgets.js +22 -20
- package/build/manifests/manifest.d.ts +2 -2
- package/build/manifests/manifest.js +30 -90
- package/build/reporter.d.ts +1 -1
- package/build/reporter.js +29 -32
- package/build/serverless/create-next-app.d.ts +1 -1
- package/build/serverless/create-next-app.js +245 -467
- package/build/state/codegen-state.d.ts +4 -4
- package/build/state/compiler-state.d.ts +5 -5
- package/build/state/serverless-state.d.ts +3 -3
- package/build/workers/codegen-worker-script.js +392 -507
- package/build/workers/serverless-worker-dev-script.js +4 -4
- package/build/workers/webpack-worker-script.js +89 -150
- package/cli/build.dev.d.ts +1 -1
- package/cli/build.dev.js +79 -126
- package/cli/build.prod.d.ts +1 -1
- package/cli/build.prod.js +42 -98
- package/cli/cli.js +16 -55
- package/cli/display/components/BundleDisplay.d.ts +1 -2
- package/cli/display/components/BundleDisplay.js +13 -24
- package/cli/display/components/CodegenDisplay.d.ts +1 -2
- package/cli/display/components/CodegenDisplay.js +14 -25
- package/cli/display/components/DevCLIDisplay.d.ts +2 -3
- package/cli/display/components/DevCLIDisplay.js +14 -25
- package/cli/display/components/Fullscreen.js +9 -20
- package/cli/display/components/ServerlessDisplay.d.ts +2 -3
- package/cli/display/components/ServerlessDisplay.js +15 -26
- package/cli/display/components/StatusIcon.d.ts +2 -3
- package/cli/display/components/StatusIcon.js +3 -3
- package/cli/preinstall.js +4 -5
- package/cli/setup.js +25 -73
- package/components/AdminBar.d.ts +1 -2
- package/components/AdminBar.js +37 -3
- package/components/BrowserRouter.d.ts +2 -2
- package/components/BrowserRouter.js +41 -54
- package/components/InlinePage.d.ts +2 -2
- package/components/InlinePage.js +17 -29
- package/components/NextRouter.d.ts +2 -2
- package/components/NextRouter.js +20 -29
- package/components/index.js +5 -1
- package/config/config-schema.d.ts +1 -1
- package/config/config-schema.js +1 -1
- package/config/create-schema-file.js +6 -6
- package/config/get-config.js +10 -13
- package/config/index.js +5 -1
- package/config/parse-config.js +1 -1
- package/config/print-zod-errors.js +3 -3
- package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -3
- package/dev-ui/components/BreakpointColumnHeader.js +7 -18
- package/dev-ui/components/BreakpointIndicator.d.ts +1 -2
- package/dev-ui/components/BreakpointIndicator.js +25 -32
- package/dev-ui/components/DevUI.d.ts +1 -2
- package/dev-ui/components/DevUI.js +13 -13
- package/dev-ui/components/Launcher.d.ts +2 -2
- package/dev-ui/components/Launcher.js +13 -25
- package/dev-ui/components/PanelWrapper.d.ts +2 -2
- package/dev-ui/components/PanelWrapper.js +8 -8
- package/dev-ui/components/ResponsiveLerpControl.d.ts +2 -3
- package/dev-ui/components/ResponsiveLerpControl.js +27 -38
- package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -5
- package/dev-ui/components/ResponsiveScaleEditor.js +64 -78
- package/dev-ui/components/atoms/Button.js +1 -1
- package/dev-ui/components/atoms/Dropdown.d.ts +3 -3
- package/dev-ui/components/atoms/Dropdown.js +8 -9
- package/dev-ui/components/atoms/NumberField.d.ts +2 -3
- package/dev-ui/components/atoms/NumberField.js +29 -42
- package/dev-ui/components/atoms/Spacer.js +1 -1
- package/dev-ui/components/atoms/Text.js +1 -1
- package/dev-ui/components/atoms/ToggleButton.d.ts +2 -2
- package/dev-ui/components/atoms/ToggleButton.js +5 -16
- package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
- package/dev-ui/components/atoms/Tooltip.js +8 -20
- package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -2
- package/dev-ui/components/panels/AppDataDebugger.js +8 -19
- package/dev-ui/components/panels/ColorEditor.d.ts +1 -2
- package/dev-ui/components/panels/ColorEditor.js +35 -42
- package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -2
- package/dev-ui/components/panels/PageDataDebugger.js +8 -20
- package/dev-ui/components/panels/QueryDebugger.d.ts +1 -2
- package/dev-ui/components/panels/QueryDebugger.js +12 -24
- package/dev-ui/components/panels/SpacingEditor.d.ts +1 -2
- package/dev-ui/components/panels/SpacingEditor.js +34 -48
- package/dev-ui/components/panels/TypographyEditor.d.ts +1 -2
- package/dev-ui/components/panels/TypographyEditor.js +38 -46
- package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
- package/dev-ui/hooks/useBreakpoint.js +13 -13
- package/dev-ui/hooks/usePersistState.js +6 -7
- package/dev-ui/hooks/useStylesheet.js +6 -6
- package/dev-ui/icons.d.ts +15 -16
- package/dev-ui/icons.js +16 -27
- package/dev-ui/index.js +5 -1
- package/dev-ui/loader.d.ts +1 -2
- package/dev-ui/loader.js +13 -9
- package/dev-ui/panels.d.ts +2 -2
- package/dev-ui/panels.js +7 -7
- package/dev-ui/theme.d.ts +96 -70
- package/dev-ui/theme.js +3 -3
- package/dynamic/dynamic-component.d.ts +1 -10
- package/dynamic/dynamic-component.js +1 -1
- package/dynamic/index.js +5 -1
- package/entry/Root.d.ts +2 -3
- package/entry/Root.js +16 -26
- package/entry/entry.admin.dev.js +4 -4
- package/entry/entry.admin.prod.js +4 -4
- package/entry/entry.monolith.dev.js +5 -5
- package/entry/entry.monolith.prod.js +5 -5
- package/gravityforms/gravity-forms.d.ts +2 -2
- package/gravityforms/index.js +5 -1
- package/gravityforms/useGravityForm.d.ts +2 -2
- package/gravityforms/useGravityForm.js +126 -130
- package/hooks/index.js +5 -1
- package/hooks/queryUtils.d.ts +14 -14
- package/hooks/queryUtils.js +101 -192
- package/hooks/useAppData.d.ts +2 -2
- package/hooks/useAppData.js +9 -9
- package/hooks/usePageLoad.js +4 -4
- package/hooks/useQueryDebug.d.ts +1 -1
- package/hooks/useQueryDebug.js +7 -7
- package/hooks/useRPC.d.ts +4 -4
- package/hooks/useRPC.js +3 -3
- package/package.json +7 -7
- package/routing/index.js +5 -1
- package/routing/remoteProps.d.ts +1 -1
- package/routing/remoteProps.js +31 -72
- package/routing/routing.d.ts +15 -15
- package/routing/routing.js +108 -170
- package/routing/updateEditLink.js +1 -1
- package/serverless/define-api.d.ts +1 -1
- package/serverless/define-rpc-router.js +8 -4
- package/serverless/index.js +6 -2
- package/serverless-template/_utils/fetch-wordpress-props.ts +0 -4
- package/serverless-template/_utils/fetch-wp.ts +0 -1
- package/style/createStitches.d.ts +375 -783
- package/style/createStitches.js +164 -142
- package/style/index.js +5 -1
- package/tsconfig.json +1 -1
- package/utils/Observable.d.ts +2 -2
- package/utils/Observable.js +12 -15
- package/utils/getRepoName.js +3 -3
- package/utils/promptIfRepoNameIncorrect.js +18 -64
- package/utils/refreshOverlayInterop.js +1 -1
- package/utils/reportErrorStack.d.ts +1 -1
- package/utils/reportErrorStack.js +1 -1
- package/utils/serverlessAppContext.js +1 -1
- package/utils/updateEnvFile.js +19 -69
- package/utils/useObservable.js +3 -3
- package/views/index.js +5 -1
|
@@ -4,37 +4,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createFieldManifestGenerator = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const manifest_1 = require("./manifest");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const change_case_1 = require("change-case");
|
|
10
10
|
function createFieldManifestGenerator(opts) {
|
|
11
11
|
return (0, manifest_1.createManifestGenerator)({
|
|
12
12
|
glob: path_1.default.join(opts.baseDirectory, "/backend/fields/**.tsx"),
|
|
13
13
|
onGenerate: opts.onGenerate,
|
|
14
14
|
watch: opts.watch,
|
|
15
|
-
generate
|
|
15
|
+
generate(fileNames) {
|
|
16
16
|
if (opts.isAdmin) {
|
|
17
|
-
|
|
18
|
-
.filter(
|
|
19
|
-
.map(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return { relative
|
|
17
|
+
const files = fileNames
|
|
18
|
+
.filter((file) => !file.includes("/_app"))
|
|
19
|
+
.map((file) => {
|
|
20
|
+
const relative = path_1.default.relative(opts.baseDirectory, file);
|
|
21
|
+
const name = path_1.default.basename(file).replace(/\.(jsx|tsx|ts|js)$/i, "");
|
|
22
|
+
const module = JSON.stringify("./" + relative);
|
|
23
|
+
const componentName = "FieldType" + (0, change_case_1.pascalCase)(name);
|
|
24
|
+
return { relative, name, module, componentName };
|
|
25
25
|
});
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return "
|
|
26
|
+
return `
|
|
27
|
+
${files.map(({ componentName, module }) => `import ${componentName} from ${module}`).join("\n")}
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
${files
|
|
31
|
+
.map(({ relative, componentName, module, name }) => {
|
|
32
|
+
return `"${name}": ${componentName}`;
|
|
33
33
|
})
|
|
34
|
-
.join(",\n")
|
|
34
|
+
.join(",\n")}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
35
37
|
}
|
|
36
38
|
else {
|
|
37
|
-
return
|
|
39
|
+
return `export default {}`;
|
|
38
40
|
}
|
|
39
41
|
},
|
|
40
42
|
});
|
|
@@ -4,45 +4,52 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createViewManifestGenerator = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const manifest_1 = require("./manifest");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const change_case_1 = require("change-case");
|
|
10
|
+
const JSX = /\.(jsx|tsx|ts|js)$/i;
|
|
11
11
|
function createViewManifestGenerator(opts) {
|
|
12
12
|
return (0, manifest_1.createManifestGenerator)({
|
|
13
13
|
glob: path_1.default.join(opts.baseDirectory, "/views/**/*.tsx"),
|
|
14
14
|
onGenerate: opts.onGenerate,
|
|
15
15
|
watch: opts.watch,
|
|
16
|
-
generate
|
|
17
|
-
|
|
18
|
-
.filter(
|
|
19
|
-
.map(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return { relative
|
|
16
|
+
generate(fileNames) {
|
|
17
|
+
const files = fileNames
|
|
18
|
+
.filter((file) => !file.includes("/_app"))
|
|
19
|
+
.map((file) => {
|
|
20
|
+
const relative = path_1.default.relative(opts.baseDirectory, file).replace(JSX, "");
|
|
21
|
+
const name = path_1.default.basename(file).replace(JSX, "");
|
|
22
|
+
const module = JSON.stringify("./" + relative);
|
|
23
|
+
const componentName = "View" + (0, change_case_1.pascalCase)(name);
|
|
24
|
+
return { relative, name, module, componentName };
|
|
25
25
|
});
|
|
26
|
-
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
const useDynamicViews = false; //opts.isServerless
|
|
27
|
+
return `
|
|
28
|
+
${useDynamicViews && `import { dynamic } from 'eddev/dynamic';`}
|
|
29
|
+
import App from ${JSON.stringify("./views/_app")}
|
|
30
|
+
|
|
31
|
+
${!useDynamicViews
|
|
32
|
+
? files.map(({ componentName, module }) => `import ${componentName} from ${module}`).join("\n")
|
|
33
|
+
: ""}
|
|
34
|
+
|
|
35
|
+
export { App }
|
|
36
|
+
|
|
37
|
+
export default {
|
|
38
|
+
${files
|
|
39
|
+
.map(({ relative, componentName, module }) => {
|
|
35
40
|
if (useDynamicViews) {
|
|
36
41
|
// In serverless mode, export @loadable components. Script tags will be
|
|
37
42
|
// auto-included in output HTML
|
|
38
|
-
return "
|
|
43
|
+
return `"${relative}": dynamic(() => import(${module}))`;
|
|
39
44
|
}
|
|
40
45
|
else {
|
|
41
46
|
// On non-serverless, the templates are bundled straight into the main app.
|
|
42
|
-
return "
|
|
47
|
+
return `"${relative}": ${componentName}`;
|
|
43
48
|
}
|
|
44
49
|
})
|
|
45
|
-
.join(",\n")
|
|
50
|
+
.join(",\n")}
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
46
53
|
},
|
|
47
54
|
});
|
|
48
55
|
}
|
|
@@ -4,37 +4,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createWidgetManifestGenerator = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const manifest_1 = require("./manifest");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const change_case_1 = require("change-case");
|
|
10
10
|
function createWidgetManifestGenerator(opts) {
|
|
11
11
|
return (0, manifest_1.createManifestGenerator)({
|
|
12
12
|
glob: path_1.default.join(opts.baseDirectory, "/backend/widgets/*.tsx"),
|
|
13
13
|
onGenerate: opts.onGenerate,
|
|
14
14
|
watch: opts.watch,
|
|
15
|
-
generate
|
|
15
|
+
generate(fileNames) {
|
|
16
16
|
if (opts.isAdmin) {
|
|
17
|
-
|
|
18
|
-
.filter(
|
|
19
|
-
.map(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return { relative
|
|
17
|
+
const files = fileNames
|
|
18
|
+
.filter((file) => !file.includes("/_app"))
|
|
19
|
+
.map((file) => {
|
|
20
|
+
const relative = path_1.default.relative(opts.baseDirectory, file);
|
|
21
|
+
const name = path_1.default.basename(file).replace(/\.(jsx|tsx|ts|js)$/i, "");
|
|
22
|
+
const module = JSON.stringify("./" + relative);
|
|
23
|
+
const componentName = "Widget" + (0, change_case_1.pascalCase)(name);
|
|
24
|
+
return { relative, name, module, componentName };
|
|
25
25
|
});
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
return `
|
|
27
|
+
${files.map(({ componentName, module }) => `import ${componentName} from ${module}`).join("\n")}
|
|
28
|
+
|
|
29
|
+
export default [
|
|
30
|
+
${files
|
|
31
|
+
.map(({ relative, componentName, module, name }) => {
|
|
32
32
|
return componentName;
|
|
33
33
|
})
|
|
34
|
-
.join(",\n")
|
|
34
|
+
.join(",\n")}
|
|
35
|
+
]
|
|
36
|
+
`;
|
|
35
37
|
}
|
|
36
38
|
else {
|
|
37
|
-
return
|
|
39
|
+
return `export default {}`;
|
|
38
40
|
}
|
|
39
41
|
},
|
|
40
42
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
type Options = {
|
|
2
2
|
glob: string;
|
|
3
3
|
watch: boolean;
|
|
4
4
|
generate: (files: string[]) => Promise<string> | string;
|
|
5
5
|
onGenerate: (value: string) => void;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type ManifestGenerator = {
|
|
8
8
|
close(): void;
|
|
9
9
|
};
|
|
10
10
|
export declare function createManifestGenerator(opts: Options): Promise<ManifestGenerator>;
|
|
@@ -1,96 +1,36 @@
|
|
|
1
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 (_) 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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.createManifestGenerator = void 0;
|
|
40
|
-
|
|
41
|
-
function createManifestGenerator(opts) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
resolve(self);
|
|
71
|
-
}
|
|
72
|
-
return [2 /*return*/];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}); };
|
|
76
|
-
if (!opts.watch) return [3 /*break*/, 2];
|
|
77
|
-
return [4 /*yield*/, (0, file_tree_1.watchFileTree)(opts.glob, function (updatedFiles) {
|
|
78
|
-
files = updatedFiles;
|
|
79
|
-
update();
|
|
80
|
-
})];
|
|
81
|
-
case 1:
|
|
82
|
-
close = _a.sent();
|
|
83
|
-
return [3 /*break*/, 4];
|
|
84
|
-
case 2: return [4 /*yield*/, (0, file_tree_1.getFileTree)(opts.glob)];
|
|
85
|
-
case 3:
|
|
86
|
-
files = _a.sent();
|
|
87
|
-
update();
|
|
88
|
-
_a.label = 4;
|
|
89
|
-
case 4: return [2 /*return*/];
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}); })];
|
|
93
|
-
});
|
|
4
|
+
const file_tree_1 = require("../file-tree");
|
|
5
|
+
async function createManifestGenerator(opts) {
|
|
6
|
+
let resolvedFirst = false;
|
|
7
|
+
return new Promise(async (resolve) => {
|
|
8
|
+
let close;
|
|
9
|
+
const self = {
|
|
10
|
+
close: () => {
|
|
11
|
+
if (close)
|
|
12
|
+
close();
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
let files = [];
|
|
16
|
+
const update = async () => {
|
|
17
|
+
const value = await opts.generate(files);
|
|
18
|
+
opts.onGenerate(value);
|
|
19
|
+
if (!resolvedFirst) {
|
|
20
|
+
resolvedFirst = true;
|
|
21
|
+
resolve(self);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
if (opts.watch) {
|
|
25
|
+
close = await (0, file_tree_1.watchFileTree)(opts.glob, (updatedFiles) => {
|
|
26
|
+
files = updatedFiles;
|
|
27
|
+
update();
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
files = await (0, file_tree_1.getFileTree)(opts.glob);
|
|
32
|
+
update();
|
|
33
|
+
}
|
|
94
34
|
});
|
|
95
35
|
}
|
|
96
36
|
exports.createManifestGenerator = createManifestGenerator;
|
package/build/reporter.d.ts
CHANGED
package/build/reporter.js
CHANGED
|
@@ -4,16 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ReporterPlugin = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
class ReporterPlugin {
|
|
9
|
+
constructor(opts) {
|
|
10
10
|
this.title = opts.title;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var label = " ".concat(type.toUpperCase(), " (").concat(_this.title, ") ");
|
|
12
|
+
apply(compiler) {
|
|
13
|
+
const plugin = { name: "EDDevReporterPlugin" };
|
|
14
|
+
const log = (type, message, errors) => {
|
|
15
|
+
let label = ` ${type.toUpperCase()} (${this.title}) `;
|
|
17
16
|
if (type === "done") {
|
|
18
17
|
label = chalk_1.default.bgGreenBright.black(label);
|
|
19
18
|
}
|
|
@@ -31,10 +30,10 @@ var ReporterPlugin = /** @class */ (function () {
|
|
|
31
30
|
console.log(errors);
|
|
32
31
|
}
|
|
33
32
|
};
|
|
34
|
-
compiler.hooks.done.tap(plugin,
|
|
33
|
+
compiler.hooks.done.tap(plugin, (stats) => {
|
|
35
34
|
// console.log(this.title + ": Done")
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const hasErrors = stats.hasErrors();
|
|
36
|
+
const hasWarnings = stats.hasWarnings();
|
|
38
37
|
// const status: StatusItem = {
|
|
39
38
|
// statusType: "success",
|
|
40
39
|
// message: "",
|
|
@@ -45,44 +44,42 @@ var ReporterPlugin = /** @class */ (function () {
|
|
|
45
44
|
return;
|
|
46
45
|
}
|
|
47
46
|
if (hasErrors) {
|
|
48
|
-
|
|
49
|
-
.map(
|
|
47
|
+
const errors = extractErrorsFromStats(stats, "errors")
|
|
48
|
+
.map((err) => err.message)
|
|
50
49
|
.join("\n");
|
|
51
50
|
log("error", "Error compiling", errors);
|
|
52
51
|
return;
|
|
53
52
|
}
|
|
54
53
|
if (hasWarnings) {
|
|
55
|
-
|
|
56
|
-
.map(
|
|
54
|
+
const warnings = extractErrorsFromStats(stats, "warnings")
|
|
55
|
+
.map((err) => err.message)
|
|
57
56
|
.join("\n");
|
|
58
57
|
log("warn", "Warnings encountered", warnings);
|
|
59
58
|
// log.warn("Warnings encountered %s", warnings)
|
|
60
59
|
// this.displayErrors(extractErrorsFromStats(stats, "warnings"), "warning")
|
|
61
60
|
}
|
|
62
61
|
});
|
|
63
|
-
compiler.hooks.invalid.tap(plugin,
|
|
62
|
+
compiler.hooks.invalid.tap(plugin, () => {
|
|
64
63
|
log("wait", "Building...");
|
|
65
64
|
});
|
|
66
|
-
}
|
|
67
|
-
|
|
65
|
+
}
|
|
66
|
+
displaySuccess(stats) {
|
|
68
67
|
console.log("SUCCESS", this.title);
|
|
69
|
-
}
|
|
70
|
-
|
|
68
|
+
}
|
|
69
|
+
displayErrors(errors, type) {
|
|
71
70
|
console.log(type, this.title, errors);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
}());
|
|
71
|
+
}
|
|
72
|
+
}
|
|
75
73
|
exports.ReporterPlugin = ReporterPlugin;
|
|
76
74
|
function extractErrorsFromStats(stats, type) {
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
const findErrorsRecursive = (compilation) => {
|
|
76
|
+
const errors = compilation[type];
|
|
79
77
|
if (errors.length === 0 && compilation.children) {
|
|
80
|
-
for (
|
|
81
|
-
|
|
82
|
-
errors.push.apply(errors, findErrorsRecursive(child));
|
|
78
|
+
for (const child of compilation.children) {
|
|
79
|
+
errors.push(...findErrorsRecursive(child));
|
|
83
80
|
}
|
|
84
81
|
}
|
|
85
|
-
return uniqueBy(errors,
|
|
82
|
+
return uniqueBy(errors, (error) => error.message);
|
|
86
83
|
};
|
|
87
84
|
return findErrorsRecursive(stats.compilation);
|
|
88
85
|
}
|
|
@@ -94,9 +91,9 @@ function extractErrorsFromStats(stats, type) {
|
|
|
94
91
|
* ) = [{ id: 1 }, { id: 2 }]
|
|
95
92
|
*/
|
|
96
93
|
function uniqueBy(arr, fun) {
|
|
97
|
-
|
|
98
|
-
return arr.filter(
|
|
99
|
-
|
|
94
|
+
const seen = {};
|
|
95
|
+
return arr.filter((el) => {
|
|
96
|
+
const e = fun(el);
|
|
100
97
|
return !(e in seen) && (seen[e] = 1);
|
|
101
98
|
});
|
|
102
99
|
}
|