atom.io 0.25.6 → 0.26.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.
Files changed (52) hide show
  1. package/data/dist/index.js +33 -25
  2. package/data/package.json +1 -4
  3. package/dist/{chunk-HYXKCFVY.js → chunk-IBTHB2PI.js} +59 -60
  4. package/dist/{chunk-MR5NETHW.js → chunk-IW6WYRS7.js} +4 -5
  5. package/dist/chunk-XWL6SNVU.js +7 -0
  6. package/dist/index.js +33 -21
  7. package/ephemeral/dist/index.js +1 -1
  8. package/ephemeral/package.json +1 -4
  9. package/eslint-plugin/dist/index.js +7 -8
  10. package/eslint-plugin/package.json +1 -4
  11. package/immortal/dist/index.js +1 -1
  12. package/immortal/package.json +1 -4
  13. package/internal/dist/index.js +173 -160
  14. package/internal/package.json +1 -4
  15. package/introspection/dist/index.js +32 -30
  16. package/introspection/package.json +1 -4
  17. package/json/dist/index.js +1 -1
  18. package/json/package.json +1 -4
  19. package/package.json +18 -50
  20. package/react/dist/index.js +2 -2
  21. package/react/package.json +1 -4
  22. package/react-devtools/dist/index.js +75 -68
  23. package/react-devtools/package.json +1 -4
  24. package/realtime/dist/index.js +8 -9
  25. package/realtime/package.json +1 -4
  26. package/realtime-client/dist/index.js +6 -6
  27. package/realtime-client/package.json +1 -4
  28. package/realtime-react/dist/index.js +9 -11
  29. package/realtime-react/package.json +1 -4
  30. package/realtime-server/dist/index.js +59 -54
  31. package/realtime-server/package.json +1 -4
  32. package/realtime-testing/dist/index.js +3 -3
  33. package/realtime-testing/package.json +1 -4
  34. package/transceivers/set-rtx/dist/index.js +11 -11
  35. package/transceivers/set-rtx/package.json +1 -4
  36. package/data/dist/index.cjs +0 -953
  37. package/dist/chunk-S4N6XNPH.js +0 -38
  38. package/dist/index.cjs +0 -215
  39. package/ephemeral/dist/index.cjs +0 -11
  40. package/eslint-plugin/dist/index.cjs +0 -388
  41. package/immortal/dist/index.cjs +0 -14
  42. package/internal/dist/index.cjs +0 -3405
  43. package/introspection/dist/index.cjs +0 -449
  44. package/json/dist/index.cjs +0 -128
  45. package/react/dist/index.cjs +0 -118
  46. package/react-devtools/dist/index.cjs +0 -2191
  47. package/realtime/dist/index.cjs +0 -120
  48. package/realtime-client/dist/index.cjs +0 -569
  49. package/realtime-react/dist/index.cjs +0 -189
  50. package/realtime-server/dist/index.cjs +0 -965
  51. package/realtime-testing/dist/index.cjs +0 -201
  52. package/transceivers/set-rtx/dist/index.cjs +0 -215
