eddev 0.1.25-beta-02 → 0.1.28
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/blocks/inlineEditing.js +1 -0
- package/blocks/installGutenbergHooks.js +1 -0
- package/build/codegen-worker-script.js +19 -39
- package/build/create-codegen-worker.d.ts +1 -1
- package/build/create-codegen-worker.js +1 -1
- package/build/create-webpack-worker.js +2 -2
- package/build/get-webpack-config.js +28 -50
- package/build/graphql-codegen/graphql-codegen-files.js +3 -3
- package/build/graphql-codegen/graphql-codegen-no-duplicates.js +1 -1
- package/{utils/graphql-codegen/graphql-codegen-files.d.ts → build/graphql-codegen/graphql-codegen-queries.d.ts} +0 -0
- package/build/graphql-codegen/graphql-codegen-queries.js +248 -0
- package/build/reporter.js +1 -1
- package/build/workers/codegen-worker-script.d.ts +5 -0
- package/build/workers/codegen-worker-script.js +543 -0
- package/build/workers/webpack-worker-script.d.ts +2 -0
- package/build/workers/webpack-worker-script.js +160 -0
- package/cli/cli.js +3 -28
- package/cli/display/components/BundleDisplay.js +1 -1
- package/cli/display/components/CodegenDisplay.js +2 -2
- package/cli/generate.js +1 -15
- package/components/BrowserRouter.js +4 -2
- package/components/routing.d.ts +1 -1
- package/components/routing.js +4 -5
- package/hooks/queryUtils.d.ts +54 -0
- package/hooks/queryUtils.js +226 -0
- package/hooks/useAppData.js +0 -1
- package/{utils/graphql-codegen/graphql-codegen-no-duplicates.d.ts → hooks/useQuery.d.ts} +0 -0
- package/hooks/useQuery.js +10 -0
- package/package.json +6 -9
- package/style/createStitches.d.ts +2 -0
- package/style/createStitches.js +10 -12
- package/style/index.d.ts +0 -1
- package/style/index.js +0 -1
- package/utils/promptIfRepoNameIncorrect.js +1 -1
- package/utils/remoteProps.d.ts +2 -2
- package/build/dev/codegen-state.d.ts +0 -6
- package/build/dev/codegen-state.js +0 -2
- package/build/dev/compiler-state.d.ts +0 -11
- package/build/dev/compiler-state.js +0 -2
- package/build/getWebpackConfig.d.ts +0 -11
- package/build/getWebpackConfig.js +0 -428
- package/cli/build.dev2.d.ts +0 -5
- package/cli/build.dev2.js +0 -88
- package/cli/dev/codegen-state.d.ts +0 -6
- package/cli/dev/codegen-state.js +0 -2
- package/cli/dev/compiler-state.d.ts +0 -11
- package/cli/dev/compiler-state.js +0 -2
- package/cli/dev/dev-command.d.ts +0 -5
- package/cli/dev/dev-command.js +0 -56
- package/cli/dev/webpack-worker.d.ts +0 -1
- package/cli/dev/webpack-worker.js +0 -5
- package/cli/dev/worker.d.ts +0 -0
- package/cli/dev/worker.js +0 -2
- package/cli/display/components/SyntaxErrorBox.d.ts +0 -0
- package/cli/display/components/SyntaxErrorBox.js +0 -1
- package/cli/lib/create-webpack-worker.d.ts +0 -0
- package/cli/lib/create-webpack-worker.js +0 -1
- package/cli/lib/webpack-worker-script.d.ts +0 -1
- package/cli/lib/webpack-worker-script.js +0 -5
- package/cli/lib/webpack-worker.d.ts +0 -1
- package/cli/lib/webpack-worker.js +0 -5
- package/hooks/createUseQuery.d.ts +0 -1
- package/hooks/createUseQuery.js +0 -8
- package/style/themeDefinition.d.ts +0 -22
- package/style/themeDefinition.js +0 -2
- package/utils/cxBabelPlugin.d.ts +0 -0
- package/utils/cxBabelPlugin.js +0 -21
- package/utils/generateSchemaTypes.d.ts +0 -6
- package/utils/generateSchemaTypes.js +0 -169
- package/utils/graphql-codegen/graphql-codegen-blocks.d.ts +0 -1
- package/utils/graphql-codegen/graphql-codegen-blocks.js +0 -8
- package/utils/graphql-codegen/graphql-codegen-files.js +0 -64
- package/utils/graphql-codegen/graphql-codegen-no-duplicates.js +0 -13
- package/utils/jsx/jsx-runtime.d.ts +0 -2
- package/utils/jsx/jsx-runtime.js +0 -27
package/blocks/inlineEditing.js
CHANGED
|
@@ -43,6 +43,7 @@ function EditableText(_a) {
|
|
|
43
43
|
delete otherProps.disableLineBreaks;
|
|
44
44
|
delete otherProps.id;
|
|
45
45
|
delete otherProps.as;
|
|
46
|
+
delete otherProps.placeholder;
|
|
46
47
|
if (value === "" || typeof value !== "string") {
|
|
47
48
|
if (props.defaultValue) {
|
|
48
49
|
value = props.defaultValue;
|
|
@@ -25,6 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.installEDGutenbergHooks = void 0;
|
|
27
27
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
// @ts-ignore
|
|
28
29
|
var hooks_1 = require("@wordpress/hooks");
|
|
29
30
|
var react_1 = require("react");
|
|
30
31
|
// @ts-ignore
|
|
@@ -95,6 +95,7 @@ var typescriptPlugin = __importStar(require("@graphql-codegen/typescript"));
|
|
|
95
95
|
var typescriptOperationsPlugin = __importStar(require("@graphql-codegen/typescript-operations"));
|
|
96
96
|
var CodegenNoDuplicates = __importStar(require("./graphql-codegen/graphql-codegen-no-duplicates"));
|
|
97
97
|
var CodegenFiles = __importStar(require("./graphql-codegen/graphql-codegen-files"));
|
|
98
|
+
var CodegenQueries = __importStar(require("./graphql-codegen/graphql-codegen-queries"));
|
|
98
99
|
var sendSignal = function (sig) {
|
|
99
100
|
if (worker_threads_1.parentPort) {
|
|
100
101
|
worker_threads_1.parentPort.postMessage(sig);
|
|
@@ -229,7 +230,7 @@ function beginWork(opts) {
|
|
|
229
230
|
return [3 /*break*/, 3];
|
|
230
231
|
case 2:
|
|
231
232
|
err_3 = _a.sent();
|
|
232
|
-
parseErrors.push("Error parsing \""
|
|
233
|
+
parseErrors.push("Error parsing \"".concat(file.replace(opts.baseDirectory, ""), ":\n").concat(err_3));
|
|
233
234
|
return [3 /*break*/, 3];
|
|
234
235
|
case 3: return [2 /*return*/];
|
|
235
236
|
}
|
|
@@ -331,15 +332,15 @@ function beginWork(opts) {
|
|
|
331
332
|
var item = _d[_i];
|
|
332
333
|
if (item.name.value === "block") {
|
|
333
334
|
var blockField = (_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.selectionSet) === null || _a === void 0 ? void 0 : _a.selections[0]) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.value;
|
|
334
|
-
blockSelection = "Exclude<"
|
|
335
|
+
blockSelection = "Exclude<".concat(importedName, "[\"block\"][").concat(JSON.stringify(blockField), "], null>");
|
|
335
336
|
}
|
|
336
337
|
else {
|
|
337
|
-
queryKeyVals.push([JSON.stringify(item.name.value), importedName
|
|
338
|
+
queryKeyVals.push([JSON.stringify(item.name.value), "".concat(importedName, "[").concat(JSON.stringify(item.name.value), "]")].join(": "));
|
|
338
339
|
}
|
|
339
340
|
}
|
|
340
341
|
var type = [];
|
|
341
342
|
if (queryKeyVals.length)
|
|
342
|
-
type.push("{"
|
|
343
|
+
type.push("{".concat(queryKeyVals.join(",\n"), "}"));
|
|
343
344
|
if (blockSelection)
|
|
344
345
|
type.push(blockSelection);
|
|
345
346
|
if (type.length === 0)
|
|
@@ -348,41 +349,20 @@ function beginWork(opts) {
|
|
|
348
349
|
},
|
|
349
350
|
},
|
|
350
351
|
},
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
// getType: (importedName: string, def: any) => {
|
|
366
|
-
// const queryKeyVals: any[] = []
|
|
367
|
-
// let blockSelection = ""
|
|
368
|
-
// for (const item of def.selectionSet.selections) {
|
|
369
|
-
// if (item.name.value === "block") {
|
|
370
|
-
// const blockField = item?.selectionSet?.selections[0]?.name?.value
|
|
371
|
-
// blockSelection = `Exclude<${importedName}["block"][${JSON.stringify(blockField)}], null>`
|
|
372
|
-
// } else {
|
|
373
|
-
// queryKeyVals.push(
|
|
374
|
-
// [JSON.stringify(item.name.value), `${importedName}[${JSON.stringify(item.name.value)}]`].join(": ")
|
|
375
|
-
// )
|
|
376
|
-
// }
|
|
377
|
-
// }
|
|
378
|
-
// const type: string[] = []
|
|
379
|
-
// if (queryKeyVals.length) type.push(`{${queryKeyVals.join(",\n")}}`)
|
|
380
|
-
// if (blockSelection) type.push(blockSelection)
|
|
381
|
-
// if (type.length === 0) return {}
|
|
382
|
-
// return type.join(" & ")
|
|
383
|
-
// },
|
|
384
|
-
// },
|
|
385
|
-
// },
|
|
352
|
+
"hooks/queries.ts": {
|
|
353
|
+
documents: __spreadArray([], documentSets.queries, true),
|
|
354
|
+
plugins: [
|
|
355
|
+
{
|
|
356
|
+
queries: {},
|
|
357
|
+
},
|
|
358
|
+
],
|
|
359
|
+
pluginMap: {
|
|
360
|
+
queries: CodegenQueries,
|
|
361
|
+
},
|
|
362
|
+
config: {
|
|
363
|
+
rootDir: opts.baseDirectory,
|
|
364
|
+
},
|
|
365
|
+
},
|
|
386
366
|
};
|
|
387
367
|
// Notify of generation start
|
|
388
368
|
sendSignal({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Observable } from "../cli/display/lib/Observable";
|
|
2
|
-
import { CodegenOptions } from "./codegen-worker-script";
|
|
2
|
+
import { CodegenOptions } from "./workers/codegen-worker-script";
|
|
3
3
|
import { CodegenState } from "./state/codegen-state";
|
|
4
4
|
export declare function createCodegenWorker(opts: CodegenOptions): Observable<CodegenState>;
|
|
@@ -16,7 +16,7 @@ var worker_threads_1 = require("worker_threads");
|
|
|
16
16
|
var path_1 = require("path");
|
|
17
17
|
var Observable_1 = require("../cli/display/lib/Observable");
|
|
18
18
|
function createCodegenWorker(opts) {
|
|
19
|
-
var worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "codegen-worker-script.js"), {
|
|
19
|
+
var worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "workers/codegen-worker-script.js"), {
|
|
20
20
|
workerData: opts,
|
|
21
21
|
stderr: true,
|
|
22
22
|
stdin: false,
|
|
@@ -16,7 +16,7 @@ var worker_threads_1 = require("worker_threads");
|
|
|
16
16
|
var path_1 = require("path");
|
|
17
17
|
var Observable_1 = require("../cli/display/lib/Observable");
|
|
18
18
|
function createWebpackWorker(opts) {
|
|
19
|
-
var worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "webpack-worker-script.js"), {
|
|
19
|
+
var worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "workers/webpack-worker-script.js"), {
|
|
20
20
|
workerData: opts,
|
|
21
21
|
stderr: true,
|
|
22
22
|
stdin: false,
|
|
@@ -48,7 +48,7 @@ function createWebpackWorker(opts) {
|
|
|
48
48
|
}
|
|
49
49
|
else if (data.code === "invalidated") {
|
|
50
50
|
subject.update(function (state) { return (__assign(__assign({}, state), { status: "compiling", statusLabel: data.changedFile
|
|
51
|
-
? "Rebuilding ("
|
|
51
|
+
? "Rebuilding (".concat(data.changedFile.replace(opts.baseDirectory, ""), ")")
|
|
52
52
|
: "Rebuilding (changes detected)", log: "", duration: 0, errors: [] })); });
|
|
53
53
|
}
|
|
54
54
|
});
|
|
@@ -95,32 +95,24 @@ function getWebpackConfig(opts) {
|
|
|
95
95
|
entryDir = path_1.default.resolve(path_1.default.dirname(__dirname), "./entry");
|
|
96
96
|
if (isDev) {
|
|
97
97
|
if (opts.isAdmin) {
|
|
98
|
-
ENTRY["main"] = [
|
|
99
|
-
// "webpack-plugin-serve/client",
|
|
100
|
-
entryDir + "/entry.publicPath.js",
|
|
101
|
-
entryDir + "/entry.admin.dev.js",
|
|
102
|
-
];
|
|
98
|
+
ENTRY["main"] = ["".concat(entryDir, "/entry.publicPath.js"), "".concat(entryDir, "/entry.admin.dev.js")];
|
|
103
99
|
}
|
|
104
100
|
else if (isServerless) {
|
|
105
|
-
ENTRY["main"] = [entryDir
|
|
101
|
+
ENTRY["main"] = ["".concat(entryDir, "/entry.serverless.dev.js")];
|
|
106
102
|
}
|
|
107
103
|
else {
|
|
108
|
-
ENTRY["main"] = [
|
|
109
|
-
// "webpack-plugin-serve/client",
|
|
110
|
-
entryDir + "/entry.publicPath.js",
|
|
111
|
-
entryDir + "/entry.monolith.dev.js",
|
|
112
|
-
];
|
|
104
|
+
ENTRY["main"] = ["".concat(entryDir, "/entry.publicPath.js"), "".concat(entryDir, "/entry.monolith.dev.js")];
|
|
113
105
|
}
|
|
114
106
|
}
|
|
115
107
|
else {
|
|
116
108
|
if (opts.isAdmin) {
|
|
117
|
-
ENTRY["main"] = [entryDir
|
|
109
|
+
ENTRY["main"] = ["".concat(entryDir, "/entry.publicPath.js"), "".concat(entryDir, "/entry.admin.prod.js")];
|
|
118
110
|
}
|
|
119
111
|
else if (isServerless) {
|
|
120
|
-
ENTRY["main"] = [entryDir
|
|
112
|
+
ENTRY["main"] = ["".concat(entryDir, "/entry.serverless.prod.js")];
|
|
121
113
|
}
|
|
122
114
|
else {
|
|
123
|
-
ENTRY["main"] = [entryDir
|
|
115
|
+
ENTRY["main"] = ["".concat(entryDir, "/entry.publicPath.js"), "".concat(entryDir, "/entry.monolith.prod.js")];
|
|
124
116
|
}
|
|
125
117
|
}
|
|
126
118
|
distSuffix = opts.isAdmin ? "admin" : "frontend";
|
|
@@ -131,6 +123,7 @@ function getWebpackConfig(opts) {
|
|
|
131
123
|
ALIAS["@components"] = path_1.default.join(opts.baseDirectory, "components");
|
|
132
124
|
ALIAS["@views"] = path_1.default.join(opts.baseDirectory, "views");
|
|
133
125
|
ALIAS["@hooks"] = path_1.default.join(opts.baseDirectory, "hooks");
|
|
126
|
+
ALIAS["@queries"] = path_1.default.join(opts.baseDirectory, "hooks/queries");
|
|
134
127
|
RULES.push({
|
|
135
128
|
test: /\.[jt]sx?$/,
|
|
136
129
|
exclude: /node_modules/,
|
|
@@ -152,13 +145,11 @@ function getWebpackConfig(opts) {
|
|
|
152
145
|
require.resolve("@babel/preset-react"),
|
|
153
146
|
{
|
|
154
147
|
runtime: "automatic",
|
|
155
|
-
// importSource: Path.resolve(__dirname, "../utils/jsx"),
|
|
156
148
|
},
|
|
157
149
|
],
|
|
158
150
|
require.resolve("@babel/preset-typescript"),
|
|
159
151
|
],
|
|
160
152
|
plugins: [
|
|
161
|
-
// Path.resolve(__dirname, "../utils/cxBabelPlugin.js"),
|
|
162
153
|
isBrowser && isDev && [require.resolve("react-refresh/babel"), { skipEnvCheck: true }],
|
|
163
154
|
require.resolve("@loadable/babel-plugin"),
|
|
164
155
|
].filter(Boolean),
|
|
@@ -176,7 +167,7 @@ function getWebpackConfig(opts) {
|
|
|
176
167
|
{
|
|
177
168
|
loader: mini_css_extract_plugin_1.default.loader,
|
|
178
169
|
options: {
|
|
179
|
-
publicPath: "/wp-content/themes/"
|
|
170
|
+
publicPath: "/wp-content/themes/".concat(opts.themeName, "/dist/").concat(distSuffix),
|
|
180
171
|
},
|
|
181
172
|
},
|
|
182
173
|
{
|
|
@@ -198,21 +189,6 @@ function getWebpackConfig(opts) {
|
|
|
198
189
|
},
|
|
199
190
|
},
|
|
200
191
|
},
|
|
201
|
-
// {
|
|
202
|
-
// loader: require.resolve("sass-loader"),
|
|
203
|
-
// options: {
|
|
204
|
-
// sourceMap: true,
|
|
205
|
-
// implementation: require("sass"),
|
|
206
|
-
// // prependData: (loaderContext: any) => {
|
|
207
|
-
// // const entryName = path
|
|
208
|
-
// // .basename(loaderContext.resourcePath)
|
|
209
|
-
// // .replace(/\.scss$/i, "")
|
|
210
|
-
// // return `
|
|
211
|
-
// // $bundle: ${JSON.stringify(entryName || "")};
|
|
212
|
-
// // $env: "${process.env.NODE_ENV}";
|
|
213
|
-
// // `
|
|
214
|
-
// },
|
|
215
|
-
// },
|
|
216
192
|
],
|
|
217
193
|
});
|
|
218
194
|
// Define some values
|
|
@@ -221,9 +197,10 @@ function getWebpackConfig(opts) {
|
|
|
221
197
|
DEFINES["process.LOADABLE_STATS_FILE"] = JSON.stringify(loadableManifestFile);
|
|
222
198
|
DEFINES["process.dev"] = isDev ? "true" : "false";
|
|
223
199
|
DEFINES["process.admin"] = opts.isAdmin ? "true" : "false";
|
|
224
|
-
DEFINES["process.env.themePath"] = JSON.stringify("/wp-content/themes/"
|
|
200
|
+
DEFINES["process.env.themePath"] = JSON.stringify("/wp-content/themes/".concat(opts.themeName));
|
|
201
|
+
DEFINES["process.themePath"] = JSON.stringify("/wp-content/themes/".concat(opts.themeName));
|
|
225
202
|
if (isBrowser) {
|
|
226
|
-
DEFINES["process.env.themePath"] = "window.THEME_PATH || "
|
|
203
|
+
DEFINES["process.env.themePath"] = "window.THEME_PATH || ".concat(DEFINES["process.env.themePath"]);
|
|
227
204
|
}
|
|
228
205
|
// Bundle analyser
|
|
229
206
|
if (!opts.isAdmin && !isDev) {
|
|
@@ -283,25 +260,25 @@ function getWebpackConfig(opts) {
|
|
|
283
260
|
var componentName = (0, change_case_1.pascalCase)(name);
|
|
284
261
|
return { relative: relative, name: name, module: module, componentName: componentName };
|
|
285
262
|
});
|
|
286
|
-
writeVirtualModule(ALIAS["@manifest/views"], "\n "
|
|
263
|
+
writeVirtualModule(ALIAS["@manifest/views"], "\n ".concat(!isServerless && "import loadable from '".concat(require.resolve("@loadable/component"), "';"), "\n import App from ").concat(JSON.stringify("./views/_app.tsx"), "\n\n ").concat(isServerless
|
|
287
264
|
? files.map(function (_a) {
|
|
288
265
|
var componentName = _a.componentName, module = _a.module;
|
|
289
|
-
return "import "
|
|
266
|
+
return "import ".concat(componentName, " from ").concat(module);
|
|
290
267
|
}).join("\n")
|
|
291
|
-
: ""
|
|
268
|
+
: "", "\n\n export { App }\n\n export default {\n ").concat(files
|
|
292
269
|
.map(function (_a) {
|
|
293
270
|
var relative = _a.relative, componentName = _a.componentName, module = _a.module;
|
|
294
271
|
if (!isServerless) {
|
|
295
272
|
// In serverless mode, export @loadable components. Script tags will be
|
|
296
273
|
// auto-included in output HTML
|
|
297
|
-
return "\""
|
|
274
|
+
return "\"".concat(relative, "\": loadable(() => import(").concat(module, "))");
|
|
298
275
|
}
|
|
299
276
|
else {
|
|
300
277
|
// On non-serverless, the templates are bundled straight into the main app.
|
|
301
|
-
return "\""
|
|
278
|
+
return "\"".concat(relative, "\": ").concat(componentName);
|
|
302
279
|
}
|
|
303
280
|
})
|
|
304
|
-
.join(",\n")
|
|
281
|
+
.join(",\n"), "\n }\n "));
|
|
305
282
|
};
|
|
306
283
|
templateLookupPattern = path_1.default.resolve(opts.baseDirectory, "views/**/*.tsx");
|
|
307
284
|
if (!opts.isAdmin) return [3 /*break*/, 1];
|
|
@@ -332,31 +309,31 @@ function getWebpackConfig(opts) {
|
|
|
332
309
|
return { relative: relative, name: name, module: module, componentName: componentName };
|
|
333
310
|
});
|
|
334
311
|
if (opts.isAdmin) {
|
|
335
|
-
writeVirtualModule(ALIAS["@manifest/blocks"], "\n import coreBlocks from './blocks/_core.tsx'\n "
|
|
312
|
+
writeVirtualModule(ALIAS["@manifest/blocks"], "\n import coreBlocks from './blocks/_core.tsx'\n ".concat(!isServerless && "import loadable from '".concat(require.resolve("@loadable/component"), "';"), "\n\n export default {\n ...coreBlocks,\n ").concat(files
|
|
336
313
|
.map(function (_a) {
|
|
337
314
|
var relative = _a.relative, componentName = _a.componentName, module = _a.module;
|
|
338
315
|
var parts = relative.replace(/\.tsx$/, "").split("/");
|
|
339
316
|
var blockName = "acf/" + parts.slice(1).join("-");
|
|
340
|
-
return "\""
|
|
317
|
+
return "\"".concat(blockName, "\": loadable(() => import(").concat(module, "))");
|
|
341
318
|
})
|
|
342
|
-
.join(",\n")
|
|
319
|
+
.join(",\n"), "\n }\n "));
|
|
343
320
|
}
|
|
344
321
|
else {
|
|
345
|
-
writeVirtualModule(ALIAS["@manifest/blocks"], "\n import coreBlocks from './blocks/_core.tsx'\n\n "
|
|
322
|
+
writeVirtualModule(ALIAS["@manifest/blocks"], "\n import coreBlocks from './blocks/_core.tsx'\n\n ".concat(files
|
|
346
323
|
.map(function (_a) {
|
|
347
324
|
var relative = _a.relative, componentName = _a.componentName, module = _a.module;
|
|
348
325
|
var parts = relative.replace(/\.tsx$/, "").split("/");
|
|
349
326
|
var blockName = "acf/" + parts.slice(1).join("-");
|
|
350
|
-
return "import "
|
|
327
|
+
return "import ".concat(componentName, " from ").concat(module);
|
|
351
328
|
})
|
|
352
|
-
.join("\n")
|
|
329
|
+
.join("\n"), "\n\n export default {\n ...coreBlocks,\n ").concat(files
|
|
353
330
|
.map(function (_a) {
|
|
354
331
|
var relative = _a.relative, componentName = _a.componentName, module = _a.module;
|
|
355
332
|
var parts = relative.replace(/\.tsx$/, "").split("/");
|
|
356
333
|
var blockName = "acf/" + parts.slice(1).join("-");
|
|
357
|
-
return "\""
|
|
334
|
+
return "\"".concat(blockName, "\": ").concat(componentName);
|
|
358
335
|
})
|
|
359
|
-
.join(",\n")
|
|
336
|
+
.join(",\n"), "\n }\n "));
|
|
360
337
|
}
|
|
361
338
|
};
|
|
362
339
|
blockLookupManifest = path_1.default.resolve(opts.baseDirectory, "blocks/**/*.tsx");
|
|
@@ -395,10 +372,11 @@ function getWebpackConfig(opts) {
|
|
|
395
372
|
// chunkIds: "named",
|
|
396
373
|
},
|
|
397
374
|
output: {
|
|
398
|
-
filename: "[name]."
|
|
399
|
-
publicPath: isDev ? "//127.0.0.1:"
|
|
375
|
+
filename: "[name].".concat(opts.isAdmin ? "admin" : "frontend", ".js"),
|
|
376
|
+
publicPath: isDev ? "//127.0.0.1:".concat(opts.hotPort, "/") : "/wp-content/themes/".concat(opts.themeName, "/dist/").concat(distSuffix, "/"),
|
|
400
377
|
path: outputFolder,
|
|
401
378
|
globalObject: isSSR ? "this" : "self",
|
|
379
|
+
clean: true,
|
|
402
380
|
},
|
|
403
381
|
externals: __assign({ worker_threads: true }, EXTERNALS),
|
|
404
382
|
resolve: {
|
|
@@ -45,20 +45,20 @@ module.exports = {
|
|
|
45
45
|
var typeName = ((_a = config.getType) === null || _a === void 0 ? void 0 : _a.call(config, importedName, doc.document.definitions[0])) || importedName;
|
|
46
46
|
imports.push(importedName);
|
|
47
47
|
var key = relative.replace(/\.graphql/, "");
|
|
48
|
-
items.push(JSON.stringify(key)
|
|
48
|
+
items.push("".concat(JSON.stringify(key), ": ").concat(typeForFile(key, typeName)));
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
52
52
|
var file = files_1[_i];
|
|
53
53
|
if (!filesFound[file.replace(/\.tsx/, "")]) {
|
|
54
54
|
var key = getRelative(file).replace(/\.tsx$/, "");
|
|
55
|
-
items.push(JSON.stringify(key)
|
|
55
|
+
items.push("".concat(JSON.stringify(key), ": ").concat(typeForFile(key, "")));
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
if (imports.length === 0) {
|
|
59
59
|
process.exit();
|
|
60
60
|
return "export { };";
|
|
61
61
|
}
|
|
62
|
-
return "import { "
|
|
62
|
+
return "import { ".concat(imports.sort().join(", "), " } from \"./types.graphql\"\nexport { };\n\ndeclare global {\n type ").concat(config.globalName, " = {\n").concat(items.sort().join(",\n"), "\n }\n}\n ");
|
|
63
63
|
},
|
|
64
64
|
};
|
|
@@ -5,7 +5,7 @@ module.exports = {
|
|
|
5
5
|
validate: function (schema, documents, config, info) {
|
|
6
6
|
documents.forEach(function (doc) {
|
|
7
7
|
if (doc.document.definitions.length === 0) {
|
|
8
|
-
throw new Error("GraphQL file '"
|
|
8
|
+
throw new Error("GraphQL file '".concat(doc.location, "' does not contain any uniquely named operations."));
|
|
9
9
|
process.exit();
|
|
10
10
|
}
|
|
11
11
|
});
|
|
File without changes
|