eddev 0.1.27 → 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/installGutenbergHooks.js +1 -0
- package/build/codegen-worker-script.js +4 -4
- 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 +26 -27
- package/build/graphql-codegen/graphql-codegen-files.js +3 -3
- package/build/graphql-codegen/graphql-codegen-no-duplicates.js +1 -1
- package/build/graphql-codegen/graphql-codegen-queries.js +17 -17
- 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/routing.d.ts +1 -1
- package/components/routing.js +4 -5
- package/hooks/queryUtils.js +2 -2
- package/package.json +5 -7
- package/style/createStitches.d.ts +5 -4
- package/style/createStitches.js +9 -9
- 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 -9
- package/hooks/createUseQuery.js +0 -12
- 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.d.ts +0 -1
- package/utils/graphql-codegen/graphql-codegen-files.js +0 -64
- package/utils/graphql-codegen/graphql-codegen-no-duplicates.d.ts +0 -1
- 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
|
@@ -1,428 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
-
if (ar || !(i in from)) {
|
|
52
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
-
ar[i] = from[i];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
-
};
|
|
58
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
|
-
};
|
|
61
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
var webpack_1 = require("webpack");
|
|
63
|
-
var path_1 = __importDefault(require("path"));
|
|
64
|
-
var react_refresh_webpack_plugin_1 = __importDefault(require("@pmmmwh/react-refresh-webpack-plugin"));
|
|
65
|
-
var webpack_virtual_modules_1 = __importDefault(require("webpack-virtual-modules"));
|
|
66
|
-
// @ts-ignore
|
|
67
|
-
var friendly_errors_webpack_plugin_1 = __importDefault(require("@soda/friendly-errors-webpack-plugin"));
|
|
68
|
-
// @ts-ignore
|
|
69
|
-
var webpack_plugin_1 = __importDefault(require("@loadable/webpack-plugin"));
|
|
70
|
-
var file_tree_1 = require("./file-tree");
|
|
71
|
-
var change_case_1 = require("change-case");
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
var webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
|
|
74
|
-
// @ts-ignore
|
|
75
|
-
var mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
|
|
76
|
-
var autoprefixer_1 = __importDefault(require("autoprefixer"));
|
|
77
|
-
function getWebpackConfig(opts) {
|
|
78
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
79
|
-
var compiling, ALIAS, ENTRY, PLUGINS, RULES, DEFINES, VIRTUAL_MODULES, EXTERNALS, virtualModules, isServerless, isBrowser, isSSR, isDev, entryDir, outputFolder, loadableManifestFile, writeVirtualModule, updateTemplateRouter, templateLookupPattern, _a, updateBlocksManifest, blockLookupManifest, _b;
|
|
80
|
-
return __generator(this, function (_c) {
|
|
81
|
-
switch (_c.label) {
|
|
82
|
-
case 0:
|
|
83
|
-
compiling = false;
|
|
84
|
-
ALIAS = {};
|
|
85
|
-
ENTRY = {};
|
|
86
|
-
PLUGINS = [];
|
|
87
|
-
RULES = [];
|
|
88
|
-
DEFINES = {};
|
|
89
|
-
VIRTUAL_MODULES = {};
|
|
90
|
-
EXTERNALS = {};
|
|
91
|
-
isServerless = opts.serverless;
|
|
92
|
-
isBrowser = opts.target === "client";
|
|
93
|
-
isSSR = isServerless && !isBrowser;
|
|
94
|
-
isDev = opts.mode === "development";
|
|
95
|
-
entryDir = path_1.default.resolve(path_1.default.dirname(__dirname), "./entry");
|
|
96
|
-
if (isDev) {
|
|
97
|
-
if (opts.isAdmin) {
|
|
98
|
-
ENTRY["main"] = [entryDir + "/entry.publicPath.js", entryDir + "/entry.admin.dev.js"];
|
|
99
|
-
}
|
|
100
|
-
else if (isServerless) {
|
|
101
|
-
ENTRY["main"] = [entryDir + "/entry.serverless.dev.js"];
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
ENTRY["main"] = [entryDir + "/entry.publicPath.js", entryDir + "/entry.monolith.dev.js"];
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
if (opts.isAdmin) {
|
|
109
|
-
ENTRY["main"] = [entryDir + "/entry.publicPath.js", entryDir + "/entry.admin.prod.js"];
|
|
110
|
-
}
|
|
111
|
-
else if (isServerless) {
|
|
112
|
-
ENTRY["main"] = [entryDir + "/entry.serverless.prod.js"];
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
ENTRY["main"] = [entryDir + "/entry.publicPath.js", entryDir + "/entry.monolith.prod.js"];
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
outputFolder = path_1.default.resolve(opts.baseDirectory, isServerless ? (isDev ? "./.edwp/dev" : "./.edwp/prod") : "./dist");
|
|
119
|
-
loadableManifestFile = "loadable-stats.json";
|
|
120
|
-
// JS/TS
|
|
121
|
-
ALIAS["@blocks"] = path_1.default.join(opts.baseDirectory, "blocks");
|
|
122
|
-
ALIAS["@components"] = path_1.default.join(opts.baseDirectory, "components");
|
|
123
|
-
ALIAS["@views"] = path_1.default.join(opts.baseDirectory, "views");
|
|
124
|
-
ALIAS["@hooks"] = path_1.default.join(opts.baseDirectory, "hooks");
|
|
125
|
-
RULES.push({
|
|
126
|
-
test: /\.[jt]sx?$/,
|
|
127
|
-
exclude: /node_modules/,
|
|
128
|
-
use: [
|
|
129
|
-
{
|
|
130
|
-
loader: require.resolve("babel-loader"),
|
|
131
|
-
options: {
|
|
132
|
-
presets: [
|
|
133
|
-
[
|
|
134
|
-
require.resolve("@babel/preset-env"),
|
|
135
|
-
{
|
|
136
|
-
useBuiltIns: "entry",
|
|
137
|
-
exclude: ["@babel/plugin-transform-regenerator"],
|
|
138
|
-
targets: "> 0.25%, not dead",
|
|
139
|
-
corejs: 3,
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
[
|
|
143
|
-
require.resolve("@babel/preset-react"),
|
|
144
|
-
{
|
|
145
|
-
runtime: "automatic",
|
|
146
|
-
// importSource: Path.resolve(__dirname, "../utils/jsx"),
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
require.resolve("@babel/preset-typescript"),
|
|
150
|
-
],
|
|
151
|
-
plugins: [
|
|
152
|
-
// Path.resolve(__dirname, "../utils/cxBabelPlugin.js"),
|
|
153
|
-
isBrowser && isDev && [require.resolve("react-refresh/babel"), { skipEnvCheck: true }],
|
|
154
|
-
require.resolve("@loadable/babel-plugin"),
|
|
155
|
-
].filter(Boolean),
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
});
|
|
160
|
-
// Styling
|
|
161
|
-
ALIAS["@styles"] = path_1.default.join(opts.baseDirectory, "styles");
|
|
162
|
-
ALIAS["@theme"] = path_1.default.join(opts.baseDirectory, "theme.css.tsx");
|
|
163
|
-
PLUGINS.push(new mini_css_extract_plugin_1.default());
|
|
164
|
-
RULES.push({
|
|
165
|
-
test: /\.(sa|sc|c)ss$/,
|
|
166
|
-
use: [
|
|
167
|
-
{
|
|
168
|
-
loader: mini_css_extract_plugin_1.default.loader,
|
|
169
|
-
options: {
|
|
170
|
-
publicPath: "/wp-content/themes/" + opts.themeName + "/dist/",
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
loader: require.resolve("css-loader"),
|
|
175
|
-
options: {
|
|
176
|
-
import: true,
|
|
177
|
-
// sourceMap: true,
|
|
178
|
-
importLoaders: 2,
|
|
179
|
-
// modules: true,
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
loader: require.resolve("postcss-loader"),
|
|
184
|
-
options: {
|
|
185
|
-
postcssOptions: {
|
|
186
|
-
ident: "postcss",
|
|
187
|
-
sourceMap: true,
|
|
188
|
-
plugins: [(0, autoprefixer_1.default)()],
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
// {
|
|
193
|
-
// loader: require.resolve("sass-loader"),
|
|
194
|
-
// options: {
|
|
195
|
-
// sourceMap: true,
|
|
196
|
-
// implementation: require("sass"),
|
|
197
|
-
// // prependData: (loaderContext: any) => {
|
|
198
|
-
// // const entryName = path
|
|
199
|
-
// // .basename(loaderContext.resourcePath)
|
|
200
|
-
// // .replace(/\.scss$/i, "")
|
|
201
|
-
// // return `
|
|
202
|
-
// // $bundle: ${JSON.stringify(entryName || "")};
|
|
203
|
-
// // $env: "${process.env.NODE_ENV}";
|
|
204
|
-
// // `
|
|
205
|
-
// },
|
|
206
|
-
// },
|
|
207
|
-
],
|
|
208
|
-
});
|
|
209
|
-
// Define some values
|
|
210
|
-
DEFINES["process.browser"] = JSON.stringify(isBrowser);
|
|
211
|
-
DEFINES["process.ssr"] = JSON.stringify(isServerless && !isBrowser);
|
|
212
|
-
DEFINES["process.LOADABLE_STATS_FILE"] = JSON.stringify(loadableManifestFile);
|
|
213
|
-
DEFINES["process.dev"] = isDev ? "true" : "false";
|
|
214
|
-
DEFINES["process.admin"] = opts.isAdmin ? "true" : "false";
|
|
215
|
-
DEFINES["process.env.themePath"] = JSON.stringify("/wp-content/themes/" + opts.themeName);
|
|
216
|
-
if (isBrowser) {
|
|
217
|
-
DEFINES["process.env.themePath"] = "window.THEME_PATH || " + DEFINES["process.env.themePath"];
|
|
218
|
-
}
|
|
219
|
-
// Bundle analyser
|
|
220
|
-
if (!opts.isAdmin && !isDev) {
|
|
221
|
-
PLUGINS.push(new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
|
|
222
|
-
analyzerMode: "static",
|
|
223
|
-
openAnalyzer: false,
|
|
224
|
-
reportFilename: "./bundle-report.html",
|
|
225
|
-
}));
|
|
226
|
-
}
|
|
227
|
-
// HMR and React Refresh
|
|
228
|
-
// if (isBrowser && isDev) PLUGINS.push(new HotModuleReplacementPlugin({}))
|
|
229
|
-
if (isBrowser && isDev)
|
|
230
|
-
PLUGINS.push(new react_refresh_webpack_plugin_1.default({
|
|
231
|
-
overlay: {
|
|
232
|
-
module: require.resolve("../utils/refreshOverlayInterop"),
|
|
233
|
-
sockHost: "127.0.0.1",
|
|
234
|
-
sockPort: 8081,
|
|
235
|
-
sockIntegration: "wds",
|
|
236
|
-
},
|
|
237
|
-
}));
|
|
238
|
-
// Loadable plugin for code-splitting
|
|
239
|
-
if (isBrowser)
|
|
240
|
-
PLUGINS.push(new webpack_plugin_1.default({
|
|
241
|
-
filename: loadableManifestFile,
|
|
242
|
-
writeToDisk: true,
|
|
243
|
-
}));
|
|
244
|
-
// Predefined values, good data injection
|
|
245
|
-
PLUGINS.push(new webpack_1.DefinePlugin(DEFINES));
|
|
246
|
-
// Errors
|
|
247
|
-
PLUGINS.push(new friendly_errors_webpack_plugin_1.default({
|
|
248
|
-
clearConsole: false,
|
|
249
|
-
}));
|
|
250
|
-
// PLUGINS.push(
|
|
251
|
-
// new ReporterPlugin({
|
|
252
|
-
// title: opts.title,
|
|
253
|
-
// })
|
|
254
|
-
// )
|
|
255
|
-
if (isDev) {
|
|
256
|
-
// PLUGINS.push(new ErrorOverlayPlugin())
|
|
257
|
-
}
|
|
258
|
-
// Virtual modules, for code injection
|
|
259
|
-
virtualModules = new webpack_virtual_modules_1.default(VIRTUAL_MODULES);
|
|
260
|
-
PLUGINS.push(virtualModules);
|
|
261
|
-
writeVirtualModule = function (name, contents) {
|
|
262
|
-
if (compiling) {
|
|
263
|
-
virtualModules.writeModule(name, contents);
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
VIRTUAL_MODULES[name] = contents;
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
// if (!opts.isAdmin) {
|
|
270
|
-
ALIAS["@manifest/views"] = path_1.default.resolve(opts.baseDirectory, "_view_manifest.js");
|
|
271
|
-
updateTemplateRouter = function (fileNames) {
|
|
272
|
-
var files = fileNames
|
|
273
|
-
.filter(function (file) { return !file.includes("/_app"); })
|
|
274
|
-
.map(function (file) {
|
|
275
|
-
var relative = path_1.default.relative(opts.baseDirectory, file);
|
|
276
|
-
var name = path_1.default.basename(file).replace(/\.(jsx|tsx|ts|js)$/i, "");
|
|
277
|
-
var module = JSON.stringify("./" + relative);
|
|
278
|
-
var componentName = (0, change_case_1.pascalCase)(name);
|
|
279
|
-
return { relative: relative, name: name, module: module, componentName: componentName };
|
|
280
|
-
});
|
|
281
|
-
writeVirtualModule(ALIAS["@manifest/views"], "\n " + (!isServerless && "import loadable from '" + require.resolve("@loadable/component") + "';") + "\n import App from " + JSON.stringify("./views/_app.tsx") + "\n\n " + (isServerless
|
|
282
|
-
? files.map(function (_a) {
|
|
283
|
-
var componentName = _a.componentName, module = _a.module;
|
|
284
|
-
return "import " + componentName + " from " + module;
|
|
285
|
-
}).join("\n")
|
|
286
|
-
: "") + "\n\n export { App }\n\n export default {\n " + files
|
|
287
|
-
.map(function (_a) {
|
|
288
|
-
var relative = _a.relative, componentName = _a.componentName, module = _a.module;
|
|
289
|
-
if (!isServerless) {
|
|
290
|
-
// In serverless mode, export @loadable components. Script tags will be
|
|
291
|
-
// auto-included in output HTML
|
|
292
|
-
return "\"" + relative + "\": loadable(() => import(" + module + "))";
|
|
293
|
-
}
|
|
294
|
-
else {
|
|
295
|
-
// On non-serverless, the templates are bundled straight into the main app.
|
|
296
|
-
return "\"" + relative + "\": " + componentName;
|
|
297
|
-
}
|
|
298
|
-
})
|
|
299
|
-
.join(",\n") + "\n }\n ");
|
|
300
|
-
};
|
|
301
|
-
templateLookupPattern = path_1.default.resolve(opts.baseDirectory, "views/**/*.tsx");
|
|
302
|
-
if (!isDev) return [3 /*break*/, 2];
|
|
303
|
-
return [4 /*yield*/, (0, file_tree_1.watchFileTree)(templateLookupPattern, updateTemplateRouter)];
|
|
304
|
-
case 1:
|
|
305
|
-
_c.sent();
|
|
306
|
-
return [3 /*break*/, 4];
|
|
307
|
-
case 2:
|
|
308
|
-
_a = updateTemplateRouter;
|
|
309
|
-
return [4 /*yield*/, (0, file_tree_1.getFileTree)(templateLookupPattern)];
|
|
310
|
-
case 3:
|
|
311
|
-
_a.apply(void 0, [_c.sent()]);
|
|
312
|
-
_c.label = 4;
|
|
313
|
-
case 4:
|
|
314
|
-
// }
|
|
315
|
-
ALIAS["@manifest/blocks"] = path_1.default.resolve(opts.baseDirectory, "_blocks_manifest.js");
|
|
316
|
-
updateBlocksManifest = function (fileNames) {
|
|
317
|
-
var files = fileNames
|
|
318
|
-
.filter(function (file) { return !file.includes("/_core"); })
|
|
319
|
-
.map(function (file) {
|
|
320
|
-
var relative = path_1.default.relative(opts.baseDirectory, file);
|
|
321
|
-
var name = path_1.default.basename(file).replace(/\.(jsx|tsx|ts|js)$/i, "");
|
|
322
|
-
var module = JSON.stringify("./" + relative);
|
|
323
|
-
var componentName = (0, change_case_1.pascalCase)(name);
|
|
324
|
-
return { relative: relative, name: name, module: module, componentName: componentName };
|
|
325
|
-
});
|
|
326
|
-
writeVirtualModule(ALIAS["@manifest/blocks"], "\n import coreBlocks from './blocks/_core.tsx'\n " + (!isServerless && "import loadable from '" + require.resolve("@loadable/component") + "';") + "\n\n export default {\n ...coreBlocks,\n " + files
|
|
327
|
-
.map(function (_a) {
|
|
328
|
-
var relative = _a.relative, componentName = _a.componentName, module = _a.module;
|
|
329
|
-
var parts = relative.replace(/\.tsx$/, "").split("/");
|
|
330
|
-
var blockName = "acf/" + parts.slice(1).join("-");
|
|
331
|
-
return "\"" + blockName + "\": loadable(() => import(" + module + "))";
|
|
332
|
-
})
|
|
333
|
-
.join(",\n") + "\n }\n ");
|
|
334
|
-
// writeVirtualModule(
|
|
335
|
-
// ALIAS["@manifest/blocks"] as string,
|
|
336
|
-
// `
|
|
337
|
-
// import coreBlocks from './blocks/_core.tsx'
|
|
338
|
-
// ${files
|
|
339
|
-
// .map(({ relative, componentName, module }) => {
|
|
340
|
-
// const parts = relative.replace(/\.tsx$/, "").split("/")
|
|
341
|
-
// const blockName = "acf/" + parts.slice(1).join("-")
|
|
342
|
-
// return `import ${componentName} from ${module}`
|
|
343
|
-
// })
|
|
344
|
-
// .join("\n")}
|
|
345
|
-
// //${!isServerless && `import loadable from '${require.resolve("@loadable/component")}';`}
|
|
346
|
-
// export default {
|
|
347
|
-
// ...coreBlocks,
|
|
348
|
-
// ${files
|
|
349
|
-
// .map(({ relative, componentName, module }) => {
|
|
350
|
-
// const parts = relative.replace(/\.tsx$/, "").split("/")
|
|
351
|
-
// const blockName = "acf/" + parts.slice(1).join("-")
|
|
352
|
-
// return `"${blockName}": ${componentName}`
|
|
353
|
-
// })
|
|
354
|
-
// .join(",\n")}
|
|
355
|
-
// }
|
|
356
|
-
// `
|
|
357
|
-
// )
|
|
358
|
-
};
|
|
359
|
-
blockLookupManifest = path_1.default.resolve(opts.baseDirectory, "blocks/**/*.tsx");
|
|
360
|
-
if (!isDev) return [3 /*break*/, 6];
|
|
361
|
-
return [4 /*yield*/, (0, file_tree_1.watchFileTree)(blockLookupManifest, updateBlocksManifest)];
|
|
362
|
-
case 5:
|
|
363
|
-
_c.sent();
|
|
364
|
-
return [3 /*break*/, 8];
|
|
365
|
-
case 6:
|
|
366
|
-
_b = updateBlocksManifest;
|
|
367
|
-
return [4 /*yield*/, (0, file_tree_1.getFileTree)(blockLookupManifest)];
|
|
368
|
-
case 7:
|
|
369
|
-
_b.apply(void 0, [_c.sent()]);
|
|
370
|
-
_c.label = 8;
|
|
371
|
-
case 8:
|
|
372
|
-
// External Gutenberg
|
|
373
|
-
EXTERNALS["@wordpress/components"] = ["wp", "components"];
|
|
374
|
-
EXTERNALS["@wordpress/element"] = ["wp", "element"];
|
|
375
|
-
EXTERNALS["@wordpress/blocks"] = ["wp", "blocks"];
|
|
376
|
-
EXTERNALS["@wordpress/utils"] = ["wp", "utils"];
|
|
377
|
-
EXTERNALS["@wordpress/data"] = ["wp", "data"];
|
|
378
|
-
EXTERNALS["@wordpress/hooks"] = ["wp", "hooks"];
|
|
379
|
-
EXTERNALS["@wordpress/block-editor"] = ["wp", "blockEditor"];
|
|
380
|
-
if (opts.isAdmin) {
|
|
381
|
-
EXTERNALS["react"] = "React";
|
|
382
|
-
}
|
|
383
|
-
return [2 /*return*/, {
|
|
384
|
-
mode: opts.mode,
|
|
385
|
-
context: opts.baseDirectory,
|
|
386
|
-
target: opts.target === "ssr" ? "node" : "web",
|
|
387
|
-
optimization: {
|
|
388
|
-
splitChunks: {
|
|
389
|
-
chunks: "async",
|
|
390
|
-
},
|
|
391
|
-
minimize: opts.mode === "production",
|
|
392
|
-
chunkIds: "named",
|
|
393
|
-
},
|
|
394
|
-
output: {
|
|
395
|
-
filename: "[name]." + (opts.isAdmin ? "admin" : "frontend") + ".js",
|
|
396
|
-
publicPath: "/wp-content/themes/" + opts.themeName + "/dist/",
|
|
397
|
-
path: outputFolder,
|
|
398
|
-
globalObject: isSSR ? "this" : "self",
|
|
399
|
-
// iife: true,
|
|
400
|
-
},
|
|
401
|
-
externals: __assign({ worker_threads: true }, EXTERNALS),
|
|
402
|
-
resolve: {
|
|
403
|
-
alias: ALIAS,
|
|
404
|
-
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
405
|
-
},
|
|
406
|
-
entry: ENTRY,
|
|
407
|
-
plugins: __spreadArray(__spreadArray([], PLUGINS, true), [
|
|
408
|
-
function () {
|
|
409
|
-
compiling = true;
|
|
410
|
-
},
|
|
411
|
-
], false),
|
|
412
|
-
module: {
|
|
413
|
-
rules: RULES,
|
|
414
|
-
},
|
|
415
|
-
devtool: opts.mode === "development" && opts.target === "client"
|
|
416
|
-
? opts.mode === "development"
|
|
417
|
-
? "cheap-module-source-map"
|
|
418
|
-
: "source-map"
|
|
419
|
-
: false,
|
|
420
|
-
stats: {
|
|
421
|
-
all: false,
|
|
422
|
-
},
|
|
423
|
-
}];
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
exports.default = getWebpackConfig;
|
package/cli/build.dev2.d.ts
DELETED
package/cli/build.dev2.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.devCommand2 = void 0;
|
|
43
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
44
|
-
// import inquirer from "inquirer"
|
|
45
|
-
var promptIfRepoNameIncorrect_1 = require("../utils/promptIfRepoNameIncorrect");
|
|
46
|
-
var path_1 = __importDefault(require("path"));
|
|
47
|
-
var ink_1 = require("ink");
|
|
48
|
-
var DevCLIDisplay_1 = require("./display/components/DevCLIDisplay");
|
|
49
|
-
var create_webpack_worker_1 = require("../build/create-webpack-worker");
|
|
50
|
-
function devCommand2(opts) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
52
|
-
var themeName, frontendObservable, adminObservable;
|
|
53
|
-
return __generator(this, function (_a) {
|
|
54
|
-
switch (_a.label) {
|
|
55
|
-
case 0: return [4 /*yield*/, (0, promptIfRepoNameIncorrect_1.promptIfRepoThemeMismatch)()];
|
|
56
|
-
case 1:
|
|
57
|
-
_a.sent();
|
|
58
|
-
themeName = path_1.default.basename(process.cwd());
|
|
59
|
-
frontendObservable = (0, create_webpack_worker_1.createWebpackWorker)({
|
|
60
|
-
title: "Frontend Client",
|
|
61
|
-
baseDirectory: process.cwd() + "/",
|
|
62
|
-
mode: "development",
|
|
63
|
-
target: "client",
|
|
64
|
-
serverless: opts.serverless,
|
|
65
|
-
themeName: themeName,
|
|
66
|
-
isAdmin: false,
|
|
67
|
-
hotPort: 8991,
|
|
68
|
-
});
|
|
69
|
-
adminObservable = (0, create_webpack_worker_1.createWebpackWorker)({
|
|
70
|
-
title: "Admin Client",
|
|
71
|
-
baseDirectory: process.cwd() + "/",
|
|
72
|
-
mode: "development",
|
|
73
|
-
target: "client",
|
|
74
|
-
serverless: false,
|
|
75
|
-
themeName: themeName,
|
|
76
|
-
isAdmin: true,
|
|
77
|
-
hotPort: 8992,
|
|
78
|
-
});
|
|
79
|
-
// Set up a process which will regenerate schemas, and watch for changes
|
|
80
|
-
// Render output to screen
|
|
81
|
-
(0, ink_1.render)((0, jsx_runtime_1.jsx)(DevCLIDisplay_1.DevCLIDisplay, { bundles: [frontendObservable, adminObservable] }, void 0));
|
|
82
|
-
return [2 /*return*/];
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
exports.devCommand2 = devCommand2;
|
|
88
|
-
var delay = function (time) { return new Promise(function (resolve) { return setTimeout(resolve, time); }); };
|
package/cli/dev/codegen-state.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { WebpackError } from "webpack";
|
|
2
|
-
export declare type CompilerStatus = "starting" | "compiling" | "success" | "waiting" | "error";
|
|
3
|
-
export declare type CompilerState = {
|
|
4
|
-
title: string;
|
|
5
|
-
status: CompilerStatus;
|
|
6
|
-
statusLabel?: string;
|
|
7
|
-
errors?: WebpackError[];
|
|
8
|
-
warnings?: WebpackError[];
|
|
9
|
-
stats?: any;
|
|
10
|
-
duration?: number;
|
|
11
|
-
};
|
package/cli/dev/dev-command.d.ts
DELETED
package/cli/dev/dev-command.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) 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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.devCommand2 = void 0;
|
|
40
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
-
var ink_1 = require("ink");
|
|
42
|
-
var DevCLIDisplay_1 = require("./display/components/DevCLIDisplay");
|
|
43
|
-
function devCommand2(opts) {
|
|
44
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
-
return __generator(this, function (_a) {
|
|
46
|
-
// Set up webpack compiler for admin + frontend
|
|
47
|
-
// Set up a process which will regenerate schemas, and watch for changes
|
|
48
|
-
// Run those compilers in a new process
|
|
49
|
-
// Render output to screen
|
|
50
|
-
(0, ink_1.render)((0, jsx_runtime_1.jsx)(DevCLIDisplay_1.DevCLIDisplay, {}, void 0));
|
|
51
|
-
return [2 /*return*/];
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
exports.devCommand2 = devCommand2;
|
|
56
|
-
var delay = function (time) { return new Promise(function (resolve) { return setTimeout(resolve, time); }); };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function beginWork(): void;
|
package/cli/dev/worker.d.ts
DELETED
|
File without changes
|
package/cli/dev/worker.js
DELETED
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function beginWork(): void;
|