create-microact-app 1.0.1

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 (213) hide show
  1. package/index.js +95 -0
  2. package/package.json +21 -0
  3. package/templates/vanilla/.github/workflows/deploy.yml +38 -0
  4. package/templates/vanilla/index.html +13 -0
  5. package/templates/vanilla/node_modules/.package-lock.json +207 -0
  6. package/templates/vanilla/node_modules/@esbuild/darwin-x64/README.md +3 -0
  7. package/templates/vanilla/node_modules/@esbuild/darwin-x64/bin/esbuild +0 -0
  8. package/templates/vanilla/node_modules/@esbuild/darwin-x64/package.json +17 -0
  9. package/templates/vanilla/node_modules/@monygroupcorp/microact/README.md +154 -0
  10. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.cjs.js +1749 -0
  11. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.cjs.js.map +1 -0
  12. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.esm.js +1743 -0
  13. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.esm.js.map +1 -0
  14. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.umd.js +2 -0
  15. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.umd.js.map +1 -0
  16. package/templates/vanilla/node_modules/@monygroupcorp/microact/example/index.html +13 -0
  17. package/templates/vanilla/node_modules/@monygroupcorp/microact/example/index.js +63 -0
  18. package/templates/vanilla/node_modules/@monygroupcorp/microact/package.json +38 -0
  19. package/templates/vanilla/node_modules/@monygroupcorp/microact/rollup.config.cjs +30 -0
  20. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/Component.js +831 -0
  21. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/DOMUpdater.js +320 -0
  22. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/EventBus.js +123 -0
  23. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/Router.js +253 -0
  24. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/UpdateScheduler.js +218 -0
  25. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/index.js +6 -0
  26. package/templates/vanilla/node_modules/esbuild/LICENSE.md +21 -0
  27. package/templates/vanilla/node_modules/esbuild/README.md +3 -0
  28. package/templates/vanilla/node_modules/esbuild/bin/esbuild +0 -0
  29. package/templates/vanilla/node_modules/esbuild/install.js +287 -0
  30. package/templates/vanilla/node_modules/esbuild/lib/main.d.ts +660 -0
  31. package/templates/vanilla/node_modules/esbuild/lib/main.js +2393 -0
  32. package/templates/vanilla/node_modules/esbuild/package.json +42 -0
  33. package/templates/vanilla/node_modules/nanoid/LICENSE +20 -0
  34. package/templates/vanilla/node_modules/nanoid/README.md +39 -0
  35. package/templates/vanilla/node_modules/nanoid/async/index.browser.cjs +69 -0
  36. package/templates/vanilla/node_modules/nanoid/async/index.browser.js +34 -0
  37. package/templates/vanilla/node_modules/nanoid/async/index.cjs +71 -0
  38. package/templates/vanilla/node_modules/nanoid/async/index.d.ts +56 -0
  39. package/templates/vanilla/node_modules/nanoid/async/index.js +35 -0
  40. package/templates/vanilla/node_modules/nanoid/async/index.native.js +26 -0
  41. package/templates/vanilla/node_modules/nanoid/async/package.json +12 -0
  42. package/templates/vanilla/node_modules/nanoid/bin/nanoid.cjs +55 -0
  43. package/templates/vanilla/node_modules/nanoid/index.browser.cjs +72 -0
  44. package/templates/vanilla/node_modules/nanoid/index.browser.js +34 -0
  45. package/templates/vanilla/node_modules/nanoid/index.cjs +85 -0
  46. package/templates/vanilla/node_modules/nanoid/index.d.cts +91 -0
  47. package/templates/vanilla/node_modules/nanoid/index.d.ts +91 -0
  48. package/templates/vanilla/node_modules/nanoid/index.js +45 -0
  49. package/templates/vanilla/node_modules/nanoid/nanoid.js +1 -0
  50. package/templates/vanilla/node_modules/nanoid/non-secure/index.cjs +34 -0
  51. package/templates/vanilla/node_modules/nanoid/non-secure/index.d.ts +33 -0
  52. package/templates/vanilla/node_modules/nanoid/non-secure/index.js +21 -0
  53. package/templates/vanilla/node_modules/nanoid/non-secure/package.json +6 -0
  54. package/templates/vanilla/node_modules/nanoid/package.json +89 -0
  55. package/templates/vanilla/node_modules/nanoid/url-alphabet/index.cjs +7 -0
  56. package/templates/vanilla/node_modules/nanoid/url-alphabet/index.js +3 -0
  57. package/templates/vanilla/node_modules/nanoid/url-alphabet/package.json +6 -0
  58. package/templates/vanilla/node_modules/picocolors/LICENSE +15 -0
  59. package/templates/vanilla/node_modules/picocolors/README.md +21 -0
  60. package/templates/vanilla/node_modules/picocolors/package.json +25 -0
  61. package/templates/vanilla/node_modules/picocolors/picocolors.browser.js +4 -0
  62. package/templates/vanilla/node_modules/picocolors/picocolors.d.ts +5 -0
  63. package/templates/vanilla/node_modules/picocolors/picocolors.js +75 -0
  64. package/templates/vanilla/node_modules/picocolors/types.d.ts +51 -0
  65. package/templates/vanilla/node_modules/postcss/LICENSE +20 -0
  66. package/templates/vanilla/node_modules/postcss/README.md +29 -0
  67. package/templates/vanilla/node_modules/postcss/lib/at-rule.d.ts +140 -0
  68. package/templates/vanilla/node_modules/postcss/lib/at-rule.js +25 -0
  69. package/templates/vanilla/node_modules/postcss/lib/comment.d.ts +68 -0
  70. package/templates/vanilla/node_modules/postcss/lib/comment.js +13 -0
  71. package/templates/vanilla/node_modules/postcss/lib/container.d.ts +483 -0
  72. package/templates/vanilla/node_modules/postcss/lib/container.js +447 -0
  73. package/templates/vanilla/node_modules/postcss/lib/css-syntax-error.d.ts +248 -0
  74. package/templates/vanilla/node_modules/postcss/lib/css-syntax-error.js +133 -0
  75. package/templates/vanilla/node_modules/postcss/lib/declaration.d.ts +151 -0
  76. package/templates/vanilla/node_modules/postcss/lib/declaration.js +24 -0
  77. package/templates/vanilla/node_modules/postcss/lib/document.d.ts +69 -0
  78. package/templates/vanilla/node_modules/postcss/lib/document.js +33 -0
  79. package/templates/vanilla/node_modules/postcss/lib/fromJSON.d.ts +9 -0
  80. package/templates/vanilla/node_modules/postcss/lib/fromJSON.js +54 -0
  81. package/templates/vanilla/node_modules/postcss/lib/input.d.ts +227 -0
  82. package/templates/vanilla/node_modules/postcss/lib/input.js +265 -0
  83. package/templates/vanilla/node_modules/postcss/lib/lazy-result.d.ts +190 -0
  84. package/templates/vanilla/node_modules/postcss/lib/lazy-result.js +550 -0
  85. package/templates/vanilla/node_modules/postcss/lib/list.d.ts +60 -0
  86. package/templates/vanilla/node_modules/postcss/lib/list.js +58 -0
  87. package/templates/vanilla/node_modules/postcss/lib/map-generator.js +368 -0
  88. package/templates/vanilla/node_modules/postcss/lib/no-work-result.d.ts +46 -0
  89. package/templates/vanilla/node_modules/postcss/lib/no-work-result.js +138 -0
  90. package/templates/vanilla/node_modules/postcss/lib/node.d.ts +556 -0
  91. package/templates/vanilla/node_modules/postcss/lib/node.js +449 -0
  92. package/templates/vanilla/node_modules/postcss/lib/parse.d.ts +9 -0
  93. package/templates/vanilla/node_modules/postcss/lib/parse.js +42 -0
  94. package/templates/vanilla/node_modules/postcss/lib/parser.js +611 -0
  95. package/templates/vanilla/node_modules/postcss/lib/postcss.d.mts +69 -0
  96. package/templates/vanilla/node_modules/postcss/lib/postcss.d.ts +458 -0
  97. package/templates/vanilla/node_modules/postcss/lib/postcss.js +101 -0
  98. package/templates/vanilla/node_modules/postcss/lib/postcss.mjs +30 -0
  99. package/templates/vanilla/node_modules/postcss/lib/previous-map.d.ts +81 -0
  100. package/templates/vanilla/node_modules/postcss/lib/previous-map.js +144 -0
  101. package/templates/vanilla/node_modules/postcss/lib/processor.d.ts +115 -0
  102. package/templates/vanilla/node_modules/postcss/lib/processor.js +67 -0
  103. package/templates/vanilla/node_modules/postcss/lib/result.d.ts +205 -0
  104. package/templates/vanilla/node_modules/postcss/lib/result.js +42 -0
  105. package/templates/vanilla/node_modules/postcss/lib/root.d.ts +87 -0
  106. package/templates/vanilla/node_modules/postcss/lib/root.js +61 -0
  107. package/templates/vanilla/node_modules/postcss/lib/rule.d.ts +126 -0
  108. package/templates/vanilla/node_modules/postcss/lib/rule.js +27 -0
  109. package/templates/vanilla/node_modules/postcss/lib/stringifier.d.ts +46 -0
  110. package/templates/vanilla/node_modules/postcss/lib/stringifier.js +353 -0
  111. package/templates/vanilla/node_modules/postcss/lib/stringify.d.ts +9 -0
  112. package/templates/vanilla/node_modules/postcss/lib/stringify.js +11 -0
  113. package/templates/vanilla/node_modules/postcss/lib/symbols.js +5 -0
  114. package/templates/vanilla/node_modules/postcss/lib/terminal-highlight.js +70 -0
  115. package/templates/vanilla/node_modules/postcss/lib/tokenize.js +266 -0
  116. package/templates/vanilla/node_modules/postcss/lib/warn-once.js +13 -0
  117. package/templates/vanilla/node_modules/postcss/lib/warning.d.ts +147 -0
  118. package/templates/vanilla/node_modules/postcss/lib/warning.js +37 -0
  119. package/templates/vanilla/node_modules/postcss/package.json +88 -0
  120. package/templates/vanilla/node_modules/rollup/LICENSE.md +695 -0
  121. package/templates/vanilla/node_modules/rollup/README.md +125 -0
  122. package/templates/vanilla/node_modules/rollup/dist/bin/rollup +1715 -0
  123. package/templates/vanilla/node_modules/rollup/dist/es/getLogFilter.js +64 -0
  124. package/templates/vanilla/node_modules/rollup/dist/es/package.json +1 -0
  125. package/templates/vanilla/node_modules/rollup/dist/es/rollup.js +17 -0
  126. package/templates/vanilla/node_modules/rollup/dist/es/shared/node-entry.js +27273 -0
  127. package/templates/vanilla/node_modules/rollup/dist/es/shared/watch.js +4857 -0
  128. package/templates/vanilla/node_modules/rollup/dist/getLogFilter.d.ts +5 -0
  129. package/templates/vanilla/node_modules/rollup/dist/getLogFilter.js +69 -0
  130. package/templates/vanilla/node_modules/rollup/dist/loadConfigFile.d.ts +20 -0
  131. package/templates/vanilla/node_modules/rollup/dist/loadConfigFile.js +29 -0
  132. package/templates/vanilla/node_modules/rollup/dist/rollup.d.ts +1012 -0
  133. package/templates/vanilla/node_modules/rollup/dist/rollup.js +31 -0
  134. package/templates/vanilla/node_modules/rollup/dist/shared/fsevents-importer.js +37 -0
  135. package/templates/vanilla/node_modules/rollup/dist/shared/index.js +4571 -0
  136. package/templates/vanilla/node_modules/rollup/dist/shared/loadConfigFile.js +546 -0
  137. package/templates/vanilla/node_modules/rollup/dist/shared/rollup.js +27351 -0
  138. package/templates/vanilla/node_modules/rollup/dist/shared/watch-cli.js +561 -0
  139. package/templates/vanilla/node_modules/rollup/dist/shared/watch-proxy.js +87 -0
  140. package/templates/vanilla/node_modules/rollup/dist/shared/watch.js +316 -0
  141. package/templates/vanilla/node_modules/rollup/package.json +181 -0
  142. package/templates/vanilla/node_modules/source-map-js/LICENSE +28 -0
  143. package/templates/vanilla/node_modules/source-map-js/README.md +765 -0
  144. package/templates/vanilla/node_modules/source-map-js/lib/array-set.js +121 -0
  145. package/templates/vanilla/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  146. package/templates/vanilla/node_modules/source-map-js/lib/base64.js +67 -0
  147. package/templates/vanilla/node_modules/source-map-js/lib/binary-search.js +111 -0
  148. package/templates/vanilla/node_modules/source-map-js/lib/mapping-list.js +79 -0
  149. package/templates/vanilla/node_modules/source-map-js/lib/quick-sort.js +132 -0
  150. package/templates/vanilla/node_modules/source-map-js/lib/source-map-consumer.d.ts +1 -0
  151. package/templates/vanilla/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  152. package/templates/vanilla/node_modules/source-map-js/lib/source-map-generator.d.ts +1 -0
  153. package/templates/vanilla/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  154. package/templates/vanilla/node_modules/source-map-js/lib/source-node.d.ts +1 -0
  155. package/templates/vanilla/node_modules/source-map-js/lib/source-node.js +413 -0
  156. package/templates/vanilla/node_modules/source-map-js/lib/util.js +594 -0
  157. package/templates/vanilla/node_modules/source-map-js/package.json +71 -0
  158. package/templates/vanilla/node_modules/source-map-js/source-map.d.ts +104 -0
  159. package/templates/vanilla/node_modules/source-map-js/source-map.js +8 -0
  160. package/templates/vanilla/node_modules/vite/LICENSE.md +3396 -0
  161. package/templates/vanilla/node_modules/vite/README.md +20 -0
  162. package/templates/vanilla/node_modules/vite/bin/openChrome.applescript +95 -0
  163. package/templates/vanilla/node_modules/vite/bin/vite.js +61 -0
  164. package/templates/vanilla/node_modules/vite/client.d.ts +281 -0
  165. package/templates/vanilla/node_modules/vite/dist/client/client.mjs +725 -0
  166. package/templates/vanilla/node_modules/vite/dist/client/client.mjs.map +1 -0
  167. package/templates/vanilla/node_modules/vite/dist/client/env.mjs +30 -0
  168. package/templates/vanilla/node_modules/vite/dist/client/env.mjs.map +1 -0
  169. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-7ec6f216.js +914 -0
  170. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-827b23df.js +66713 -0
  171. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-c423598f.js +561 -0
  172. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js +7930 -0
  173. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-f1e8587f.js +7646 -0
  174. package/templates/vanilla/node_modules/vite/dist/node/cli.js +929 -0
  175. package/templates/vanilla/node_modules/vite/dist/node/constants.js +130 -0
  176. package/templates/vanilla/node_modules/vite/dist/node/index.d.ts +3548 -0
  177. package/templates/vanilla/node_modules/vite/dist/node/index.js +158 -0
  178. package/templates/vanilla/node_modules/vite/dist/node-cjs/publicUtils.cjs +4555 -0
  179. package/templates/vanilla/node_modules/vite/index.cjs +34 -0
  180. package/templates/vanilla/node_modules/vite/package.json +173 -0
  181. package/templates/vanilla/node_modules/vite/types/customEvent.d.ts +35 -0
  182. package/templates/vanilla/node_modules/vite/types/hmrPayload.d.ts +61 -0
  183. package/templates/vanilla/node_modules/vite/types/hot.d.ts +32 -0
  184. package/templates/vanilla/node_modules/vite/types/importGlob.d.ts +97 -0
  185. package/templates/vanilla/node_modules/vite/types/importMeta.d.ts +26 -0
  186. package/templates/vanilla/node_modules/vite/types/metadata.d.ts +10 -0
  187. package/templates/vanilla/node_modules/vite/types/package.json +4 -0
  188. package/templates/vanilla/package-lock.json +589 -0
  189. package/templates/vanilla/package.json +17 -0
  190. package/templates/vanilla/src/components/App.js +60 -0
  191. package/templates/vanilla/src/components/Card.js +21 -0
  192. package/templates/vanilla/src/components/Hero.js +15 -0
  193. package/templates/vanilla/src/components/InteractiveDemo.js +59 -0
  194. package/templates/vanilla/src/main.js +9 -0
  195. package/templates/vanilla/src/style/main.css +172 -0
  196. package/templates/vanilla/vite.config.js +8 -0
  197. package/templates/web3/.env.example +15 -0
  198. package/templates/web3/.github/workflows/deploy.yml +38 -0
  199. package/templates/web3/README.md +33 -0
  200. package/templates/web3/contracts/foundry.toml +11 -0
  201. package/templates/web3/contracts/script/Deploy.s.sol +13 -0
  202. package/templates/web3/contracts/src/Counter.sol +21 -0
  203. package/templates/web3/index.html +13 -0
  204. package/templates/web3/package.json +25 -0
  205. package/templates/web3/scripts/chain-start.mjs +305 -0
  206. package/templates/web3/scripts/chain-stop.mjs +34 -0
  207. package/templates/web3/scripts/deploy.mjs +155 -0
  208. package/templates/web3/scripts/setup.mjs +42 -0
  209. package/templates/web3/src/components/App.js +49 -0
  210. package/templates/web3/src/components/CounterCard.js +111 -0
  211. package/templates/web3/src/main.js +54 -0
  212. package/templates/web3/src/style/main.css +345 -0
  213. package/templates/web3/vite.config.js +29 -0
