@reticlehq/core 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -86
- package/dist/brand.d.ts +21 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/brand.js +16 -0
- package/dist/brand.js.map +1 -0
- package/dist/constants.d.ts +371 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +343 -0
- package/dist/constants.js.map +1 -0
- package/dist/flow-constants.d.ts +175 -0
- package/dist/flow-constants.d.ts.map +1 -0
- package/dist/flow-constants.js +162 -0
- package/dist/flow-constants.js.map +1 -0
- package/dist/flow-types.d.ts +1182 -0
- package/dist/flow-types.d.ts.map +1 -0
- package/dist/flow-types.js +144 -0
- package/dist/flow-types.js.map +1 -0
- package/dist/index.d.ts +13 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -5543
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +424 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +103 -0
- package/dist/messages.js.map +1 -0
- package/dist/notices.d.ts +47 -0
- package/dist/notices.d.ts.map +1 -0
- package/dist/notices.js +51 -0
- package/dist/notices.js.map +1 -0
- package/dist/schema/command-message.json +41 -0
- package/dist/schema/command-result.json +34 -0
- package/dist/schema/event-message.json +77 -0
- package/dist/schema/event-type.json +35 -0
- package/dist/schema/hello-message.json +59 -0
- package/dist/schema/reticle-event.json +63 -0
- package/dist/schema/reticle-message.json +193 -0
- package/dist/security.d.ts +5 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +22 -0
- package/dist/security.js.map +1 -0
- package/dist/session-constants.d.ts +116 -0
- package/dist/session-constants.d.ts.map +1 -0
- package/dist/session-constants.js +113 -0
- package/dist/session-constants.js.map +1 -0
- package/dist/state-select.d.ts +23 -0
- package/dist/state-select.d.ts.map +1 -0
- package/dist/state-select.js +60 -0
- package/dist/state-select.js.map +1 -0
- package/dist/toon.d.ts +44 -0
- package/dist/toon.d.ts.map +1 -0
- package/dist/toon.js +153 -0
- package/dist/toon.js.map +1 -0
- package/dist/types.d.ts +833 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +165 -0
- package/dist/types.js.map +1 -0
- package/dist/upgrade.d.ts +74 -0
- package/dist/upgrade.d.ts.map +1 -0
- package/dist/upgrade.js +88 -0
- package/dist/upgrade.js.map +1 -0
- package/dist/verification-run.d.ts +1195 -0
- package/dist/verification-run.d.ts.map +1 -0
- package/dist/verification-run.js +261 -0
- package/dist/verification-run.js.map +1 -0
- package/package.json +32 -79
- package/dist/babel.d.ts +0 -7
- package/dist/babel.js +0 -32
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -11264
- package/dist/eslint.d.ts +0 -1
- package/dist/eslint.js +0 -134
- package/dist/loader.cjs +0 -52
- package/dist/next.d.ts +0 -21
- package/dist/next.js +0 -24
- package/dist/server.d.ts +0 -1
- package/dist/server.js +0 -9486
- package/dist/test.d.ts +0 -1
- package/dist/test.js +0 -9368
- package/dist/vite.d.ts +0 -1
- package/dist/vite.js +0 -196
package/dist/eslint.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default, requireSignalOnMutation, rules } from '@reticlehq/eslint-plugin';
|
package/dist/eslint.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
// ../eslint-plugin/dist/require-signal-on-mutation.js
|
|
2
|
-
import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
|
|
3
|
-
|
|
4
|
-
// ../eslint-plugin/dist/constants.js
|
|
5
|
-
var RULE_NAME = "require-signal-on-mutation";
|
|
6
|
-
var MessageId = {
|
|
7
|
-
MUTATION_WITHOUT_SIGNAL: "mutationWithoutSignal"
|
|
8
|
-
};
|
|
9
|
-
var MUTATION_WITHOUT_SIGNAL_MESSAGE = "store mutation without a mapped Reticle signal";
|
|
10
|
-
var DEFAULT_SIGNAL_CALLEES = ["reticleSignal", "signal"];
|
|
11
|
-
var DEFAULT_MUTATORS = [];
|
|
12
|
-
var PLUGIN_NAME = "reticle";
|
|
13
|
-
var DOCS_URL_ROOT = "https://github.com/reticlehq/reticle/blob/main/packages/eslint-plugin/README.md";
|
|
14
|
-
|
|
15
|
-
// ../eslint-plugin/dist/options.js
|
|
16
|
-
var OPTIONS_SCHEMA = [
|
|
17
|
-
{
|
|
18
|
-
type: "object",
|
|
19
|
-
properties: {
|
|
20
|
-
mutators: {
|
|
21
|
-
type: "array",
|
|
22
|
-
items: { type: "string" }
|
|
23
|
-
},
|
|
24
|
-
signalCallee: {
|
|
25
|
-
oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }]
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
additionalProperties: false
|
|
29
|
-
}
|
|
30
|
-
];
|
|
31
|
-
function toNonEmptySet(values) {
|
|
32
|
-
return new Set(values.filter((v) => v.length > 0));
|
|
33
|
-
}
|
|
34
|
-
function normalizeOptions(raw) {
|
|
35
|
-
const mutatorList = raw?.mutators ?? DEFAULT_MUTATORS;
|
|
36
|
-
const rawSignal = raw?.signalCallee;
|
|
37
|
-
let signalList;
|
|
38
|
-
if (rawSignal === void 0) {
|
|
39
|
-
signalList = DEFAULT_SIGNAL_CALLEES;
|
|
40
|
-
} else if (typeof rawSignal === "string") {
|
|
41
|
-
signalList = [rawSignal];
|
|
42
|
-
} else {
|
|
43
|
-
signalList = rawSignal;
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
mutators: toNonEmptySet(mutatorList),
|
|
47
|
-
signalCallees: toNonEmptySet(signalList)
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// ../eslint-plugin/dist/require-signal-on-mutation.js
|
|
52
|
-
var createRule = ESLintUtils.RuleCreator((name) => `${DOCS_URL_ROOT}#${name}`);
|
|
53
|
-
function calleeName(node) {
|
|
54
|
-
const callee = node.callee;
|
|
55
|
-
if (callee.type === AST_NODE_TYPES.Identifier) {
|
|
56
|
-
return callee.name;
|
|
57
|
-
}
|
|
58
|
-
if (callee.type === AST_NODE_TYPES.MemberExpression && callee.computed === false && callee.property.type === AST_NODE_TYPES.Identifier) {
|
|
59
|
-
return callee.property.name;
|
|
60
|
-
}
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
var requireSignalOnMutation = createRule({
|
|
64
|
-
name: "require-signal-on-mutation",
|
|
65
|
-
meta: {
|
|
66
|
-
type: "problem",
|
|
67
|
-
docs: {
|
|
68
|
-
description: "Require an Reticle signal alongside any user-visible store mutation so the signal layer cannot drift."
|
|
69
|
-
},
|
|
70
|
-
schema: OPTIONS_SCHEMA,
|
|
71
|
-
messages: {
|
|
72
|
-
[MessageId.MUTATION_WITHOUT_SIGNAL]: MUTATION_WITHOUT_SIGNAL_MESSAGE
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
defaultOptions: [{}],
|
|
76
|
-
create(context) {
|
|
77
|
-
const { mutators, signalCallees } = normalizeOptions(context.options[0]);
|
|
78
|
-
const stack = [];
|
|
79
|
-
function enterFn() {
|
|
80
|
-
stack.push({ calledSignal: false, mutatorNode: null });
|
|
81
|
-
}
|
|
82
|
-
function exitFn() {
|
|
83
|
-
const frame = stack.pop();
|
|
84
|
-
if (frame === void 0)
|
|
85
|
-
return;
|
|
86
|
-
if (frame.mutatorNode !== null && frame.calledSignal === false) {
|
|
87
|
-
context.report({
|
|
88
|
-
node: frame.mutatorNode,
|
|
89
|
-
messageId: MessageId.MUTATION_WITHOUT_SIGNAL
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
FunctionDeclaration: enterFn,
|
|
95
|
-
"FunctionDeclaration:exit": exitFn,
|
|
96
|
-
FunctionExpression: enterFn,
|
|
97
|
-
"FunctionExpression:exit": exitFn,
|
|
98
|
-
ArrowFunctionExpression: enterFn,
|
|
99
|
-
"ArrowFunctionExpression:exit": exitFn,
|
|
100
|
-
CallExpression(node) {
|
|
101
|
-
const frame = stack.at(-1);
|
|
102
|
-
if (frame === void 0)
|
|
103
|
-
return;
|
|
104
|
-
const name = calleeName(node);
|
|
105
|
-
if (name === null)
|
|
106
|
-
return;
|
|
107
|
-
if (mutators.has(name) && frame.mutatorNode === null) {
|
|
108
|
-
frame.mutatorNode = node;
|
|
109
|
-
}
|
|
110
|
-
if (signalCallees.has(name)) {
|
|
111
|
-
frame.calledSignal = true;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
// ../eslint-plugin/dist/index.js
|
|
119
|
-
var rules = { [RULE_NAME]: requireSignalOnMutation };
|
|
120
|
-
var plugin = {
|
|
121
|
-
meta: { name: PLUGIN_NAME },
|
|
122
|
-
rules,
|
|
123
|
-
configs: {}
|
|
124
|
-
};
|
|
125
|
-
plugin.configs.recommended = {
|
|
126
|
-
plugins: { [PLUGIN_NAME]: plugin },
|
|
127
|
-
rules: { [`${PLUGIN_NAME}/${RULE_NAME}`]: "warn" }
|
|
128
|
-
};
|
|
129
|
-
var dist_default = plugin;
|
|
130
|
-
export {
|
|
131
|
-
dist_default as default,
|
|
132
|
-
requireSignalOnMutation,
|
|
133
|
-
rules
|
|
134
|
-
};
|
package/dist/loader.cjs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
// Webpack pre-loader for `@reticlehq/core/next` — ships INTO the umbrella's dist/ alongside next.js and
|
|
3
|
-
// babel.js. Applies the Reticle source-mapping babel transform (stamps data-reticle-source) to the project's
|
|
4
|
-
// JSX/TSX, then hands the result to next-swc-loader. SWC still does the real compile; we only stamp
|
|
5
|
-
// source locations. Dev-only (wired by withReticle).
|
|
6
|
-
//
|
|
7
|
-
// Authored as plain CJS (module.exports = function) so webpack requires it directly. The babel plugin
|
|
8
|
-
// is NOT imported from the private @reticlehq/babel-plugin — it's pulled from the umbrella's own
|
|
9
|
-
// bundled ./babel (ESM) via dynamic import, so this loader is self-contained inside the published dist.
|
|
10
|
-
const babel = require('@babel/core');
|
|
11
|
-
|
|
12
|
-
let pluginPromise;
|
|
13
|
-
|
|
14
|
-
module.exports = function reticleNextLoader(source, inputMap) {
|
|
15
|
-
const callback = this.async();
|
|
16
|
-
const filename = this.resourcePath;
|
|
17
|
-
|
|
18
|
-
if (!/\.(t|j)sx$/.test(filename) || filename.includes('node_modules')) {
|
|
19
|
-
callback(null, source, inputMap);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// The bundled source-mapping plugin is the umbrella's ./babel default export.
|
|
24
|
-
pluginPromise = pluginPromise || import('./babel.js').then((m) => m.default || m);
|
|
25
|
-
|
|
26
|
-
pluginPromise
|
|
27
|
-
.then((plugin) =>
|
|
28
|
-
babel.transformAsync(source, {
|
|
29
|
-
filename,
|
|
30
|
-
sourceType: 'module',
|
|
31
|
-
plugins: [plugin],
|
|
32
|
-
parserOpts: { plugins: ['jsx', 'typescript'] },
|
|
33
|
-
generatorOpts: { retainLines: true },
|
|
34
|
-
configFile: false,
|
|
35
|
-
babelrc: false,
|
|
36
|
-
sourceMaps: true,
|
|
37
|
-
sourceFileName: filename,
|
|
38
|
-
}),
|
|
39
|
-
)
|
|
40
|
-
.then((result) => {
|
|
41
|
-
if (result && typeof result.code === 'string') {
|
|
42
|
-
callback(null, result.code, result.map || inputMap);
|
|
43
|
-
} else {
|
|
44
|
-
callback(null, source, inputMap);
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
.catch((err) => {
|
|
48
|
-
// Never break the build for a source-map nicety — fall back to the original source.
|
|
49
|
-
callback(null, source, inputMap);
|
|
50
|
-
void err;
|
|
51
|
-
});
|
|
52
|
-
};
|
package/dist/next.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/** A minimal mutable webpack config shape — avoids a hard dependency on `webpack`/`next` types. */
|
|
2
|
-
interface WebpackConfigLike {
|
|
3
|
-
module?: {
|
|
4
|
-
rules?: unknown[];
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
/** Minimal Next config shape — only the field we touch is typed; the rest passes through. */
|
|
8
|
-
interface NextConfigLike {
|
|
9
|
-
webpack?: (config: WebpackConfigLike, ctx: unknown) => WebpackConfigLike;
|
|
10
|
-
[key: string]: unknown;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Wrap your Next config to stamp `data-reticle-source` on JSX in dev (so reticle_inspect maps DOM → file:line)
|
|
14
|
-
* without disabling SWC. Production builds are untouched. Usage:
|
|
15
|
-
*
|
|
16
|
-
* import { withReticle } from '@reticlehq/core/next';
|
|
17
|
-
* export default withReticle(nextConfig);
|
|
18
|
-
*/
|
|
19
|
-
declare function withReticle(nextConfig?: NextConfigLike): NextConfigLike;
|
|
20
|
-
|
|
21
|
-
export { withReticle };
|
package/dist/next.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// src/next.ts
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
3
|
-
var LOADER_PATH = fileURLToPath(new URL("./loader.cjs", import.meta.url));
|
|
4
|
-
function withReticle(nextConfig = {}) {
|
|
5
|
-
if (process.env["NODE_ENV"] === "production") return nextConfig;
|
|
6
|
-
const userWebpack = nextConfig.webpack;
|
|
7
|
-
return {
|
|
8
|
-
...nextConfig,
|
|
9
|
-
webpack(config, ctx) {
|
|
10
|
-
const mod = config.module ??= {};
|
|
11
|
-
const rules = mod.rules ??= [];
|
|
12
|
-
rules.push({
|
|
13
|
-
test: /\.(t|j)sx$/,
|
|
14
|
-
exclude: /node_modules/,
|
|
15
|
-
enforce: "pre",
|
|
16
|
-
use: [{ loader: LOADER_PATH }]
|
|
17
|
-
});
|
|
18
|
-
return typeof userWebpack === "function" ? userWebpack(config, ctx) : config;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
withReticle
|
|
24
|
-
};
|
package/dist/server.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@reticlehq/server';
|