mosaic 1.0.1 → 1.0.4

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 (88) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -8
  3. package/cjs/attribute.js +90 -0
  4. package/cjs/constants.js +15 -0
  5. package/cjs/context.js +66 -0
  6. package/cjs/define.js +152 -0
  7. package/cjs/formControl.js +42 -0
  8. package/cjs/helpers.js +140 -0
  9. package/cjs/index.js +9 -0
  10. package/cjs/list.js +109 -0
  11. package/cjs/mergeSlots.js +37 -0
  12. package/cjs/proxy.js +42 -0
  13. package/cjs/render.js +395 -0
  14. package/cjs/token.js +63 -0
  15. package/cjs/update.js +128 -0
  16. package/dist/mosaic.js +1142 -0
  17. package/dist/mosaic.min.js +1 -0
  18. package/package.json +42 -25
  19. package/src/attribute.js +84 -0
  20. package/src/constants.js +5 -0
  21. package/src/context.js +60 -0
  22. package/src/define.js +158 -0
  23. package/src/formControl.js +36 -0
  24. package/src/helpers.js +123 -0
  25. package/src/index.js +1 -0
  26. package/src/list.js +100 -0
  27. package/src/mergeSlots.js +31 -0
  28. package/src/proxy.js +36 -0
  29. package/src/render.js +397 -0
  30. package/src/token.js +55 -0
  31. package/src/update.js +122 -0
  32. package/SCRATCH.md +0 -31
  33. package/cli.js +0 -17
  34. package/conf.json +0 -0
  35. package/docs/assets/css/main.css +0 -2638
  36. package/docs/assets/images/icons.png +0 -0
  37. package/docs/assets/images/icons@2x.png +0 -0
  38. package/docs/assets/images/widgets.png +0 -0
  39. package/docs/assets/images/widgets@2x.png +0 -0
  40. package/docs/assets/js/main.js +0 -248
  41. package/docs/assets/js/search.js +0 -1
  42. package/docs/index.html +0 -111
  43. package/docs/modules.html +0 -131
  44. package/example/components/x-drawer.html +0 -41
  45. package/example/mosaic/templates/mocha/index.html +0 -39
  46. package/example/mosaic/tests.d.ts +0 -13
  47. package/example/mosaic/tests.js +0 -28
  48. package/example/mosaic/website.d.ts +0 -31
  49. package/example/mosaic/website.js +0 -64
  50. package/example/mosaic.config.d.ts +0 -7
  51. package/example/mosaic.config.js +0 -8
  52. package/example/package-lock.json +0 -899
  53. package/example/package.json +0 -20
  54. package/example/pages/index.html +0 -12
  55. package/example/test/x-drawer.d.ts +0 -0
  56. package/example/test/x-drawer.js +0 -94
  57. package/index.d.ts +0 -85
  58. package/index.js +0 -122
  59. package/index.wdocs.js +0 -37
  60. package/out/fonts/OpenSans-Bold-webfont.eot +0 -0
  61. package/out/fonts/OpenSans-Bold-webfont.svg +0 -1830
  62. package/out/fonts/OpenSans-Bold-webfont.woff +0 -0
  63. package/out/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  64. package/out/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  65. package/out/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  66. package/out/fonts/OpenSans-Italic-webfont.eot +0 -0
  67. package/out/fonts/OpenSans-Italic-webfont.svg +0 -1830
  68. package/out/fonts/OpenSans-Italic-webfont.woff +0 -0
  69. package/out/fonts/OpenSans-Light-webfont.eot +0 -0
  70. package/out/fonts/OpenSans-Light-webfont.svg +0 -1831
  71. package/out/fonts/OpenSans-Light-webfont.woff +0 -0
  72. package/out/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  73. package/out/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  74. package/out/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  75. package/out/fonts/OpenSans-Regular-webfont.eot +0 -0
  76. package/out/fonts/OpenSans-Regular-webfont.svg +0 -1831
  77. package/out/fonts/OpenSans-Regular-webfont.woff +0 -0
  78. package/out/global.html +0 -912
  79. package/out/index.html +0 -65
  80. package/out/index.js.html +0 -239
  81. package/out/scripts/linenumber.js +0 -25
  82. package/out/scripts/prettify/Apache-License-2.0.txt +0 -202
  83. package/out/scripts/prettify/lang-css.js +0 -2
  84. package/out/scripts/prettify/prettify.js +0 -28
  85. package/out/styles/jsdoc-default.css +0 -358
  86. package/out/styles/prettify-jsdoc.css +0 -111
  87. package/out/styles/prettify-tomorrow.css +0 -132
  88. package/tsconfig.json +0 -11