@@ -1,38 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __restKey = (key) => typeof key === "symbol" ? key : key + "";
21
- var __objRest = (source, exclude) => {
22
- var target = {};
23
- for (var prop in source)
24
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
- target[prop] = source[prop];
26
- if (source != null && __getOwnPropSymbols)
27
- for (var prop of __getOwnPropSymbols(source)) {
28
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
- target[prop] = source[prop];
30
- }
31
- return target;
32
- };
33
- var __export = (target, all) => {
34
- for (var name in all)
35
- __defProp(target, name, { get: all[name], enumerable: true });
36
- };
37
-
38
- export { __export, __objRest, __restKey, __spreadProps, __spreadValues };
package/dist/index.cjs DELETED
@@ -1,215 +0,0 @@
1
- 'use strict';
2
-
3
- var Internal = require('atom.io/internal');
4
- var json = require('atom.io/json');
5
-
6
- function _interopNamespace(e) {
7
- if (e && e.__esModule) return e;
8
- var n = Object.create(null);
9
- if (e) {
10
- Object.keys(e).forEach(function (k) {
11
- if (k !== 'default') {
12
- var d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: function () { return e[k]; }
16
- });
17
- }
18
- });
19
- }
20
- n.default = e;
21
- return Object.freeze(n);
22
- }
23
-
24
- var Internal__namespace = /*#__PURE__*/_interopNamespace(Internal);
25
-
26
- // src/atom.ts
27
- function atom(options) {
28
- return Internal.createStandaloneAtom(options, Internal.IMPLICIT.STORE);
29
- }
30
- function atomFamily(options) {
31
- return Internal.createAtomFamily(options, Internal.IMPLICIT.STORE);
32
- }
33
- function disposeState(token, key) {
34
- if (key) {
35
- Internal__namespace.disposeFromStore(token, key, Internal__namespace.IMPLICIT.STORE);
36
- } else {
37
- Internal__namespace.disposeFromStore(token, Internal__namespace.IMPLICIT.STORE);
38
- }
39
- }
40
- function getState(token, key) {
41
- if (key) {
42
- return Internal__namespace.getFromStore(
43
- token,
44
- key,
45
- Internal__namespace.IMPLICIT.STORE
46
- );
47
- }
48
- return Internal__namespace.getFromStore(token, Internal__namespace.IMPLICIT.STORE);
49
- }
50
-
51
- // src/logger.ts
52
- var LOG_LEVELS = [`info`, `warn`, `error`];
53
- var simpleLog = (logLevel) => (icon, denomination, tokenKey, message, ...rest) => {
54
- console[logLevel](
55
- `${icon} ${denomination} "${tokenKey}" ${message}`,
56
- ...rest
57
- );
58
- };
59
- var simpleLogger = {
60
- error: simpleLog(`error`),
61
- info: simpleLog(`info`),
62
- warn: simpleLog(`warn`)
63
- };
64
- var AtomIOLogger = class {
65
- constructor(logLevel, filter, logger = simpleLogger) {
66
- this.logLevel = logLevel;
67
- this.filter = filter;
68
- this.logger = logger;
69
- this.error = (...args) => {
70
- var _a, _b;
71
- if (((_b = (_a = this.filter) == null ? void 0 : _a.call(this, ...args)) != null ? _b : true) && this.logLevel !== null) {
72
- this.logger.error(...args);
73
- }
74
- };
75
- this.info = (...args) => {
76
- var _a, _b;
77
- if (((_b = (_a = this.filter) == null ? void 0 : _a.call(this, ...args)) != null ? _b : true) && this.logLevel === `info`) {
78
- this.logger.info(...args);
79
- }
80
- };
81
- this.warn = (...args) => {
82
- var _a, _b;
83
- if (((_b = (_a = this.filter) == null ? void 0 : _a.call(this, ...args)) != null ? _b : true) && this.logLevel !== `error` && this.logLevel !== null) {
84
- this.logger.warn(...args);
85
- }
86
- };
87
- }
88
- };
89
- function moleculeFamily(options) {
90
- return Internal.createMoleculeFamily(options, Internal.IMPLICIT.STORE);
91
- }
92
- function makeMolecule(context, family, key, ...params) {
93
- return Internal.makeMoleculeInStore(Internal.IMPLICIT.STORE, context, family, key, ...params);
94
- }
95
- function makeRootMolecule(key, store = Internal.IMPLICIT.STORE) {
96
- const molecule = new Internal.Molecule(void 0, key);
97
- store.molecules.set(json.stringifyJson(key), molecule);
98
- return {
99
- key,
100
- type: `molecule`
101
- };
102
- }
103
- function selector(options) {
104
- return Internal.createStandaloneSelector(options, Internal.IMPLICIT.STORE);
105
- }
106
- function selectorFamily(options) {
107
- return Internal.createSelectorFamily(options, Internal.IMPLICIT.STORE);
108
- }
109
- function setState(token, p1, p2) {
110
- if (p2) {
111
- Internal__namespace.setIntoStore(token, p1, p2, Internal__namespace.IMPLICIT.STORE);
112
- } else {
113
- Internal__namespace.setIntoStore(token, p1, Internal__namespace.IMPLICIT.STORE);
114
- }
115
- }
116
- var Silo = class {
117
- constructor(config, fromStore = null) {
118
- const s = new Internal.Store(config, fromStore);
119
- function _atom(options) {
120
- return Internal.createStandaloneAtom(options, s);
121
- }
122
- function _atomFamily(options) {
123
- return Internal.createAtomFamily(options, s);
124
- }
125
- this.store = s;
126
- this.atom = _atom;
127
- this.atomFamily = _atomFamily;
128
- this.selector = (options) => Internal.createStandaloneSelector(options, s);
129
- this.selectorFamily = (options) => Internal.createSelectorFamily(options, s);
130
- this.transaction = (options) => Internal.createTransaction(options, s);
131
- this.timeline = (options) => Internal.createTimeline(options, s);
132
- this.findState = (token, key) => Internal.findInStore(token, key, s);
133
- this.getState = (...params) => Internal.getFromStore(...params, s);
134
- this.setState = (...params) => {
135
- Internal.setIntoStore(...params, s);
136
- };
137
- this.disposeState = (...params) => {
138
- Internal.disposeFromStore(...params, s);
139
- };
140
- this.subscribe = (token, handler, key) => subscribe(token, handler, key, s);
141
- this.undo = (token) => {
142
- Internal.timeTravel(`undo`, token, s);
143
- };
144
- this.redo = (token) => {
145
- Internal.timeTravel(`redo`, token, s);
146
- };
147
- this.moleculeFamily = (...params) => {
148
- return Internal.createMoleculeFamily(...params, s);
149
- };
150
- this.makeMolecule = (...params) => {
151
- return Internal.makeMoleculeInStore(s, ...params);
152
- };
153
- }
154
- };
155
- function subscribe(token, handleUpdate, key = Internal.arbitrary(), store = Internal.IMPLICIT.STORE) {
156
- switch (token.type) {
157
- case `atom`:
158
- case `mutable_atom`:
159
- case `readonly_selector`:
160
- case `selector`:
161
- return Internal.subscribeToState(token, handleUpdate, key, store);
162
- case `transaction`:
163
- return Internal.subscribeToTransaction(token, handleUpdate, key, store);
164
- case `timeline`:
165
- return Internal.subscribeToTimeline(token, handleUpdate, key, store);
166
- }
167
- }
168
- var timeline = (options) => {
169
- return Internal.createTimeline(options, Internal.IMPLICIT.STORE);
170
- };
171
- var redo = (tl) => {
172
- Internal.timeTravel(`redo`, tl, Internal.IMPLICIT.STORE);
173
- };
174
- var undo = (tl) => {
175
- Internal.timeTravel(`undo`, tl, Internal.IMPLICIT.STORE);
176
- };
177
- function transaction(options) {
178
- return Internal.createTransaction(options, Internal.IMPLICIT.STORE);
179
- }
180
- function runTransaction(token, id = Internal.arbitrary()) {
181
- return Internal.actUponStore(token, id, Internal.IMPLICIT.STORE);
182
- }
183
-
184
- // src/validators.ts
185
- function isToken(knownToken, unknownToken) {
186
- return knownToken.key === unknownToken.key;
187
- }
188
- function belongsTo(family, unknownToken) {
189
- var _a;
190
- return family.key === ((_a = unknownToken.family) == null ? void 0 : _a.key);
191
- }
192
-
193
- exports.AtomIOLogger = AtomIOLogger;
194
- exports.LOG_LEVELS = LOG_LEVELS;
195
- exports.Silo = Silo;
196
- exports.atom = atom;
197
- exports.atomFamily = atomFamily;
198
- exports.belongsTo = belongsTo;
199
- exports.disposeState = disposeState;
200
- exports.getState = getState;
201
- exports.isToken = isToken;
202
- exports.makeMolecule = makeMolecule;
203
- exports.makeRootMolecule = makeRootMolecule;
204
- exports.moleculeFamily = moleculeFamily;
205
- exports.redo = redo;
206
- exports.runTransaction = runTransaction;
207
- exports.selector = selector;
208
- exports.selectorFamily = selectorFamily;
209
- exports.setState = setState;
210
- exports.simpleLog = simpleLog;
211
- exports.simpleLogger = simpleLogger;
212
- exports.subscribe = subscribe;
213
- exports.timeline = timeline;
214
- exports.transaction = transaction;
215
- exports.undo = undo;
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- var internal = require('atom.io/internal');
4
-
5
- // ephemeral/src/find-state.ts
6
- function findState(token, key) {
7
- const state = internal.findInStore(token, key, internal.IMPLICIT.STORE);
8
- return state;
9
- }
10
-
11
- exports.findState = findState;
@@ -1,388 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var utils = require('@typescript-eslint/utils');
6
-
7
- var __defProp = Object.defineProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
-
13
- // eslint-plugin/src/rules/index.ts
14
- var rules_exports = {};
15
- __export(rules_exports, {
16
- explicitStateTypes: () => explicitStateTypes,
17
- lifespan: () => lifespan,
18
- synchronousSelectorDependencies: () => synchronousSelectorDependencies
19
- });
20
- var createRule = utils.ESLintUtils.RuleCreator(
21
- (name) => `https://atom.io.fyi/docs/eslint-plugin#${name}`
22
- );
23
- var STATE_FUNCTIONS = [`atom`, `atomFamily`, `selector`, `selectorFamily`];
24
- var explicitStateTypes = createRule({
25
- name: `explicit-state-types`,
26
- meta: {
27
- type: `problem`,
28
- docs: {
29
- description: `State declarations must have generic type arguments directly passed to them`
30
- },
31
- messages: {
32
- noTypeArgument: `State declarations must have generic type arguments directly passed to them.`
33
- },
34
- schema: []
35
- // no options
36
- },
37
- defaultOptions: [],
38
- create(context) {
39
- return {
40
- CallExpression(node) {
41
- const { callee } = node;
42
- switch (callee.type) {
43
- case `Identifier`: {
44
- if (STATE_FUNCTIONS.includes(callee.name)) {
45
- if (!node.typeArguments) {
46
- context.report({
47
- node,
48
- messageId: `noTypeArgument`
49
- });
50
- }
51
- }
52
- break;
53
- }
54
- case `MemberExpression`: {
55
- if (callee.property.type === `Identifier` && STATE_FUNCTIONS.includes(callee.property.name)) {
56
- if (!node.typeArguments) {
57
- context.report({
58
- node,
59
- messageId: `noTypeArgument`
60
- });
61
- }
62
- }
63
- }
64
- }
65
- }
66
- };
67
- }
68
- });
69
-
70
- // eslint-plugin/src/walk.ts
71
- function walk(node, callback, depth = 0) {
72
- callback(node, depth);
73
- switch (node.type) {
74
- case `FunctionDeclaration`:
75
- case `FunctionExpression`:
76
- case `ArrowFunctionExpression`:
77
- for (const param of node.params) {
78
- walk(param, callback, depth + 1);
79
- }
80
- walk(node.body, callback, depth + 1);
81
- break;
82
- case `BlockStatement`:
83
- for (const statement of node.body) {
84
- walk(statement, callback, depth + 1);
85
- }
86
- break;
87
- case `IfStatement`:
88
- walk(node.test, callback, depth);
89
- walk(node.consequent, callback, depth);
90
- if (node.alternate) {
91
- walk(node.alternate, callback, depth);
92
- }
93
- break;
94
- case `SwitchStatement`:
95
- walk(node.discriminant, callback, depth + 1);
96
- for (const caseOrDefault of node.cases) {
97
- walk(caseOrDefault, callback, depth);
98
- }
99
- break;
100
- case `ReturnStatement`:
101
- if (node.argument) {
102
- walk(node.argument, callback, depth);
103
- }
104
- break;
105
- case `SwitchCase`:
106
- if (node.test) {
107
- walk(node.test, callback, depth);
108
- }
109
- for (const statement of node.consequent) {
110
- walk(statement, callback, depth);
111
- }
112
- break;
113
- case `VariableDeclaration`:
114
- for (const declaration of node.declarations) {
115
- walk(declaration, callback, depth);
116
- if (declaration.init) {
117
- walk(declaration.init, callback, depth);
118
- }
119
- }
120
- break;
121
- case `BinaryExpression`:
122
- walk(node.left, callback, depth);
123
- walk(node.right, callback, depth);
124
- break;
125
- case `MemberExpression`:
126
- walk(node.object, callback, depth);
127
- walk(node.property, callback, depth);
128
- break;
129
- case `CallExpression`:
130
- walk(node.callee, callback, depth);
131
- for (const argument of node.arguments) {
132
- walk(argument, callback, depth);
133
- }
134
- break;
135
- }
136
- }
137
-
138
- // eslint-plugin/src/rules/lifespan.ts
139
- var lifespan = {
140
- meta: {
141
- type: `problem`,
142
- docs: {
143
- description: `atom.io provides tools for short-lived (ephemeral) and long-lived (immortal) stores. This rule allows you to guard against unsafe usage of tools for the other type of store.`,
144
- category: `Possible Errors`,
145
- recommended: false,
146
- url: ``
147
- // URL to documentation page for this rule
148
- },
149
- schema: [
150
- {
151
- type: `string`,
152
- enum: [`ephemeral`, `immortal`],
153
- default: `ephemeral`
154
- }
155
- ]
156
- },
157
- create(context) {
158
- var _a;
159
- const storeLifespan = (_a = context.options[0]) != null ? _a : `ephemeral`;
160
- return {
161
- ImportDeclaration(node) {
162
- const importSource = node.source.value;
163
- if (!importSource.startsWith(`atom.io/`)) {
164
- return;
165
- }
166
- const [_, subPackageName] = importSource.split(`/`);
167
- if (storeLifespan === `immortal` && subPackageName === `ephemeral`) {
168
- context.report({
169
- node,
170
- message: `do not import from "${importSource}" in an ${storeLifespan} store`
171
- });
172
- }
173
- },
174
- CallExpression(node) {
175
- if (storeLifespan === `ephemeral`) {
176
- return;
177
- }
178
- const functionCallee = node.callee.type === `Identifier` ? node.callee : void 0;
179
- const methodCallee = node.callee.type === `MemberExpression` && node.callee.property.type === `Identifier` ? node.callee.property : void 0;
180
- const callee = functionCallee != null ? functionCallee : methodCallee;
181
- if (callee === void 0) {
182
- return;
183
- }
184
- if (callee.name === `findState`) {
185
- context.report({
186
- node,
187
- message: `do not use findState in an ${storeLifespan} store`
188
- });
189
- }
190
- const storeProcedures = [];
191
- if (callee.name === `selector` || callee.name === `selectorFamily` || callee.name === `transaction`) {
192
- if (node.arguments[0].type === `ObjectExpression`) {
193
- const argProperties = node.arguments[0].properties;
194
- switch (callee.name) {
195
- case `selector`:
196
- case `selectorFamily`:
197
- {
198
- const getAndSetProps = argProperties.filter(
199
- (prop) => {
200
- return `key` in prop && `name` in prop.key && (prop.key.name === `get` || prop.key.name === `set`);
201
- }
202
- );
203
- switch (callee.name) {
204
- case `selector`:
205
- {
206
- for (const prop of getAndSetProps) {
207
- if (prop.value.type === `FunctionExpression` || prop.value.type === `ArrowFunctionExpression`) {
208
- storeProcedures.push(prop.value);
209
- }
210
- }
211
- }
212
- break;
213
- case `selectorFamily`:
214
- {
215
- for (const prop of getAndSetProps) {
216
- const { value } = prop;
217
- if (value.type === `FunctionExpression` || value.type === `ArrowFunctionExpression`) {
218
- if (value.body.type === `BlockStatement`) {
219
- for (const statement of value.body.body) {
220
- if (statement.type === `ReturnStatement` && statement.argument && (statement.argument.type === `FunctionExpression` || statement.argument.type === `ArrowFunctionExpression`)) {
221
- storeProcedures.push(statement.argument);
222
- }
223
- }
224
- } else if (value.body.type === `FunctionExpression` || value.body.type === `ArrowFunctionExpression`) {
225
- storeProcedures.push(value.body);
226
- }
227
- }
228
- }
229
- }
230
- break;
231
- }
232
- }
233
- break;
234
- case `transaction`:
235
- {
236
- const doProp = argProperties.find(
237
- (prop) => {
238
- return `key` in prop && `name` in prop.key && prop.key.name === `do`;
239
- }
240
- );
241
- if (doProp) {
242
- if (doProp.value.type === `FunctionExpression` || doProp.value.type === `ArrowFunctionExpression`) {
243
- storeProcedures.push(doProp.value);
244
- }
245
- }
246
- }
247
- break;
248
- }
249
- }
250
- }
251
- for (const storeProcedure of storeProcedures) {
252
- const transactorsParam = storeProcedure.params[0];
253
- const nonDestructuredTransactorsName = transactorsParam && `name` in transactorsParam ? transactorsParam.name : void 0;
254
- walk(storeProcedure.body, (n) => {
255
- if (n.type === `CallExpression`) {
256
- let willReport = false;
257
- switch (n.callee.type) {
258
- case `MemberExpression`:
259
- if (n.callee.object.type === `Identifier` && n.callee.object.name === nonDestructuredTransactorsName && n.callee.property.type === `Identifier` && n.callee.property.name === `find`) {
260
- willReport = true;
261
- }
262
- break;
263
- case `Identifier`:
264
- if (n.callee.name === `find`) {
265
- willReport = true;
266
- }
267
- break;
268
- }
269
- if (willReport) {
270
- context.report({
271
- node: n,
272
- message: `Using find in a transactor is not allowed in an immortal store.`
273
- });
274
- }
275
- }
276
- });
277
- }
278
- }
279
- };
280
- }
281
- };
282
-
283
- // eslint-plugin/src/rules/synchronous-selector-dependencies.ts
284
- var synchronousSelectorDependencies = {
285
- meta: {
286
- type: `problem`,
287
- docs: {
288
- description: `disallow await before calling get on the parameter's get method inside selector`,
289
- category: `Possible Errors`,
290
- recommended: false,
291
- url: ``
292
- // URL to documentation page for this rule
293
- },
294
- schema: []
295
- // no options
296
- },
297
- create(context) {
298
- return {
299
- CallExpression(node) {
300
- let selectorComputation;
301
- if (`name` in node.callee && node.callee.name === `selectorFamily`) {
302
- if (node.arguments[0].type === `ObjectExpression`) {
303
- const selectorLookupProperty = node.arguments[0].properties.find(
304
- (prop) => {
305
- return `key` in prop && `name` in prop.key && prop.key.name === `get`;
306
- }
307
- );
308
- const selectorLookup = selectorLookupProperty == null ? void 0 : selectorLookupProperty.value;
309
- if ((selectorLookup == null ? void 0 : selectorLookup.type) === `FunctionExpression` || (selectorLookup == null ? void 0 : selectorLookup.type) === `ArrowFunctionExpression`) {
310
- if (selectorLookup.body.type === `BlockStatement`) {
311
- for (const statement of selectorLookup.body.body) {
312
- if (statement.type === `ReturnStatement` && statement.argument) {
313
- selectorComputation = statement.argument;
314
- }
315
- }
316
- } else if (selectorLookup.body.type === `FunctionExpression` || selectorLookup.body.type === `ArrowFunctionExpression`) {
317
- selectorComputation = selectorLookup.body;
318
- }
319
- }
320
- }
321
- }
322
- if (`name` in node.callee && node.callee.name === `selector`) {
323
- if (node.arguments[0].type === `ObjectExpression`) {
324
- const selectorComputationProperty = node.arguments[0].properties.find(
325
- (prop) => {
326
- return `key` in prop && `name` in prop.key && prop.key.name === `get`;
327
- }
328
- );
329
- selectorComputation = selectorComputationProperty == null ? void 0 : selectorComputationProperty.value;
330
- }
331
- }
332
- if ((selectorComputation == null ? void 0 : selectorComputation.type) === `FunctionExpression` || (selectorComputation == null ? void 0 : selectorComputation.type) === `ArrowFunctionExpression`) {
333
- const nonDestructuredTransactorsName = selectorComputation.params[0] && `name` in selectorComputation.params[0] ? selectorComputation.params[0].name : void 0;
334
- let awaited;
335
- let awaitNode;
336
- walk(selectorComputation, (n, depth) => {
337
- if (typeof awaited === `number`) {
338
- if (awaited > depth) {
339
- awaited = void 0;
340
- awaitNode = void 0;
341
- }
342
- }
343
- switch (n.type) {
344
- case `AwaitExpression`:
345
- awaited = depth;
346
- awaitNode = n;
347
- break;
348
- case `CallExpression`:
349
- if (awaitNode) {
350
- let willReport = false;
351
- switch (n.callee.type) {
352
- case `MemberExpression`:
353
- if (n.callee.object.type === `Identifier` && n.callee.object.name === nonDestructuredTransactorsName && n.callee.property.type === `Identifier` && n.callee.property.name === `get`) {
354
- willReport = true;
355
- }
356
- break;
357
- case `Identifier`:
358
- if (n.callee.name === `get`) {
359
- willReport = true;
360
- }
361
- break;
362
- }
363
- if (willReport) {
364
- context.report({
365
- node: awaitNode,
366
- message: `Using await before calling the 'get' transactor is not allowed.`
367
- });
368
- }
369
- }
370
- }
371
- });
372
- }
373
- }
374
- };
375
- }
376
- };
377
-
378
- // eslint-plugin/src/index.ts
379
- var src_default = {
380
- rules: {
381
- "explicit-state-types": explicitStateTypes,
382
- lifespan,
383
- "synchronous-selector-dependencies": synchronousSelectorDependencies
384
- }
385
- };
386
-
387
- exports.Rules = rules_exports;
388
- exports.default = src_default;
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- var internal = require('atom.io/internal');
4
-
5
- // immortal/src/seek-state.ts
6
- function seekState(token, key) {
7
- if (token.type === `molecule_family`) {
8
- return internal.seekInStore(token, key, internal.IMPLICIT.STORE);
9
- }
10
- const state = internal.seekInStore(token, key, internal.IMPLICIT.STORE);
11
- return state;
12
- }
13
-
14
- exports.seekState = seekState;