eddev 0.1.26 → 0.1.30
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/BrowserRouter.js +1 -1
- package/components/InlinePage.js +1 -1
- package/components/index.d.ts +0 -1
- package/components/index.js +0 -1
- package/components/routing.d.ts +3 -1
- package/components/routing.js +4 -5
- package/entry/Root.js +4 -4
- package/hooks/queryUtils.js +2 -2
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +5 -7
- package/routing/index.d.ts +1 -0
- package/routing/index.js +13 -0
- package/routing/routing.d.ts +45 -0
- package/routing/routing.js +373 -0
- 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
|
@@ -0,0 +1,160 @@
|
|
|
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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
|
+
if (ar || !(i in from)) {
|
|
41
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
+
ar[i] = from[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
+
};
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.beginWork = void 0;
|
|
52
|
+
var webpack_1 = __importDefault(require("webpack"));
|
|
53
|
+
var webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
|
|
54
|
+
var worker_threads_1 = require("worker_threads");
|
|
55
|
+
var get_webpack_config_1 = __importDefault(require("../get-webpack-config"));
|
|
56
|
+
var sendSignal = function (sig) {
|
|
57
|
+
if (worker_threads_1.parentPort) {
|
|
58
|
+
worker_threads_1.parentPort.postMessage(sig);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function beginWork(opts) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
+
function extractErrorMessage(str) {
|
|
64
|
+
return str
|
|
65
|
+
.replace(/Module build failed[^\n]+\n/, "")
|
|
66
|
+
.replaceAll(opts.baseDirectory, "./")
|
|
67
|
+
.replace(/\s+at\s[\s\S]+/, "");
|
|
68
|
+
}
|
|
69
|
+
function webpackToCompilerError(err, type) {
|
|
70
|
+
return {
|
|
71
|
+
type: type,
|
|
72
|
+
details: err.details,
|
|
73
|
+
message: extractErrorMessage(err.message),
|
|
74
|
+
file: err.moduleName || "",
|
|
75
|
+
loc: err.loc,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
var compiler, _a, server;
|
|
79
|
+
return __generator(this, function (_b) {
|
|
80
|
+
switch (_b.label) {
|
|
81
|
+
case 0:
|
|
82
|
+
sendSignal({
|
|
83
|
+
code: "compiling",
|
|
84
|
+
});
|
|
85
|
+
_a = webpack_1.default;
|
|
86
|
+
return [4 /*yield*/, (0, get_webpack_config_1.default)(opts)];
|
|
87
|
+
case 1:
|
|
88
|
+
compiler = _a.apply(void 0, [_b.sent()]);
|
|
89
|
+
if (opts.hotPort) {
|
|
90
|
+
server = new webpack_dev_server_1.default(compiler, {
|
|
91
|
+
liveReload: false,
|
|
92
|
+
compress: true,
|
|
93
|
+
hotOnly: true,
|
|
94
|
+
disableHostCheck: true,
|
|
95
|
+
host: "127.0.0.1",
|
|
96
|
+
port: opts.hotPort,
|
|
97
|
+
writeToDisk: true,
|
|
98
|
+
transportMode: "ws",
|
|
99
|
+
publicPath: "/",
|
|
100
|
+
public: "http://127.0.0.1:" + opts.hotPort,
|
|
101
|
+
overlay: true,
|
|
102
|
+
sockPort: opts.hotPort,
|
|
103
|
+
contentBase: false,
|
|
104
|
+
noInfo: true,
|
|
105
|
+
// quiet: true,
|
|
106
|
+
// clientLogLevel: "silent",
|
|
107
|
+
headers: {
|
|
108
|
+
"Access-Control-Allow-Origin": "*",
|
|
109
|
+
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
|
|
110
|
+
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization",
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
server.listen(opts.hotPort);
|
|
114
|
+
}
|
|
115
|
+
compiler.hooks.beforeCompile.tap("eddev", function () {
|
|
116
|
+
sendSignal({
|
|
117
|
+
code: "compiling",
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
compiler.hooks.invalid.tap("eddev", function (filename) {
|
|
121
|
+
sendSignal({
|
|
122
|
+
code: "invalidated",
|
|
123
|
+
changedFile: filename,
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
compiler.hooks.done.tap("eddev", function (_a) {
|
|
127
|
+
var _b, _c;
|
|
128
|
+
var compilation = _a.compilation;
|
|
129
|
+
var stats = compilation.getStats().toJson({
|
|
130
|
+
all: true,
|
|
131
|
+
errorDetails: true,
|
|
132
|
+
errors: true,
|
|
133
|
+
errorStack: true,
|
|
134
|
+
errorsCount: true,
|
|
135
|
+
colors: true,
|
|
136
|
+
timings: true,
|
|
137
|
+
});
|
|
138
|
+
var errors = ((_b = stats.errors) === null || _b === void 0 ? void 0 : _b.map(function (err) { return webpackToCompilerError(err, "error"); })) || [];
|
|
139
|
+
var warnings = ((_c = stats.warnings) === null || _c === void 0 ? void 0 : _c.map(function (err) { return webpackToCompilerError(err, "warning"); })) || [];
|
|
140
|
+
if (errors.length) {
|
|
141
|
+
sendSignal({
|
|
142
|
+
code: "error",
|
|
143
|
+
errors: __spreadArray(__spreadArray([], warnings, true), errors, true),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
sendSignal({
|
|
148
|
+
code: "finished",
|
|
149
|
+
duration: stats.time,
|
|
150
|
+
errors: __spreadArray(__spreadArray([], warnings, true), errors, true),
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return [2 /*return*/];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
exports.beginWork = beginWork;
|
|
160
|
+
beginWork(worker_threads_1.workerData);
|
package/cli/cli.js
CHANGED
|
@@ -35,15 +35,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
39
|
var commander_1 = require("commander");
|
|
43
40
|
var build_dev_1 = require("./build.dev");
|
|
44
|
-
var build_dev2_1 = require("./build.dev2");
|
|
45
41
|
var build_prod_1 = require("./build.prod");
|
|
46
|
-
var generate_1 = __importDefault(require("./generate"));
|
|
47
42
|
var setup_1 = require("./setup");
|
|
48
43
|
var program = new commander_1.Command();
|
|
49
44
|
program.version("0.0.1");
|
|
@@ -57,15 +52,6 @@ program
|
|
|
57
52
|
serverless: options.serverless,
|
|
58
53
|
});
|
|
59
54
|
});
|
|
60
|
-
program
|
|
61
|
-
.command("dev2")
|
|
62
|
-
.description("Build in dev2 mode")
|
|
63
|
-
.option("-s, --serverless", 'Build in "serverless" mode', false)
|
|
64
|
-
.action(function (options) {
|
|
65
|
-
(0, build_dev2_1.devCommand2)({
|
|
66
|
-
serverless: options.serverless,
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
55
|
program
|
|
70
56
|
.command("build")
|
|
71
57
|
.description("Build in production mode")
|
|
@@ -85,21 +71,10 @@ program
|
|
|
85
71
|
.command("generate")
|
|
86
72
|
.description("Generate GraphQL Schemas")
|
|
87
73
|
.action(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
88
|
-
var err_1;
|
|
89
74
|
return __generator(this, function (_a) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return [4 /*yield*/, (0, generate_1.default)()];
|
|
94
|
-
case 1:
|
|
95
|
-
_a.sent();
|
|
96
|
-
return [3 /*break*/, 3];
|
|
97
|
-
case 2:
|
|
98
|
-
err_1 = _a.sent();
|
|
99
|
-
console.error(err_1);
|
|
100
|
-
return [3 /*break*/, 3];
|
|
101
|
-
case 3: return [2 /*return*/];
|
|
102
|
-
}
|
|
75
|
+
console.log("This command has been deprecated! Please use `yarn dev` instead.");
|
|
76
|
+
process.exit();
|
|
77
|
+
return [2 /*return*/];
|
|
103
78
|
});
|
|
104
79
|
}); });
|
|
105
80
|
program.parse(process.argv);
|
|
@@ -40,7 +40,7 @@ function StatusLabel(props) {
|
|
|
40
40
|
}
|
|
41
41
|
}, [props.status]);
|
|
42
42
|
var label = props.statusLabel || statusLabels[props.status];
|
|
43
|
-
var duration = props.duration ? "("
|
|
43
|
+
var duration = props.duration ? "(".concat(props.duration, "ms)") : "";
|
|
44
44
|
return ((0, jsx_runtime_1.jsxs)(ink_1.Text, __assign({ color: color }, { children: [label, " ", duration] }), void 0));
|
|
45
45
|
}
|
|
46
46
|
function BundleDisplay(props) {
|
|
@@ -42,10 +42,10 @@ function StatusLabel(props) {
|
|
|
42
42
|
}, [props.status]);
|
|
43
43
|
var label = props.statusLabel || statusLabels[props.status];
|
|
44
44
|
if (props.reason) {
|
|
45
|
-
label += " ("
|
|
45
|
+
label += " (".concat(props.reason, ")");
|
|
46
46
|
}
|
|
47
47
|
if (props.duration) {
|
|
48
|
-
label += " ("
|
|
48
|
+
label += " (".concat(props.duration, "ms)");
|
|
49
49
|
}
|
|
50
50
|
return (0, jsx_runtime_1.jsx)(ink_1.Text, __assign({ color: color }, { children: label }), void 0);
|
|
51
51
|
}
|
package/cli/generate.js
CHANGED
|
@@ -36,24 +36,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var generateSchemaTypes_1 = require("../utils/generateSchemaTypes");
|
|
40
39
|
function generate() {
|
|
41
40
|
return __awaiter(this, void 0, void 0, function () {
|
|
42
41
|
return __generator(this, function (_a) {
|
|
43
|
-
|
|
44
|
-
case 0:
|
|
45
|
-
console.log("Generating");
|
|
46
|
-
if (!process.env.DEBUG_GRAPHQL_URL) {
|
|
47
|
-
throw new Error("Could not find DEBUG_GRAPHQL_URL in environment variables");
|
|
48
|
-
}
|
|
49
|
-
return [4 /*yield*/, (0, generateSchemaTypes_1.generateSchemaTypes)({
|
|
50
|
-
endpoint: process.env.DEBUG_GRAPHQL_URL,
|
|
51
|
-
rootDir: process.cwd(),
|
|
52
|
-
})];
|
|
53
|
-
case 1:
|
|
54
|
-
_a.sent();
|
|
55
|
-
return [2 /*return*/];
|
|
56
|
-
}
|
|
42
|
+
throw new Error("This command has been deprecated! Please use `yarn dev` instead.");
|
|
57
43
|
});
|
|
58
44
|
});
|
|
59
45
|
}
|
|
@@ -18,7 +18,7 @@ exports.BrowserRouter = void 0;
|
|
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
var react_1 = require("react");
|
|
20
20
|
var remoteProps_1 = require("../utils/remoteProps");
|
|
21
|
-
var routing_1 = require("
|
|
21
|
+
var routing_1 = require("../routing");
|
|
22
22
|
// @ts-ignore
|
|
23
23
|
var views_1 = __importDefault(require("@manifest/views"));
|
|
24
24
|
var usePageLoad_1 = require("../hooks/usePageLoad");
|
package/components/InlinePage.js
CHANGED
|
@@ -18,7 +18,7 @@ exports.InlinePage = void 0;
|
|
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
var react_1 = require("react");
|
|
20
20
|
var remoteProps_1 = require("../utils/remoteProps");
|
|
21
|
-
var routing_1 = require("
|
|
21
|
+
var routing_1 = require("../routing");
|
|
22
22
|
// @ts-ignore
|
|
23
23
|
var views_1 = __importDefault(require("@manifest/views"));
|
|
24
24
|
/**
|
package/components/index.d.ts
CHANGED
package/components/index.js
CHANGED
|
@@ -10,7 +10,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./routing"), exports);
|
|
14
13
|
__exportStar(require("./ContentBlocks"), exports);
|
|
15
14
|
__exportStar(require("./AdminBar"), exports);
|
|
16
15
|
__exportStar(require("./InlinePage"), exports);
|
package/components/routing.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ReactNode, PropsWithChildren } from "react";
|
|
|
2
2
|
import { APropsWithoutRef } from "react-html-props";
|
|
3
3
|
import URLParse from "url-parse";
|
|
4
4
|
import { RouteData } from "../utils/remoteProps";
|
|
5
|
-
declare type RouteItem = URLParse & {
|
|
5
|
+
declare type RouteItem = URLParse<any> & {
|
|
6
6
|
data?: RouteData;
|
|
7
7
|
};
|
|
8
8
|
declare type AnyPromise = Promise<any>;
|
|
@@ -34,6 +34,8 @@ declare type SwitchProps = {
|
|
|
34
34
|
};
|
|
35
35
|
export declare const Link: import("react").ForwardRefExoticComponent<APropsWithoutRef & {
|
|
36
36
|
preload?: boolean | undefined;
|
|
37
|
+
} & {
|
|
38
|
+
className?: string | undefined;
|
|
37
39
|
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
38
40
|
export declare function Switch({ children }: SwitchProps): JSX.Element;
|
|
39
41
|
export declare function RouteItemContext(props: PropsWithChildren<{
|
package/components/routing.js
CHANGED
|
@@ -93,8 +93,7 @@ function createRouteContext(opts) {
|
|
|
93
93
|
var promises = [Promise.resolve()];
|
|
94
94
|
var matches = ctx.match(next);
|
|
95
95
|
logger(ctx.config.debugName, "was", ctx.status, matches);
|
|
96
|
-
if (ctx.status === "active" &&
|
|
97
|
-
(!matches || matches !== ctx.currentMatch)) {
|
|
96
|
+
if (ctx.status === "active" && (!matches || matches !== ctx.currentMatch)) {
|
|
98
97
|
logger(ctx.config.debugName, "is leaving because ", matches, "!=", ctx.currentMatch);
|
|
99
98
|
ctx.status = "leaving";
|
|
100
99
|
}
|
|
@@ -255,7 +254,7 @@ function Route(props) {
|
|
|
255
254
|
}, [ctx]);
|
|
256
255
|
if (status === "inactive")
|
|
257
256
|
return null;
|
|
258
|
-
return (
|
|
257
|
+
return (0, jsx_runtime_1.jsx)(RouterContext.Provider, __assign({ value: ctx }, { children: props.children }), void 0);
|
|
259
258
|
}
|
|
260
259
|
exports.Route = Route;
|
|
261
260
|
function createRouteItem(url, data) {
|
|
@@ -305,7 +304,7 @@ function RouterRoot(props) {
|
|
|
305
304
|
};
|
|
306
305
|
}
|
|
307
306
|
}, [props.url, props.data]);
|
|
308
|
-
return (
|
|
307
|
+
return (0, jsx_runtime_1.jsx)(RouterContext.Provider, __assign({ value: ctx }, { children: props.children }), void 0);
|
|
309
308
|
}
|
|
310
309
|
exports.RouterRoot = RouterRoot;
|
|
311
310
|
exports.Link = (0, react_1.forwardRef)(function (props, ref) {
|
|
@@ -359,6 +358,6 @@ function RouteItemContext(props) {
|
|
|
359
358
|
debugName: undefined,
|
|
360
359
|
onChange: undefined,
|
|
361
360
|
});
|
|
362
|
-
return (
|
|
361
|
+
return (0, jsx_runtime_1.jsx)(RouterContext.Provider, __assign({ value: ctx }, { children: props.children }), void 0);
|
|
363
362
|
}
|
|
364
363
|
exports.RouteItemContext = RouteItemContext;
|
package/entry/Root.js
CHANGED
|
@@ -34,13 +34,13 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
34
34
|
// @ts-ignore
|
|
35
35
|
var views_1 = __importStar(require("@manifest/views"));
|
|
36
36
|
var react_1 = require("react");
|
|
37
|
-
var
|
|
37
|
+
var routing_1 = require("../routing");
|
|
38
38
|
function Root() {
|
|
39
|
-
var route = (0,
|
|
40
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(views_1.App, { children: (0, jsx_runtime_1.jsx)(
|
|
39
|
+
var route = (0, routing_1.useRoute)();
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(views_1.App, { children: (0, jsx_runtime_1.jsx)(routing_1.Switch, { children: Object.entries(views_1.default).map(function (_a) {
|
|
41
41
|
var _b, _c;
|
|
42
42
|
var name = _a[0], Component = _a[1];
|
|
43
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)(routing_1.Route, __assign({ match: function (route) { var _a; return ((_a = route.data) === null || _a === void 0 ? void 0 : _a.view) === name; } }, { children: (0, jsx_runtime_1.jsx)(Component, __assign({}, (_c = (_b = route.data) === null || _b === void 0 ? void 0 : _b.viewData) === null || _c === void 0 ? void 0 : _c.data), void 0) }), name));
|
|
44
44
|
}) }, void 0) }, void 0) }, void 0));
|
|
45
45
|
}
|
|
46
46
|
exports.default = Root;
|
package/hooks/queryUtils.js
CHANGED
|
@@ -68,7 +68,7 @@ var fetcherGET = function (name, params) { return __awaiter(void 0, void 0, void
|
|
|
68
68
|
return __generator(this, function (_a) {
|
|
69
69
|
switch (_a.label) {
|
|
70
70
|
case 0:
|
|
71
|
-
url = "/wp-json/ed/v1/query/"
|
|
71
|
+
url = "/wp-json/ed/v1/query/".concat(name);
|
|
72
72
|
if (params)
|
|
73
73
|
url += "?params=" + encodeURIComponent(params);
|
|
74
74
|
return [4 /*yield*/, fetch(url, {})];
|
|
@@ -177,7 +177,7 @@ function createUseMutation(init) {
|
|
|
177
177
|
case 0:
|
|
178
178
|
setSubmitting(true);
|
|
179
179
|
setSubmitted(false);
|
|
180
|
-
url = "/wp-json/ed/v1/mutation/"
|
|
180
|
+
url = "/wp-json/ed/v1/mutation/".concat(init.name);
|
|
181
181
|
_a.label = 1;
|
|
182
182
|
case 1:
|
|
183
183
|
_a.trys.push([1, 4, , 5]);
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -12,3 +12,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./components"), exports);
|
|
14
14
|
__exportStar(require("./hooks"), exports);
|
|
15
|
+
__exportStar(require("./routing"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eddev",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"@types/inquirer": "^8.1.1",
|
|
19
19
|
"@types/loadable__component": "^5.13.4",
|
|
20
20
|
"@types/node": "^16.7.10",
|
|
21
|
-
"@types/react": "^17.0.
|
|
21
|
+
"@types/react": "^17.0.36",
|
|
22
|
+
"@types/react-dom": "^17.0.11",
|
|
22
23
|
"@types/react-inspector": "^4.0.2",
|
|
23
24
|
"@types/rimraf": "^3.0.2",
|
|
24
25
|
"@types/url-parse": "^1.4.4",
|
|
@@ -36,7 +37,6 @@
|
|
|
36
37
|
"@boost/log": "^3.0.0",
|
|
37
38
|
"@graphql-codegen/cli": "^2.2.0",
|
|
38
39
|
"@graphql-codegen/core": "^2.1.0",
|
|
39
|
-
"@graphql-codegen/gql-tag-operations-preset": "^1.1.5",
|
|
40
40
|
"@graphql-codegen/typescript": "^2.2.1",
|
|
41
41
|
"@graphql-codegen/typescript-operations": "^2.1.3",
|
|
42
42
|
"@graphql-tools/load": "^7.3.0",
|
|
@@ -48,14 +48,11 @@
|
|
|
48
48
|
"@soda/friendly-errors-webpack-plugin": "^1.8.0",
|
|
49
49
|
"@stitches/core": "^1.2.5",
|
|
50
50
|
"@stitches/react": "^1.2.5",
|
|
51
|
-
"@wordpress/block-editor": "^7.0.2",
|
|
52
|
-
"@wordpress/blocks": "^11.1.0",
|
|
53
51
|
"autoprefixer": "^10.3.4",
|
|
54
52
|
"babel-loader": "^8.2.2",
|
|
55
53
|
"chalk": "^4.1.2",
|
|
56
54
|
"change-case": "^4.1.2",
|
|
57
55
|
"chokidar": "^3.5.2",
|
|
58
|
-
"clsx": "^1.1.1",
|
|
59
56
|
"commander": "^8.1.0",
|
|
60
57
|
"css-loader": "^6.2.0",
|
|
61
58
|
"dotenv": "^10.0.0",
|
|
@@ -89,6 +86,7 @@
|
|
|
89
86
|
"zustand": "^3.5.10"
|
|
90
87
|
},
|
|
91
88
|
"peerDependencies": {
|
|
92
|
-
"react": "^17.0.2"
|
|
89
|
+
"react": "^17.0.2",
|
|
90
|
+
"react-dom": "^17.0.2"
|
|
93
91
|
}
|
|
94
92
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./routing";
|
package/routing/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./routing"), exports);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ReactNode, PropsWithChildren } from "react";
|
|
2
|
+
import { APropsWithoutRef } from "react-html-props";
|
|
3
|
+
import URLParse from "url-parse";
|
|
4
|
+
import { RouteData } from "../utils/remoteProps";
|
|
5
|
+
declare type RouteItem = URLParse<any> & {
|
|
6
|
+
data?: RouteData;
|
|
7
|
+
};
|
|
8
|
+
declare type AnyPromise = Promise<any>;
|
|
9
|
+
declare type MatchResult = boolean | string;
|
|
10
|
+
declare type RouteStatus = "leaving" | "parent-leaving" | "active" | "inactive";
|
|
11
|
+
declare type RouteContextConfig = {
|
|
12
|
+
debugName?: string;
|
|
13
|
+
match?(next: RouteItem): MatchResult;
|
|
14
|
+
beforeLeave?(current: RouteItem, next: RouteItem, parentIsLeaving: boolean): AnyPromise | undefined;
|
|
15
|
+
onChange?(route: RouteItem, status: RouteStatus): void;
|
|
16
|
+
};
|
|
17
|
+
export declare function useRoute(): RouteItem;
|
|
18
|
+
export declare type RouteProps = RouteContextConfig & {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export declare function Route(props: RouteProps): JSX.Element | null;
|
|
22
|
+
export declare function createRouteItem(url: string, data: RouteData): RouteItem;
|
|
23
|
+
declare type RouterRootProps = {
|
|
24
|
+
url: string;
|
|
25
|
+
data: RouteData;
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
onNavigateRequest?: (url: string) => void;
|
|
28
|
+
onPreload?: (url: string) => void;
|
|
29
|
+
onNavigated?: (url: string) => void;
|
|
30
|
+
};
|
|
31
|
+
export declare function RouterRoot(props: RouterRootProps): JSX.Element;
|
|
32
|
+
declare type SwitchProps = {
|
|
33
|
+
children: ReactNode | ReactNode[];
|
|
34
|
+
};
|
|
35
|
+
export declare const isInternalPageLink: (href: string) => boolean;
|
|
36
|
+
export declare const Link: import("react").ForwardRefExoticComponent<APropsWithoutRef & {
|
|
37
|
+
preload?: boolean | undefined;
|
|
38
|
+
} & {
|
|
39
|
+
className?: string | undefined;
|
|
40
|
+
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
41
|
+
export declare function Switch({ children }: SwitchProps): JSX.Element;
|
|
42
|
+
export declare function RouteItemContext(props: PropsWithChildren<{
|
|
43
|
+
route: RouteItem;
|
|
44
|
+
}>): JSX.Element;
|
|
45
|
+
export {};
|