@@ -0,0 +1,31 @@
1
+ const childNodes = (node) => {
2
+ let frag = document.createDocumentFragment()
3
+ while (node.firstChild) {
4
+ frag.appendChild(node.firstChild)
5
+ }
6
+ return frag
7
+ }
8
+
9
+ export const mergeSlots = (targetNode, sourceNode) => {
10
+ let namedSlots = sourceNode.querySelectorAll("slot[name]")
11
+
12
+ namedSlots.forEach((slot) => {
13
+ let name = slot.attributes.name.value
14
+ let node = targetNode.querySelector(`[slot="${name}"]`)
15
+ if (!node) {
16
+ slot.parentNode.replaceChild(childNodes(slot), slot)
17
+ return
18
+ }
19
+ node.removeAttribute("slot")
20
+ slot.parentNode.replaceChild(node, slot)
21
+ })
22
+
23
+ let defaultSlot = sourceNode.querySelector("slot:not([name])")
24
+
25
+ if (defaultSlot) {
26
+ defaultSlot.parentNode.replaceChild(
27
+ childNodes(targetNode.innerHTML.trim() ? targetNode : defaultSlot),
28
+ defaultSlot
29
+ )
30
+ }
31
+ }
package/src/proxy.js ADDED
@@ -0,0 +1,36 @@
1
+ import { typeOf } from "./helpers.js"
2
+
3
+ export const proxy = (root, callback) => {
4
+ let proxyCache = new WeakMap()
5
+
6
+ function createProxy(target, handler) {
7
+ let proxy = proxyCache.get(target)
8
+ if (proxy === undefined) {
9
+ proxy = new Proxy(target, handler)
10
+ proxyCache.set(target, proxy)
11
+ }
12
+ return proxy
13
+ }
14
+
15
+ const handler = {
16
+ get(target, property) {
17
+ if (["Object", "Array"].includes(typeOf(target[property]))) {
18
+ return createProxy(target[property], handler)
19
+ } else {
20
+ return Reflect.get(...arguments)
21
+ }
22
+ },
23
+ set(target, property, value) {
24
+ if (value === target[property]) return true
25
+
26
+ callback()
27
+ return Reflect.set(...arguments)
28
+ },
29
+ deleteProperty() {
30
+ callback()
31
+ return Reflect.deleteProperty(...arguments)
32
+ },
33
+ }
34
+
35
+ return new Proxy(root, handler)
36
+ }
package/src/render.js ADDED
@@ -0,0 +1,397 @@
1
+ import { TEXT, ATTRIBUTE, INPUT, EVENT, REPEAT } from "./constants.js"
2
+ import { updateFormControl } from "./formControl.js"
3
+ import {
4
+ debounce,
5
+ fragmentFromTemplate,
6
+ getValueAtPath,
7
+ last,
8
+ walk,
9
+ } from "./helpers.js"
10
+ import { compareKeyedLists, getBlocks, parseEach, updateList } from "./list.js"
11
+ import { getParts, getValueFromParts, hasMustache } from "./token.js"
12
+ import { applyAttribute } from "./attribute.js"
13
+ import { createContext } from "./context.js"
14
+
15
+ const HYDRATE_ATTR = "mosaic-hydrate"
16
+
17
+ export const render = (
18
+ target,
19
+ { getState, dispatch },
20
+ template,
21
+ updatedCallback,
22
+ beforeMountCallback
23
+ ) => {
24
+ let observer = () => {
25
+ let subscribers = new Set()
26
+ return {
27
+ publish: (cb) => {
28
+ for (let fn of subscribers) {
29
+ fn()
30
+ }
31
+ cb?.()
32
+ },
33
+ subscribe(fn) {
34
+ subscribers.add(fn)
35
+ },
36
+ }
37
+ }
38
+
39
+ const _ = (a, b) => (a === undefined ? b : a)
40
+
41
+ const createSubscription = {
42
+ [TEXT]: ({ value, node, context }, { getState }) => {
43
+ return {
44
+ handler: () => {
45
+ let state = context ? context.wrap(getState()) : getState()
46
+ let a = node.textContent
47
+ let b = getValueFromParts(state, getParts(value))
48
+ if (a !== b) node.textContent = b
49
+ },
50
+ }
51
+ },
52
+ [ATTRIBUTE]: ({ value, node, name, context }, { getState }) => {
53
+ return {
54
+ handler: () => {
55
+ let state = context ? context.wrap(getState()) : getState()
56
+ let b = getValueFromParts(state, getParts(value))
57
+
58
+ applyAttribute(node, name, b)
59
+
60
+ if (node.nodeName === "OPTION") {
61
+ let path = node.parentNode.getAttribute("name")
62
+ let selected = getValueAtPath(path, state)
63
+ node.selected = selected === b
64
+ }
65
+ },
66
+ }
67
+ },
68
+ [INPUT]: ({ node, path, context }, { getState, dispatch }) => {
69
+ node.addEventListener("input", () => {
70
+ let value =
71
+ node.getAttribute("type") === "checkbox" ? node.checked : node.value
72
+
73
+ if (value.trim?.().length && !isNaN(value)) value = +value
74
+
75
+ if (context) {
76
+ let state = context.wrap(getState())
77
+ state[path] = value
78
+ dispatch({
79
+ type: "MERGE",
80
+ payload: state,
81
+ })
82
+ } else {
83
+ dispatch({
84
+ type: "SET",
85
+ payload: {
86
+ name: path,
87
+ value,
88
+ context,
89
+ },
90
+ })
91
+ }
92
+ })
93
+
94
+ return {
95
+ handler: () => {
96
+ let state = context ? context.wrap(getState()) : getState()
97
+ updateFormControl(node, getValueAtPath(path, state))
98
+ },
99
+ }
100
+ },
101
+ [EVENT]: (
102
+ { node, eventType, actionType, context },
103
+ { dispatch, getState }
104
+ ) => {
105
+ /*
106
+
107
+ NB that context is only passed for local actions not prefixed with "$"
108
+
109
+ */
110
+
111
+ node.addEventListener(eventType, (event) => {
112
+ let isGlobal = actionType.startsWith("$")
113
+
114
+ let action = {
115
+ type: actionType,
116
+ event,
117
+ }
118
+
119
+ if (!isGlobal)
120
+ action.context = context ? context.wrap(getState()) : getState()
121
+
122
+ dispatch(action)
123
+
124
+ if (isGlobal) {
125
+ node.dispatchEvent(
126
+ new CustomEvent(actionType, {
127
+ detail: action,
128
+ bubbles: true,
129
+ })
130
+ )
131
+ }
132
+ })
133
+ return {
134
+ handler: () => {},
135
+ }
136
+ },
137
+ [REPEAT]: (
138
+ {
139
+ node,
140
+ context,
141
+ map,
142
+ path,
143
+ identifier,
144
+ index,
145
+ key,
146
+ blockIndex,
147
+ hydrate,
148
+ pickupNode,
149
+ },
150
+ { getState }
151
+ ) => {
152
+ let oldValue
153
+ node.$t = blockIndex - 1
154
+
155
+ const initialiseBlock = (rootNode, i, k, exitNode) => {
156
+ walk(
157
+ rootNode,
158
+ multi(
159
+ (node) => {
160
+ if (node === exitNode) return false
161
+ },
162
+ bindAll(
163
+ map,
164
+ hydrate,
165
+ createContext(
166
+ (context?.get() || []).concat({
167
+ path,
168
+ identifier,
169
+ key,
170
+ index,
171
+ i,
172
+ k,
173
+ })
174
+ )
175
+ ),
176
+ (child) => (child.$t = blockIndex)
177
+ )
178
+ )
179
+ }
180
+
181
+ function firstChild(v) {
182
+ return (v.nodeType === v.DOCUMENT_FRAGMENT_NODE && v.firstChild) || v
183
+ }
184
+
185
+ const createListItem = (datum, i) => {
186
+ let k = datum[key]
187
+ let frag = fragmentFromTemplate(node)
188
+ initialiseBlock(firstChild(frag), i, k)
189
+ return frag
190
+ }
191
+
192
+ if (hydrate) {
193
+ let x = getValueAtPath(path, getState())
194
+ let blocks = getBlocks(node)
195
+
196
+ blocks.forEach((block, i) => {
197
+ let datum = x[i]
198
+ let k = datum?.[key]
199
+ initialiseBlock(block[0], i, k, last(block).nextSibling)
200
+ })
201
+
202
+ pickupNode = last(last(blocks)).nextSibling
203
+ }
204
+
205
+ return {
206
+ handler: () => {
207
+ let state = context ? context.wrap(getState()) : getState()
208
+
209
+ const newValue = Object.entries(getValueAtPath(path, state) || [])
210
+ const delta = compareKeyedLists(key, oldValue, newValue)
211
+
212
+ if (delta) {
213
+ updateList(node, delta, newValue, createListItem)
214
+ }
215
+ oldValue = newValue.slice(0)
216
+ },
217
+ pickupNode,
218
+ }
219
+ },
220
+ }
221
+
222
+ const mediator = () => {
223
+ const o = observer()
224
+ return {
225
+ bind(v) {
226
+ let s = createSubscription[v.type](v, { getState, dispatch })
227
+ o.subscribe(s.handler)
228
+ return s
229
+ },
230
+ // scheduleUpdate: debounce((state, cb) => {
231
+ // return o.publish(state, cb)
232
+ // }),
233
+ update(cb) {
234
+ return o.publish(cb)
235
+ },
236
+ }
237
+ }
238
+
239
+ const { bind, update } = mediator()
240
+
241
+ let blockCount = 0
242
+
243
+ const parse = (frag) => {
244
+ let index = 0
245
+ let map = {}
246
+
247
+ walk(frag, (node) => {
248
+ let x = []
249
+ let pickupNode
250
+ switch (node.nodeType) {
251
+ case node.TEXT_NODE: {
252
+ let value = node.textContent
253
+ if (hasMustache(value)) {
254
+ x.push({
255
+ type: TEXT,
256
+ value,
257
+ })
258
+ }
259
+ break
260
+ }
261
+ case node.ELEMENT_NODE: {
262
+ let each = parseEach(node)
263
+
264
+ if (each) {
265
+ let ns = node.namespaceURI
266
+ let m
267
+
268
+ if (ns.endsWith("/svg")) {
269
+ node.removeAttribute("each")
270
+ let tpl = document.createElementNS(ns, "defs")
271
+ tpl.innerHTML = node.outerHTML
272
+ node.parentNode.replaceChild(tpl, node)
273
+ node = tpl
274
+ m = parse(node.firstChild)
275
+ } else {
276
+ if (node.nodeName !== "TEMPLATE") {
277
+ node.removeAttribute("each")
278
+ let tpl = document.createElement("template")
279
+
280
+ tpl.innerHTML = node.outerHTML
281
+ node.parentNode.replaceChild(tpl, node)
282
+ node = tpl
283
+ }
284
+ m = parse(node.content.firstChild)
285
+ }
286
+
287
+ pickupNode = node.nextSibling
288
+
289
+ x.push({
290
+ type: REPEAT,
291
+ map: m,
292
+ blockIndex: blockCount++,
293
+ ...each,
294
+ pickupNode,
295
+ })
296
+
297
+ break
298
+ }
299
+
300
+ let attrs = node.attributes
301
+ let i = attrs.length
302
+ while (i--) {
303
+ let { name, value } = attrs[i]
304
+
305
+ if (
306
+ name === ":name" &&
307
+ value &&
308
+ (node.nodeName === "INPUT" ||
309
+ node.nodeName === "SELECT" ||
310
+ node.nodeName === "TEXTAREA")
311
+ ) {
312
+ x.push({
313
+ type: INPUT,
314
+ path: value,
315
+ })
316
+
317
+ node.removeAttribute(name)
318
+ node.setAttribute("name", value)
319
+ } else if (name.startsWith(":on")) {
320
+ node.removeAttribute(name)
321
+ let eventType = name.split(":on")[1]
322
+ x.push({
323
+ type: EVENT,
324
+ eventType,
325
+ actionType: value,
326
+ })
327
+ } else if (name.startsWith(":")) {
328
+ let prop = name.slice(1)
329
+
330
+ let v = value || prop
331
+
332
+ if (!v.includes("{{")) v = `{{${v}}}`
333
+
334
+ x.push({
335
+ type: ATTRIBUTE,
336
+ name: prop,
337
+ value: v,
338
+ })
339
+ node.removeAttribute(name)
340
+ }
341
+ }
342
+ }
343
+ }
344
+ if (x.length) map[index] = x
345
+ index++
346
+ return pickupNode
347
+ })
348
+
349
+ return map
350
+ }
351
+
352
+ const multi =
353
+ (...fns) =>
354
+ (...args) => {
355
+ for (let fn of fns) {
356
+ let v = fn(...args)
357
+ if (v === false) return false
358
+ }
359
+ }
360
+
361
+ const bindAll = (bMap, hydrate = 0, context) => {
362
+ let index = 0
363
+ return (node) => {
364
+ let k = index
365
+ let p
366
+ if (k in bMap) {
367
+ bMap[k].forEach((v) => {
368
+ let x = bind({
369
+ ...v,
370
+ node,
371
+ context,
372
+ hydrate,
373
+ })
374
+ p = x.pickupNode
375
+ })
376
+ node.$i = index
377
+ }
378
+ index++
379
+ return p
380
+ }
381
+ }
382
+
383
+ let frag = fragmentFromTemplate(template)
384
+ let map = parse(frag)
385
+ let hydrate = target.hasAttribute?.(HYDRATE_ATTR)
386
+ if (hydrate) {
387
+ walk(target, bindAll(map, 1))
388
+ } else {
389
+ walk(frag, bindAll(map))
390
+ beforeMountCallback?.(frag)
391
+ target.prepend(frag)
392
+ update()
393
+ target.setAttribute?.(HYDRATE_ATTR, 1)
394
+ }
395
+
396
+ return debounce(() => update(updatedCallback))
397
+ }
package/src/token.js ADDED
@@ -0,0 +1,55 @@
1
+ import { getValueAtPath } from "./helpers.js"
2
+
3
+ const VALUE = 1
4
+ const KEY = 2
5
+ const FUNCTION = 3
6
+
7
+ export const hasMustache = (v) => v.match(/({{[^{}]+}})/)
8
+
9
+ export const getParts = (value) =>
10
+ value
11
+ .trim()
12
+ .split(/({{[^{}]+}})/)
13
+ .filter((v) => v)
14
+ .map((value) => {
15
+ let match = value.match(/{{([^{}]+)}}/)
16
+
17
+ if (!match)
18
+ return {
19
+ type: VALUE,
20
+ value,
21
+ negated: false,
22
+ }
23
+
24
+ value = match[1].trim()
25
+ let negated = value.charAt(0) === "!"
26
+ if (negated) value = value.slice(1)
27
+
28
+ return {
29
+ type: KEY,
30
+ value,
31
+ negated,
32
+ }
33
+ })
34
+
35
+ export const getValueFromParts = (target, parts) => {
36
+ return parts.reduce((a, part) => {
37
+ let { type, value, negated } = part
38
+
39
+ let v
40
+
41
+ if (type === VALUE) v = value
42
+ if (type === KEY) {
43
+ v = getValueAtPath(value, target)
44
+ }
45
+ if (type === FUNCTION) {
46
+ let args = part.args.map((value) => getValueAtPath(value, target))
47
+
48
+ v = getValueAtPath(part.method, target)?.(...args)
49
+ }
50
+
51
+ if (negated) v = !v
52
+
53
+ return a || a === 0 ? a + v : v
54
+ }, "")
55
+ }
package/src/update.js ADDED
@@ -0,0 +1,122 @@
1
+ function systemReducer(state, action) {
2
+ switch (action.type) {
3
+ case "SET": {
4
+ const { name, value } = action.payload
5
+ return {
6
+ ...state,
7
+ [name]: value,
8
+ }
9
+ }
10
+ case "MERGE": {
11
+ return {
12
+ ...state,
13
+ ...action.payload,
14
+ }
15
+ }
16
+ }
17
+ }
18
+
19
+ /*
20
+
21
+ Notes
22
+
23
+ - any call to dispatch will immediately invoke the reducer
24
+ - any call to dispatch within middleware is also immediately processed
25
+ - SET and MERGE are not interceptable by middleware
26
+ - middleware functions are assumed to call next synchronously
27
+ - the render function (subscriber) is invoked once for every call to dispatch
28
+ - the render function is debounced
29
+
30
+ */
31
+
32
+ export function configure(
33
+ { update = {}, middleware = [], derivations = {}, initialState = {} },
34
+ node
35
+ ) {
36
+ let subscribers = []
37
+ let state
38
+ let updatedCallback = () => {}
39
+
40
+ function updateState(o) {
41
+ state = { ...o }
42
+ for (let k in derivations) {
43
+ state[k] = derivations[k](o)
44
+ }
45
+ }
46
+
47
+ updateState(initialState)
48
+
49
+ function getState() {
50
+ return { ...state }
51
+ }
52
+
53
+ function subscribe(fn) {
54
+ subscribers.push(fn)
55
+ }
56
+
57
+ function flush() {
58
+ subscribers.forEach((fn) => fn())
59
+ subscribers = []
60
+ }
61
+
62
+ function onUpdate(fn) {
63
+ updatedCallback = fn
64
+ }
65
+
66
+ function dispatch(action) {
67
+ const { type } = action
68
+ if (type === "SET" || type === "MERGE") {
69
+ updateState(systemReducer(getState(), action))
70
+ } else {
71
+ if (middleware.length) {
72
+ let mw = middleware.slice()
73
+
74
+ let next = (action) => {
75
+ if (mw.length) {
76
+ let x = mw.shift()
77
+
78
+ if (action.type in x) {
79
+ x[action.type](action, next, {
80
+ getState,
81
+ dispatch,
82
+ afterNextRender: subscribe,
83
+ })
84
+ } else {
85
+ next(action)
86
+ }
87
+ } else if (action.type in update) {
88
+ updateState(update[action.type](getState(), action))
89
+ }
90
+ }
91
+
92
+ let x = mw.shift()
93
+
94
+ if (type in x) {
95
+ x[type](action, next, {
96
+ getState,
97
+ dispatch,
98
+ afterNextRender: subscribe,
99
+ })
100
+ } else {
101
+ next(action)
102
+ }
103
+ } else if (type in update) {
104
+ updateState(update[type](getState(), action))
105
+ }
106
+ }
107
+ updatedCallback()
108
+ }
109
+
110
+ for (let actionName in update) {
111
+ if (actionName.startsWith("$")) {
112
+ node.addEventListener(actionName, ({ detail }) => dispatch(detail))
113
+ }
114
+ }
115
+
116
+ return {
117
+ dispatch,
118
+ getState,
119
+ onUpdate,
120
+ flush,
121
+ }
122
+ }
package/SCRATCH.md DELETED
@@ -1,31 +0,0 @@
1
- # SCRATCH (Mosaic)
2
-
3
- Realised yesterday that TS can try to work with JS but also
4
- has great support for JSDoc.
5
-
6
- The main reasoning for using TS i hear is generally
7
- intellisense (or equiv), however types without docs aren't
8
- really that useful.
9
-
10
- If TS can understand JS Doc comments, then potentially you
11
- can have a workflow where...
12
-
13
- - typings are taken from the doc comments and `tsc` is used
14
- to generate a declaration file.
15
- - the doc comments are used to generate....documentation!
16
-
17
- ## compatibility
18
-
19
- There are things that you can write in doc comments that TSC
20
- will understand but not JSDoc.
21
-
22
- This is also true in the other direction.
23
-
24
- There is a project tsdoc that is supposed to work with
25
- anything supported by TSC
26
-
27
- ## goals
28
-
29
- The goal is to have a single script that runs both tsc to
30
- generate a declaration file, and also generate beautiful
31
- docs, either with JSdoc, or TSdoc, I don't really care.
package/cli.js DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- import path from 'path';
3
-
4
- import mosaic from './index.js';
5
-
6
- const CWD = process.env.INIT_CWD || process.env.PWD;
7
-
8
- const [key] = process.argv.slice(2);
9
-
10
- const configure = (key) =>
11
- import(path.join(CWD, './mosaic.config.js'))
12
- .then((v) => v.default)
13
- .then((v) => (typeof v === 'function' ? v() : v))
14
- .then((v) => (key ? v[key] : v))
15
- .then(mosaic);
16
-
17
- configure(key);
package/conf.json DELETED
File without changes