@@ -0,0 +1,561 @@
1
+ /*
2
+ @license
3
+ Rollup.js v3.29.4
4
+ Sat, 21 Sep 2024 06:29:06 GMT - commit 2ef77c00ec2635d42697cff2c0567ccc8db34fb4
5
+
6
+ https://github.com/rollup/rollup
7
+
8
+ Released under the MIT License.
9
+ */
10
+ 'use strict';
11
+
12
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
13
+
14
+ const promises = require('node:fs/promises');
15
+ const process$2 = require('node:process');
16
+ const index = require('./index.js');
17
+ const cli = require('../bin/rollup');
18
+ const rollup = require('./rollup.js');
19
+ const loadConfigFile_js = require('./loadConfigFile.js');
20
+ const node_child_process = require('node:child_process');
21
+ const watchProxy = require('./watch-proxy.js');
22
+ require('fs');
23
+ require('util');
24
+ require('stream');
25
+ require('path');
26
+ require('os');
27
+ require('./fsevents-importer.js');
28
+ require('events');
29
+ require('node:path');
30
+ require('tty');
31
+ require('node:perf_hooks');
32
+ require('node:crypto');
33
+ require('node:url');
34
+ require('../getLogFilter.js');
35
+
36
+ function timeZone(date = new Date()) {
37
+ const offset = date.getTimezoneOffset();
38
+ const absOffset = Math.abs(offset);
39
+ const hours = Math.floor(absOffset / 60);
40
+ const minutes = absOffset % 60;
41
+ const minutesOut = minutes > 0 ? ':' + ('0' + minutes).slice(-2) : '';
42
+ return (offset < 0 ? '+' : '-') + hours + minutesOut;
43
+ }
44
+
45
+ function dateTime(options = {}) {
46
+ let {
47
+ date = new Date(),
48
+ local = true,
49
+ showTimeZone = false,
50
+ showMilliseconds = false
51
+ } = options;
52
+
53
+ if (local) {
54
+ // Offset the date so it will return the correct value when getting the ISO string.
55
+ date = new Date(date.getTime() - (date.getTimezoneOffset() * 60000));
56
+ }
57
+
58
+ let end = '';
59
+
60
+ if (showTimeZone) {
61
+ end = ' UTC' + (local ? timeZone(date) : '');
62
+ }
63
+
64
+ if (showMilliseconds && date.getUTCMilliseconds() > 0) {
65
+ end = ` ${date.getUTCMilliseconds()}ms${end}`;
66
+ }
67
+
68
+ return date
69
+ .toISOString()
70
+ .replace(/T/, ' ')
71
+ .replace(/\..+/, end);
72
+ }
73
+
74
+ /**
75
+ * This is not the set of all possible signals.
76
+ *
77
+ * It IS, however, the set of all signals that trigger
78
+ * an exit on either Linux or BSD systems. Linux is a
79
+ * superset of the signal names supported on BSD, and
80
+ * the unknown signals just fail to register, so we can
81
+ * catch that easily enough.
82
+ *
83
+ * Windows signals are a different set, since there are
84
+ * signals that terminate Windows processes, but don't
85
+ * terminate (or don't even exist) on Posix systems.
86
+ *
87
+ * Don't bother with SIGKILL. It's uncatchable, which
88
+ * means that we can't fire any callbacks anyway.
89
+ *
90
+ * If a user does happen to register a handler on a non-
91
+ * fatal signal like SIGWINCH or something, and then
92
+ * exit, it'll end up firing `process.emit('exit')`, so
93
+ * the handler will be fired anyway.
94
+ *
95
+ * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
96
+ * artificially, inherently leave the process in a
97
+ * state from which it is not safe to try and enter JS
98
+ * listeners.
99
+ */
100
+ const signals = [];
101
+ signals.push('SIGHUP', 'SIGINT', 'SIGTERM');
102
+ if (process.platform !== 'win32') {
103
+ signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT'
104
+ // should detect profiler and enable/disable accordingly.
105
+ // see #21
106
+ // 'SIGPROF'
107
+ );
108
+ }
109
+ if (process.platform === 'linux') {
110
+ signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT');
111
+ }
112
+
113
+ // Note: since nyc uses this module to output coverage, any lines
114
+ // that are in the direct sync flow of nyc's outputCoverage are
115
+ // ignored, since we can never get coverage for them.
116
+ // grab a reference to node's real process object right away
117
+ const processOk = (process) => !!process &&
118
+ typeof process === 'object' &&
119
+ typeof process.removeListener === 'function' &&
120
+ typeof process.emit === 'function' &&
121
+ typeof process.reallyExit === 'function' &&
122
+ typeof process.listeners === 'function' &&
123
+ typeof process.kill === 'function' &&
124
+ typeof process.pid === 'number' &&
125
+ typeof process.on === 'function';
126
+ const kExitEmitter = Symbol.for('signal-exit emitter');
127
+ const global = globalThis;
128
+ const ObjectDefineProperty = Object.defineProperty.bind(Object);
129
+ // teeny special purpose ee
130
+ class Emitter {
131
+ emitted = {
132
+ afterExit: false,
133
+ exit: false,
134
+ };
135
+ listeners = {
136
+ afterExit: [],
137
+ exit: [],
138
+ };
139
+ count = 0;
140
+ id = Math.random();
141
+ constructor() {
142
+ if (global[kExitEmitter]) {
143
+ return global[kExitEmitter];
144
+ }
145
+ ObjectDefineProperty(global, kExitEmitter, {
146
+ value: this,
147
+ writable: false,
148
+ enumerable: false,
149
+ configurable: false,
150
+ });
151
+ }
152
+ on(ev, fn) {
153
+ this.listeners[ev].push(fn);
154
+ }
155
+ removeListener(ev, fn) {
156
+ const list = this.listeners[ev];
157
+ const i = list.indexOf(fn);
158
+ /* c8 ignore start */
159
+ if (i === -1) {
160
+ return;
161
+ }
162
+ /* c8 ignore stop */
163
+ if (i === 0 && list.length === 1) {
164
+ list.length = 0;
165
+ }
166
+ else {
167
+ list.splice(i, 1);
168
+ }
169
+ }
170
+ emit(ev, code, signal) {
171
+ if (this.emitted[ev]) {
172
+ return false;
173
+ }
174
+ this.emitted[ev] = true;
175
+ let ret = false;
176
+ for (const fn of this.listeners[ev]) {
177
+ ret = fn(code, signal) === true || ret;
178
+ }
179
+ if (ev === 'exit') {
180
+ ret = this.emit('afterExit', code, signal) || ret;
181
+ }
182
+ return ret;
183
+ }
184
+ }
185
+ class SignalExitBase {
186
+ }
187
+ const signalExitWrap = (handler) => {
188
+ return {
189
+ onExit(cb, opts) {
190
+ return handler.onExit(cb, opts);
191
+ },
192
+ load() {
193
+ return handler.load();
194
+ },
195
+ unload() {
196
+ return handler.unload();
197
+ },
198
+ };
199
+ };
200
+ class SignalExitFallback extends SignalExitBase {
201
+ onExit() {
202
+ return () => { };
203
+ }
204
+ load() { }
205
+ unload() { }
206
+ }
207
+ class SignalExit extends SignalExitBase {
208
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
209
+ // so use a supported signal instead
210
+ /* c8 ignore start */
211
+ #hupSig = process$1.platform === 'win32' ? 'SIGINT' : 'SIGHUP';
212
+ /* c8 ignore stop */
213
+ #emitter = new Emitter();
214
+ #process;
215
+ #originalProcessEmit;
216
+ #originalProcessReallyExit;
217
+ #sigListeners = {};
218
+ #loaded = false;
219
+ constructor(process) {
220
+ super();
221
+ this.#process = process;
222
+ // { <signal>: <listener fn>, ... }
223
+ this.#sigListeners = {};
224
+ for (const sig of signals) {
225
+ this.#sigListeners[sig] = () => {
226
+ // If there are no other listeners, an exit is coming!
227
+ // Simplest way: remove us and then re-send the signal.
228
+ // We know that this will kill the process, so we can
229
+ // safely emit now.
230
+ const listeners = this.#process.listeners(sig);
231
+ let { count } = this.#emitter;
232
+ // This is a workaround for the fact that signal-exit v3 and signal
233
+ // exit v4 are not aware of each other, and each will attempt to let
234
+ // the other handle it, so neither of them do. To correct this, we
235
+ // detect if we're the only handler *except* for previous versions
236
+ // of signal-exit, and increment by the count of listeners it has
237
+ // created.
238
+ /* c8 ignore start */
239
+ const p = process;
240
+ if (typeof p.__signal_exit_emitter__ === 'object' &&
241
+ typeof p.__signal_exit_emitter__.count === 'number') {
242
+ count += p.__signal_exit_emitter__.count;
243
+ }
244
+ /* c8 ignore stop */
245
+ if (listeners.length === count) {
246
+ this.unload();
247
+ const ret = this.#emitter.emit('exit', null, sig);
248
+ /* c8 ignore start */
249
+ const s = sig === 'SIGHUP' ? this.#hupSig : sig;
250
+ if (!ret)
251
+ process.kill(process.pid, s);
252
+ /* c8 ignore stop */
253
+ }
254
+ };
255
+ }
256
+ this.#originalProcessReallyExit = process.reallyExit;
257
+ this.#originalProcessEmit = process.emit;
258
+ }
259
+ onExit(cb, opts) {
260
+ /* c8 ignore start */
261
+ if (!processOk(this.#process)) {
262
+ return () => { };
263
+ }
264
+ /* c8 ignore stop */
265
+ if (this.#loaded === false) {
266
+ this.load();
267
+ }
268
+ const ev = opts?.alwaysLast ? 'afterExit' : 'exit';
269
+ this.#emitter.on(ev, cb);
270
+ return () => {
271
+ this.#emitter.removeListener(ev, cb);
272
+ if (this.#emitter.listeners['exit'].length === 0 &&
273
+ this.#emitter.listeners['afterExit'].length === 0) {
274
+ this.unload();
275
+ }
276
+ };
277
+ }
278
+ load() {
279
+ if (this.#loaded) {
280
+ return;
281
+ }
282
+ this.#loaded = true;
283
+ // This is the number of onSignalExit's that are in play.
284
+ // It's important so that we can count the correct number of
285
+ // listeners on signals, and don't wait for the other one to
286
+ // handle it instead of us.
287
+ this.#emitter.count += 1;
288
+ for (const sig of signals) {
289
+ try {
290
+ const fn = this.#sigListeners[sig];
291
+ if (fn)
292
+ this.#process.on(sig, fn);
293
+ }
294
+ catch (_) { }
295
+ }
296
+ this.#process.emit = (ev, ...a) => {
297
+ return this.#processEmit(ev, ...a);
298
+ };
299
+ this.#process.reallyExit = (code) => {
300
+ return this.#processReallyExit(code);
301
+ };
302
+ }
303
+ unload() {
304
+ if (!this.#loaded) {
305
+ return;
306
+ }
307
+ this.#loaded = false;
308
+ signals.forEach(sig => {
309
+ const listener = this.#sigListeners[sig];
310
+ /* c8 ignore start */
311
+ if (!listener) {
312
+ throw new Error('Listener not defined for signal: ' + sig);
313
+ }
314
+ /* c8 ignore stop */
315
+ try {
316
+ this.#process.removeListener(sig, listener);
317
+ /* c8 ignore start */
318
+ }
319
+ catch (_) { }
320
+ /* c8 ignore stop */
321
+ });
322
+ this.#process.emit = this.#originalProcessEmit;
323
+ this.#process.reallyExit = this.#originalProcessReallyExit;
324
+ this.#emitter.count -= 1;
325
+ }
326
+ #processReallyExit(code) {
327
+ /* c8 ignore start */
328
+ if (!processOk(this.#process)) {
329
+ return 0;
330
+ }
331
+ this.#process.exitCode = code || 0;
332
+ /* c8 ignore stop */
333
+ this.#emitter.emit('exit', this.#process.exitCode, null);
334
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
335
+ }
336
+ #processEmit(ev, ...args) {
337
+ const og = this.#originalProcessEmit;
338
+ if (ev === 'exit' && processOk(this.#process)) {
339
+ if (typeof args[0] === 'number') {
340
+ this.#process.exitCode = args[0];
341
+ /* c8 ignore start */
342
+ }
343
+ /* c8 ignore start */
344
+ const ret = og.call(this.#process, ev, ...args);
345
+ /* c8 ignore start */
346
+ this.#emitter.emit('exit', this.#process.exitCode, null);
347
+ /* c8 ignore stop */
348
+ return ret;
349
+ }
350
+ else {
351
+ return og.call(this.#process, ev, ...args);
352
+ }
353
+ }
354
+ }
355
+ const process$1 = globalThis.process;
356
+ // wrap so that we call the method on the actual handler, without
357
+ // exporting it directly.
358
+ const {
359
+ /**
360
+ * Called when the process is exiting, whether via signal, explicit
361
+ * exit, or running out of stuff to do.
362
+ *
363
+ * If the global process object is not suitable for instrumentation,
364
+ * then this will be a no-op.
365
+ *
366
+ * Returns a function that may be used to unload signal-exit.
367
+ */
368
+ onExit,
369
+ /**
370
+ * Load the listeners. Likely you never need to call this, unless
371
+ * doing a rather deep integration with signal-exit functionality.
372
+ * Mostly exposed for the benefit of testing.
373
+ *
374
+ * @internal
375
+ */
376
+ load,
377
+ /**
378
+ * Unload the listeners. Likely you never need to call this, unless
379
+ * doing a rather deep integration with signal-exit functionality.
380
+ * Mostly exposed for the benefit of testing.
381
+ *
382
+ * @internal
383
+ */
384
+ unload, } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
385
+
386
+ const CLEAR_SCREEN = '\u001Bc';
387
+ function getResetScreen(configs, allowClearScreen) {
388
+ let clearScreen = allowClearScreen;
389
+ for (const config of configs) {
390
+ if (config.watch && config.watch.clearScreen === false) {
391
+ clearScreen = false;
392
+ }
393
+ }
394
+ if (clearScreen) {
395
+ return (heading) => rollup.stderr(CLEAR_SCREEN + heading);
396
+ }
397
+ let firstRun = true;
398
+ return (heading) => {
399
+ if (firstRun) {
400
+ rollup.stderr(heading);
401
+ firstRun = false;
402
+ }
403
+ };
404
+ }
405
+
406
+ function extractWatchHooks(command) {
407
+ if (!Array.isArray(command.watch))
408
+ return {};
409
+ return command.watch
410
+ .filter(value => typeof value === 'object')
411
+ .reduce((accumulator, keyValueOption) => ({ ...accumulator, ...keyValueOption }), {});
412
+ }
413
+ function createWatchHooks(command) {
414
+ const watchHooks = extractWatchHooks(command);
415
+ return function (hook) {
416
+ if (watchHooks[hook]) {
417
+ const cmd = watchHooks[hook];
418
+ if (!command.silent) {
419
+ rollup.stderr(rollup.cyan$1(`watch.${hook} ${rollup.bold(`$ ${cmd}`)}`));
420
+ }
421
+ try {
422
+ // !! important - use stderr for all writes from execSync
423
+ const stdio = [process.stdin, process.stderr, process.stderr];
424
+ node_child_process.execSync(cmd, { stdio: command.silent ? 'ignore' : stdio });
425
+ }
426
+ catch (error) {
427
+ rollup.stderr(error.message);
428
+ }
429
+ }
430
+ };
431
+ }
432
+
433
+ async function watch(command) {
434
+ process$2.env.ROLLUP_WATCH = 'true';
435
+ const isTTY = process$2.stderr.isTTY;
436
+ const silent = command.silent;
437
+ let watcher;
438
+ let configWatcher;
439
+ let resetScreen;
440
+ const configFile = command.config ? await cli.getConfigPath(command.config) : null;
441
+ const runWatchHook = createWatchHooks(command);
442
+ onExit(close);
443
+ process$2.on('uncaughtException', closeWithError);
444
+ if (!process$2.stdin.isTTY) {
445
+ process$2.stdin.on('end', close);
446
+ process$2.stdin.resume();
447
+ }
448
+ async function loadConfigFromFileAndTrack(configFile) {
449
+ let configFileData = null;
450
+ let configFileRevision = 0;
451
+ configWatcher = index.chokidar.watch(configFile).on('change', reloadConfigFile);
452
+ await reloadConfigFile();
453
+ async function reloadConfigFile() {
454
+ try {
455
+ const newConfigFileData = await promises.readFile(configFile, 'utf8');
456
+ if (newConfigFileData === configFileData) {
457
+ return;
458
+ }
459
+ configFileRevision++;
460
+ const currentConfigFileRevision = configFileRevision;
461
+ if (configFileData) {
462
+ rollup.stderr(`\nReloading updated config...`);
463
+ }
464
+ configFileData = newConfigFileData;
465
+ const { options, warnings } = await loadConfigFile_js.loadConfigFile(configFile, command, true);
466
+ if (currentConfigFileRevision !== configFileRevision) {
467
+ return;
468
+ }
469
+ if (watcher) {
470
+ await watcher.close();
471
+ }
472
+ start(options, warnings);
473
+ }
474
+ catch (error) {
475
+ rollup.handleError(error, true);
476
+ }
477
+ }
478
+ }
479
+ if (configFile) {
480
+ await loadConfigFromFileAndTrack(configFile);
481
+ }
482
+ else {
483
+ const { options, warnings } = await cli.loadConfigFromCommand(command, true);
484
+ await start(options, warnings);
485
+ }
486
+ async function start(configs, warnings) {
487
+ watcher = watchProxy.watch(configs);
488
+ watcher.on('event', event => {
489
+ switch (event.code) {
490
+ case 'ERROR': {
491
+ warnings.flush();
492
+ rollup.handleError(event.error, true);
493
+ runWatchHook('onError');
494
+ break;
495
+ }
496
+ case 'START': {
497
+ if (!silent) {
498
+ if (!resetScreen) {
499
+ resetScreen = getResetScreen(configs, isTTY);
500
+ }
501
+ resetScreen(rollup.underline(`rollup v${rollup.version}`));
502
+ }
503
+ runWatchHook('onStart');
504
+ break;
505
+ }
506
+ case 'BUNDLE_START': {
507
+ if (!silent) {
508
+ let input = event.input;
509
+ if (typeof input !== 'string') {
510
+ input = Array.isArray(input)
511
+ ? input.join(', ')
512
+ : Object.values(input).join(', ');
513
+ }
514
+ rollup.stderr(rollup.cyan$1(`bundles ${rollup.bold(input)} → ${rollup.bold(event.output.map(rollup.relativeId).join(', '))}...`));
515
+ }
516
+ runWatchHook('onBundleStart');
517
+ break;
518
+ }
519
+ case 'BUNDLE_END': {
520
+ warnings.flush();
521
+ if (!silent)
522
+ rollup.stderr(rollup.green(`created ${rollup.bold(event.output.map(rollup.relativeId).join(', '))} in ${rollup.bold(cli.prettyMilliseconds(event.duration))}`));
523
+ runWatchHook('onBundleEnd');
524
+ if (event.result && event.result.getTimings) {
525
+ cli.printTimings(event.result.getTimings());
526
+ }
527
+ break;
528
+ }
529
+ case 'END': {
530
+ runWatchHook('onEnd');
531
+ if (!silent && isTTY) {
532
+ rollup.stderr(`\n[${dateTime()}] waiting for changes...`);
533
+ }
534
+ }
535
+ }
536
+ if ('result' in event && event.result) {
537
+ event.result.close().catch(error => rollup.handleError(error, true));
538
+ }
539
+ });
540
+ }
541
+ async function close(code) {
542
+ process$2.removeListener('uncaughtException', closeWithError);
543
+ // removing a non-existent listener is a no-op
544
+ process$2.stdin.removeListener('end', close);
545
+ if (watcher)
546
+ await watcher.close();
547
+ if (configWatcher)
548
+ configWatcher.close();
549
+ if (code)
550
+ process$2.exit(code);
551
+ }
552
+ // return a promise that never resolves to keep the process running
553
+ return new Promise(() => { });
554
+ }
555
+ function closeWithError(error) {
556
+ error.name = `Uncaught ${error.name}`;
557
+ rollup.handleError(error);
558
+ }
559
+
560
+ exports.watch = watch;
561
+ //# sourceMappingURL=watch-cli.js.map
@@ -0,0 +1,87 @@
1
+ /*
2
+ @license
3
+ Rollup.js v3.29.4
4
+ Sat, 21 Sep 2024 06:29:06 GMT - commit 2ef77c00ec2635d42697cff2c0567ccc8db34fb4
5
+
6
+ https://github.com/rollup/rollup
7
+
8
+ Released under the MIT License.
9
+ */
10
+ 'use strict';
11
+
12
+ const rollup = require('./rollup.js');
13
+ const fseventsImporter = require('./fsevents-importer.js');
14
+
15
+ class WatchEmitter {
16
+ constructor() {
17
+ this.currentHandlers = Object.create(null);
18
+ this.persistentHandlers = Object.create(null);
19
+ }
20
+ // Will be overwritten by Rollup
21
+ async close() { }
22
+ emit(event, ...parameters) {
23
+ return Promise.all([...this.getCurrentHandlers(event), ...this.getPersistentHandlers(event)].map(handler => handler(...parameters)));
24
+ }
25
+ off(event, listener) {
26
+ const listeners = this.persistentHandlers[event];
27
+ if (listeners) {
28
+ // A hack stolen from "mitt": ">>> 0" does not change numbers >= 0, but -1
29
+ // (which would remove the last array element if used unchanged) is turned
30
+ // into max_int, which is outside the array and does not change anything.
31
+ listeners.splice(listeners.indexOf(listener) >>> 0, 1);
32
+ }
33
+ return this;
34
+ }
35
+ on(event, listener) {
36
+ this.getPersistentHandlers(event).push(listener);
37
+ return this;
38
+ }
39
+ onCurrentRun(event, listener) {
40
+ this.getCurrentHandlers(event).push(listener);
41
+ return this;
42
+ }
43
+ once(event, listener) {
44
+ const selfRemovingListener = (...parameters) => {
45
+ this.off(event, selfRemovingListener);
46
+ return listener(...parameters);
47
+ };
48
+ this.on(event, selfRemovingListener);
49
+ return this;
50
+ }
51
+ removeAllListeners() {
52
+ this.removeListenersForCurrentRun();
53
+ this.persistentHandlers = Object.create(null);
54
+ return this;
55
+ }
56
+ removeListenersForCurrentRun() {
57
+ this.currentHandlers = Object.create(null);
58
+ return this;
59
+ }
60
+ getCurrentHandlers(event) {
61
+ return this.currentHandlers[event] || (this.currentHandlers[event] = []);
62
+ }
63
+ getPersistentHandlers(event) {
64
+ return this.persistentHandlers[event] || (this.persistentHandlers[event] = []);
65
+ }
66
+ }
67
+
68
+ function watch(configs) {
69
+ const emitter = new WatchEmitter();
70
+ watchInternal(configs, emitter).catch(error => {
71
+ rollup.handleError(error);
72
+ });
73
+ return emitter;
74
+ }
75
+ async function watchInternal(configs, emitter) {
76
+ const optionsList = await Promise.all(rollup.ensureArray(configs).map(config => rollup.mergeOptions(config, true)));
77
+ const watchOptionsList = optionsList.filter(config => config.watch !== false);
78
+ if (watchOptionsList.length === 0) {
79
+ return rollup.error(rollup.logInvalidOption('watch', rollup.URL_WATCH, 'there must be at least one config where "watch" is not set to "false"'));
80
+ }
81
+ await fseventsImporter.loadFsEvents();
82
+ const { Watcher } = await Promise.resolve().then(() => require('./watch.js'));
83
+ new Watcher(watchOptionsList, emitter);
84
+ }
85
+
86
+ exports.watch = watch;
87
+ //# sourceMappingURL=watch-proxy.js.map