eddev 0.2.67-beta1 → 0.3.0-beta1

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 (185) hide show
  1. package/admin/components/ImageWell.d.ts +2 -2
  2. package/admin/components/ImageWell.js +51 -39
  3. package/admin/defineField.d.ts +2 -2
  4. package/admin/defineWidget.d.ts +1 -1
  5. package/admin/defineWidget.js +2 -2
  6. package/admin/index.js +1 -5
  7. package/admin/installFieldTypes.js +26 -26
  8. package/admin/runWidgets.js +28 -17
  9. package/admin/selectMedia.d.ts +2 -2
  10. package/admin/selectMedia.js +1 -1
  11. package/blocks/ContentBlocks.d.ts +6 -6
  12. package/blocks/ContentBlocks.js +66 -58
  13. package/blocks/ErrorBoundaryEditor.d.ts +1 -1
  14. package/blocks/ErrorBoundaryEditor.js +45 -16
  15. package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
  16. package/blocks/ErrorBoundaryFrontend.js +45 -16
  17. package/blocks/InspectorControls.d.ts +1 -1
  18. package/blocks/InspectorControls.js +3 -3
  19. package/blocks/blockAttributes.d.ts +2 -2
  20. package/blocks/blockAttributes.js +44 -24
  21. package/blocks/index.js +1 -5
  22. package/blocks/inlineEditing.d.ts +6 -6
  23. package/blocks/inlineEditing.js +55 -36
  24. package/blocks/installGutenbergHooks.js +68 -48
  25. package/build/babel/plugin-name-defined-components.js +16 -15
  26. package/build/build-favicon.js +62 -11
  27. package/build/clean.js +52 -5
  28. package/build/create-codegen-worker.js +33 -78
  29. package/build/create-serverless-dev-worker.js +39 -61
  30. package/build/create-webpack-worker.js +33 -65
  31. package/build/file-tree.d.ts +2 -2
  32. package/build/file-tree.js +12 -12
  33. package/build/get-webpack-config.js +395 -341
  34. package/build/graphql-codegen/graphql-codegen-files.js +25 -31
  35. package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
  36. package/build/graphql-codegen/graphql-codegen-queries.js +99 -102
  37. package/build/manifests/manifest-blocks.d.ts +1 -1
  38. package/build/manifests/manifest-blocks.js +29 -37
  39. package/build/manifests/manifest-fields.d.ts +1 -1
  40. package/build/manifests/manifest-fields.js +21 -23
  41. package/build/manifests/manifest-views.d.ts +1 -1
  42. package/build/manifests/manifest-views.js +25 -32
  43. package/build/manifests/manifest-widgets.d.ts +1 -1
  44. package/build/manifests/manifest-widgets.js +20 -22
  45. package/build/manifests/manifest.d.ts +2 -2
  46. package/build/manifests/manifest.js +94 -30
  47. package/build/reporter.d.ts +1 -1
  48. package/build/reporter.js +32 -29
  49. package/build/serverless/create-next-app.d.ts +1 -1
  50. package/build/serverless/create-next-app.js +467 -245
  51. package/build/state/codegen-state.d.ts +4 -4
  52. package/build/state/compiler-state.d.ts +5 -5
  53. package/build/state/serverless-state.d.ts +3 -3
  54. package/build/workers/codegen-worker-script.js +519 -393
  55. package/build/workers/serverless-worker-dev-script.js +4 -4
  56. package/build/workers/webpack-worker-script.js +156 -90
  57. package/cli/build.dev.d.ts +1 -1
  58. package/cli/build.dev.js +126 -79
  59. package/cli/build.prod.d.ts +1 -1
  60. package/cli/build.prod.js +98 -42
  61. package/cli/cli.js +28 -19
  62. package/cli/display/components/BundleDisplay.d.ts +1 -1
  63. package/cli/display/components/BundleDisplay.js +24 -13
  64. package/cli/display/components/CodegenDisplay.d.ts +1 -1
  65. package/cli/display/components/CodegenDisplay.js +25 -14
  66. package/cli/display/components/DevCLIDisplay.d.ts +2 -2
  67. package/cli/display/components/DevCLIDisplay.js +25 -14
  68. package/cli/display/components/Fullscreen.js +20 -9
  69. package/cli/display/components/ServerlessDisplay.d.ts +2 -2
  70. package/cli/display/components/ServerlessDisplay.js +26 -15
  71. package/cli/display/components/StatusIcon.d.ts +2 -2
  72. package/cli/display/components/StatusIcon.js +3 -3
  73. package/cli/preinstall.js +5 -4
  74. package/cli/setup.js +73 -25
  75. package/components/AdminBar.d.ts +1 -1
  76. package/components/AdminBar.js +3 -37
  77. package/components/BrowserRouter.d.ts +2 -2
  78. package/components/BrowserRouter.js +54 -41
  79. package/components/InlinePage.d.ts +2 -2
  80. package/components/InlinePage.js +29 -17
  81. package/components/NextRouter.d.ts +2 -2
  82. package/components/NextRouter.js +29 -20
  83. package/components/index.js +1 -5
  84. package/config/config-schema.d.ts +1 -1
  85. package/config/config-schema.js +1 -1
  86. package/config/create-schema-file.js +6 -6
  87. package/config/get-config.js +13 -10
  88. package/config/index.js +1 -5
  89. package/config/parse-config.js +1 -1
  90. package/config/print-zod-errors.js +3 -3
  91. package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -2
  92. package/dev-ui/components/BreakpointColumnHeader.js +18 -7
  93. package/dev-ui/components/BreakpointIndicator.d.ts +1 -1
  94. package/dev-ui/components/BreakpointIndicator.js +32 -25
  95. package/dev-ui/components/DevUI.d.ts +1 -1
  96. package/dev-ui/components/DevUI.js +13 -13
  97. package/dev-ui/components/Launcher.d.ts +2 -2
  98. package/dev-ui/components/Launcher.js +25 -13
  99. package/dev-ui/components/PanelWrapper.d.ts +2 -2
  100. package/dev-ui/components/PanelWrapper.js +8 -8
  101. package/dev-ui/components/ResponsiveLerpControl.d.ts +2 -2
  102. package/dev-ui/components/ResponsiveLerpControl.js +38 -27
  103. package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -4
  104. package/dev-ui/components/ResponsiveScaleEditor.js +78 -64
  105. package/dev-ui/components/atoms/Button.js +1 -1
  106. package/dev-ui/components/atoms/Dropdown.d.ts +3 -3
  107. package/dev-ui/components/atoms/Dropdown.js +9 -8
  108. package/dev-ui/components/atoms/NumberField.d.ts +2 -2
  109. package/dev-ui/components/atoms/NumberField.js +42 -29
  110. package/dev-ui/components/atoms/Spacer.js +1 -1
  111. package/dev-ui/components/atoms/Text.js +1 -1
  112. package/dev-ui/components/atoms/ToggleButton.d.ts +2 -2
  113. package/dev-ui/components/atoms/ToggleButton.js +16 -5
  114. package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
  115. package/dev-ui/components/atoms/Tooltip.js +20 -8
  116. package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -1
  117. package/dev-ui/components/panels/AppDataDebugger.js +19 -8
  118. package/dev-ui/components/panels/ColorEditor.d.ts +1 -1
  119. package/dev-ui/components/panels/ColorEditor.js +42 -35
  120. package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -1
  121. package/dev-ui/components/panels/PageDataDebugger.js +20 -8
  122. package/dev-ui/components/panels/QueryDebugger.d.ts +1 -1
  123. package/dev-ui/components/panels/QueryDebugger.js +24 -12
  124. package/dev-ui/components/panels/SpacingEditor.d.ts +1 -1
  125. package/dev-ui/components/panels/SpacingEditor.js +48 -34
  126. package/dev-ui/components/panels/TypographyEditor.d.ts +1 -1
  127. package/dev-ui/components/panels/TypographyEditor.js +46 -38
  128. package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
  129. package/dev-ui/hooks/useBreakpoint.js +13 -13
  130. package/dev-ui/hooks/usePersistState.js +7 -6
  131. package/dev-ui/hooks/useStylesheet.js +6 -6
  132. package/dev-ui/icons.d.ts +15 -15
  133. package/dev-ui/icons.js +27 -16
  134. package/dev-ui/index.js +1 -5
  135. package/dev-ui/loader.d.ts +1 -1
  136. package/dev-ui/loader.js +9 -13
  137. package/dev-ui/panels.d.ts +2 -2
  138. package/dev-ui/panels.js +7 -7
  139. package/dev-ui/theme.js +3 -3
  140. package/dynamic/dynamic-component.js +1 -1
  141. package/dynamic/index.js +1 -5
  142. package/entry/Root.d.ts +2 -2
  143. package/entry/Root.js +26 -16
  144. package/entry/entry.admin.dev.js +4 -4
  145. package/entry/entry.admin.prod.js +4 -4
  146. package/entry/entry.monolith.dev.js +5 -5
  147. package/entry/entry.monolith.prod.js +5 -5
  148. package/gravityforms/gravity-forms.d.ts +2 -2
  149. package/gravityforms/index.js +1 -5
  150. package/gravityforms/useGravityForm.d.ts +2 -2
  151. package/gravityforms/useGravityForm.js +130 -126
  152. package/hooks/index.js +1 -5
  153. package/hooks/queryUtils.d.ts +14 -14
  154. package/hooks/queryUtils.js +192 -101
  155. package/hooks/useAppData.d.ts +2 -2
  156. package/hooks/useAppData.js +9 -9
  157. package/hooks/usePageLoad.js +4 -4
  158. package/hooks/useQueryDebug.d.ts +1 -1
  159. package/hooks/useQueryDebug.js +7 -7
  160. package/hooks/useRPC.d.ts +4 -4
  161. package/hooks/useRPC.js +3 -3
  162. package/package.json +11 -11
  163. package/routing/index.js +1 -5
  164. package/routing/remoteProps.d.ts +1 -1
  165. package/routing/remoteProps.js +72 -31
  166. package/routing/routing.d.ts +25 -15
  167. package/routing/routing.js +200 -112
  168. package/routing/updateEditLink.js +1 -1
  169. package/serverless/define-api.d.ts +1 -1
  170. package/serverless/define-rpc-router.js +4 -8
  171. package/serverless/index.js +2 -6
  172. package/style/createStitches.js +142 -164
  173. package/style/index.js +1 -5
  174. package/tsconfig.json +1 -1
  175. package/utils/Observable.d.ts +2 -2
  176. package/utils/Observable.js +15 -12
  177. package/utils/getRepoName.js +3 -3
  178. package/utils/promptIfRepoNameIncorrect.js +64 -18
  179. package/utils/refreshOverlayInterop.js +1 -1
  180. package/utils/reportErrorStack.d.ts +1 -1
  181. package/utils/reportErrorStack.js +1 -1
  182. package/utils/serverlessAppContext.js +1 -1
  183. package/utils/updateEnvFile.js +69 -19
  184. package/utils/useObservable.js +3 -3
  185. package/views/index.js +1 -5
@@ -1,115 +1,70 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.createCodegenWorker = void 0;
4
- const worker_threads_1 = require("worker_threads");
5
- const path_1 = require("path");
6
- const Observable_1 = require("../utils/Observable");
15
+ var worker_threads_1 = require("worker_threads");
16
+ var path_1 = require("path");
17
+ var Observable_1 = require("../utils/Observable");
7
18
  function createCodegenWorker(opts) {
8
- const worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "workers/codegen-worker-script.js"), {
19
+ var worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "workers/codegen-worker-script.js"), {
9
20
  workerData: opts,
10
21
  stderr: true,
11
22
  stdin: false,
12
23
  stdout: true,
13
- env: {
14
- ...process.env,
15
- FORCE_COLOR: "1",
16
- },
24
+ env: __assign(__assign({}, process.env), { FORCE_COLOR: "1" }),
17
25
  });
18
- worker.stderr.on("data", (chunk) => {
19
- subject.update((state) => ({
20
- ...state,
21
- log: (state.log || "") + chunk,
22
- }));
26
+ worker.stderr.on("data", function (chunk) {
27
+ subject.update(function (state) { return (__assign(__assign({}, state), { log: (state.log || "") + chunk })); });
23
28
  });
24
- worker.stdout.on("data", (chunk) => {
29
+ worker.stdout.on("data", function (chunk) {
25
30
  if (subject.value.status === "generating") {
26
- subject.update((state) => ({
27
- ...state,
28
- log: String(chunk),
29
- }));
31
+ subject.update(function (state) { return (__assign(__assign({}, state), { log: String(chunk) })); });
30
32
  }
31
33
  else {
32
- subject.update((state) => ({
33
- ...state,
34
- log: (state.log || "") + chunk,
35
- }));
34
+ subject.update(function (state) { return (__assign(__assign({}, state), { log: (state.log || "") + chunk })); });
36
35
  }
37
36
  });
38
- const subject = new Observable_1.Observable({
37
+ var subject = new Observable_1.Observable({
39
38
  title: "GraphQL Codegen",
40
39
  status: "ready",
41
40
  log: "",
42
41
  });
43
- worker.on("error", (err) => {
42
+ worker.on("error", function (err) {
44
43
  console.log(err);
45
- subject.update((state) => ({
46
- ...state,
47
- status: "error",
48
- }));
44
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "error" })); });
49
45
  });
50
- worker.on("message", (data) => {
46
+ worker.on("message", function (data) {
51
47
  if (data.code === "ready") {
52
- subject.update((state) => ({
53
- ...state,
54
- status: "ready",
55
- log: opts.retainLog ? state.log : "",
56
- duration: 0,
57
- errors: [],
58
- }));
48
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "ready", log: opts.retainLog ? state.log : "", duration: 0, errors: [] })); });
59
49
  }
60
50
  else if (data.code === "fetching") {
61
- subject.update((state) => ({
62
- ...state,
63
- status: "fetching",
64
- log: opts.retainLog ? state.log : "",
65
- duration: 0,
66
- errors: [],
67
- }));
51
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "fetching", log: opts.retainLog ? state.log : "", duration: 0, errors: [] })); });
68
52
  }
69
53
  else if (data.code === "generating") {
70
- subject.update((state) => ({
71
- ...state,
72
- status: "generating",
73
- errors: [],
74
- duration: 0,
75
- log: opts.retainLog ? state.log : "",
76
- }));
54
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "generating", errors: [], duration: 0, log: opts.retainLog ? state.log : "" })); });
77
55
  }
78
56
  else if (data.code === "error") {
79
- subject.update((state) => ({
80
- ...state,
81
- status: "error",
82
- statusLabel: "",
83
- duration: 0,
84
- reason: undefined,
85
- errors: data.errors,
86
- }));
57
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "error", statusLabel: "", duration: 0, reason: undefined, errors: data.errors })); });
87
58
  }
88
59
  else if (data.code === "success") {
89
- subject.update((state) => ({
90
- ...state,
91
- status: "success",
92
- duration: data.duration,
93
- reason: data.reason,
94
- errors: [],
95
- log: opts.retainLog ? state.log : "",
96
- }));
60
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "success", duration: data.duration, reason: data.reason, errors: [], log: opts.retainLog ? state.log : "" })); });
97
61
  }
98
62
  else if (data.code === "invalidated") {
99
- subject.update((state) => ({
100
- ...state,
101
- status: "invalidated",
102
- reason: data.reason,
103
- duration: 0,
104
- }));
63
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "invalidated", reason: data.reason, duration: 0 })); });
105
64
  }
106
65
  });
107
- worker.on("exit", () => {
108
- subject.update((state) => ({
109
- ...state,
110
- status: "success",
111
- log: opts.retainLog ? state.log : "",
112
- }));
66
+ worker.on("exit", function () {
67
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "success", log: opts.retainLog ? state.log : "" })); });
113
68
  });
114
69
  return subject;
115
70
  }
@@ -1,36 +1,44 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.createServerlessWorker = void 0;
4
- const worker_threads_1 = require("worker_threads");
5
- const path_1 = require("path");
6
- const Observable_1 = require("../utils/Observable");
15
+ var worker_threads_1 = require("worker_threads");
16
+ var path_1 = require("path");
17
+ var Observable_1 = require("../utils/Observable");
7
18
  function createServerlessWorker() {
8
- const worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "workers/serverless-worker-dev-script.js"), {
19
+ var worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "workers/serverless-worker-dev-script.js"), {
9
20
  workerData: {},
10
21
  stderr: true,
11
22
  stdin: false,
12
23
  stdout: true,
13
- env: {
14
- ...process.env,
15
- FORCE_COLOR: "1",
16
- },
24
+ env: __assign(__assign({}, process.env), { FORCE_COLOR: "1" }),
17
25
  });
18
- const subject = new Observable_1.Observable({
26
+ var subject = new Observable_1.Observable({
19
27
  title: "Serverless",
20
28
  status: "starting",
21
29
  log: "",
22
30
  });
23
- const parseChunk = (str) => {
24
- const escaped = JSON.stringify(str).replace(/(^"|"$)/g, "");
25
- let status;
26
- let duration = 0;
31
+ var parseChunk = function (str) {
32
+ var escaped = JSON.stringify(str).replace(/(^"|"$)/g, "");
33
+ var status;
34
+ var duration = 0;
27
35
  if (str.includes("\u001b[31merror\u001b[39m")) {
28
36
  status = "error";
29
37
  }
30
38
  else if (str.includes("\u001b[35mevent\u001b[39m") && str.includes("successfully")) {
31
39
  status = "success";
32
- const secondsMatch = str.match(/[0-9.]+s/);
33
- const msMatch = str.match(/[0-9.]+ ms/);
40
+ var secondsMatch = str.match(/[0-9.]+s/);
41
+ var msMatch = str.match(/[0-9.]+ ms/);
34
42
  if (secondsMatch) {
35
43
  duration = parseFloat(secondsMatch[0].replace("s", "")) * 1000;
36
44
  }
@@ -43,71 +51,41 @@ function createServerlessWorker() {
43
51
  }
44
52
  return {
45
53
  text: str,
46
- status,
47
- duration,
54
+ status: status,
55
+ duration: duration,
48
56
  };
49
57
  };
50
- const handleChunk = (chunk) => {
51
- const result = parseChunk(String(chunk));
52
- subject.update((state) => ({
53
- ...state,
54
- log: (state.log || "") + result.text,
55
- status: result.status ? result.status : state.status,
56
- duration: result.status === "success" ? result.duration : state.duration,
57
- }));
58
+ var handleChunk = function (chunk) {
59
+ var result = parseChunk(String(chunk));
60
+ subject.update(function (state) { return (__assign(__assign({}, state), { log: (state.log || "") + result.text, status: result.status ? result.status : state.status, duration: result.status === "success" ? result.duration : state.duration })); });
58
61
  };
59
62
  worker.stderr.on("data", handleChunk);
60
63
  worker.stdout.on("data", handleChunk);
61
- worker.on("error", (err) => {
64
+ worker.on("error", function (err) {
62
65
  console.log(err);
63
- subject.update((state) => ({
64
- ...state,
65
- status: "error",
66
- }));
66
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "error" })); });
67
67
  });
68
- worker.on("exit", (code) => {
69
- subject.update((state) => ({
70
- ...state,
71
- status: "error",
72
- }));
68
+ worker.on("exit", function (code) {
69
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "error" })); });
73
70
  });
74
- worker.on("message", (data) => {
71
+ worker.on("message", function (data) {
75
72
  if (data.code === "preparing") {
76
- subject.update((state) => ({
77
- ...state,
78
- status: "preparing",
79
- }));
73
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "preparing" })); });
80
74
  }
81
75
  else if (data.code === "packaging") {
82
- subject.update((state) => ({
83
- ...state,
84
- status: "packaging",
85
- }));
76
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "packaging" })); });
86
77
  }
87
78
  else if (data.code === "compiling") {
88
- subject.update((state) => ({
89
- ...state,
90
- status: "compiling",
91
- }));
79
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "compiling" })); });
92
80
  }
93
81
  else if (data.code === "finished") {
94
- subject.update((state) => ({
95
- ...state,
96
- status: "success",
97
- duration: data.duration,
98
- }));
82
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "success", duration: data.duration })); });
99
83
  }
100
84
  else if (data.code === "error") {
101
- subject.update((state) => ({
102
- ...state,
103
- status: "error",
104
- }));
85
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "error" })); });
105
86
  }
106
87
  else if (data.code === "url") {
107
- subject.update((state) => ({
108
- ...state,
109
- url: data.url,
110
- }));
88
+ subject.update(function (state) { return (__assign(__assign({}, state), { url: data.url })); });
111
89
  }
112
90
  });
113
91
  // worker.on("exit", () => {
@@ -1,95 +1,63 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.createWebpackWorker = void 0;
4
- const worker_threads_1 = require("worker_threads");
5
- const path_1 = require("path");
6
- const Observable_1 = require("../utils/Observable");
15
+ var worker_threads_1 = require("worker_threads");
16
+ var path_1 = require("path");
17
+ var Observable_1 = require("../utils/Observable");
7
18
  function createWebpackWorker(opts) {
8
- const worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "workers/webpack-worker-script.js"), {
19
+ var worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "workers/webpack-worker-script.js"), {
9
20
  workerData: opts,
10
21
  stderr: true,
11
22
  stdin: false,
12
23
  stdout: true,
13
- env: {
14
- ...process.env,
15
- FORCE_COLOR: "1",
16
- },
24
+ env: __assign(__assign({}, process.env), { FORCE_COLOR: "1" }),
17
25
  });
18
- worker.stderr.on("data", (chunk) => {
19
- subject.update((state) => ({
20
- ...state,
21
- log: (state.log || "") + chunk,
22
- }));
26
+ worker.stderr.on("data", function (chunk) {
27
+ subject.update(function (state) { return (__assign(__assign({}, state), { log: (state.log || "") + chunk })); });
23
28
  });
24
- worker.stdout.on("data", (chunk) => {
25
- const str = chunk.toString();
29
+ worker.stdout.on("data", function (chunk) {
30
+ var str = chunk.toString();
26
31
  if (str.includes("Project is running at") || str.includes("webpack output is served from")) {
27
32
  return;
28
33
  }
29
- subject.update((state) => ({
30
- ...state,
31
- log: (state.log || "") + str,
32
- }));
34
+ subject.update(function (state) { return (__assign(__assign({}, state), { log: (state.log || "") + str })); });
33
35
  });
34
- const subject = new Observable_1.Observable({
36
+ var subject = new Observable_1.Observable({
35
37
  title: opts.title,
36
38
  status: "starting",
37
39
  });
38
- worker.on("error", (err) => {
39
- subject.update((state) => ({
40
- ...state,
41
- status: "error",
42
- error: err,
43
- }));
40
+ worker.on("error", function (err) {
41
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "error", error: err })); });
44
42
  });
45
- worker.on("message", (data) => {
43
+ worker.on("message", function (data) {
46
44
  if (data.code === "compiling") {
47
- subject.update((state) => ({
48
- ...state,
49
- status: "compiling",
50
- statusLabel: state.status === "compiling" ? state.statusLabel : "",
51
- log: opts.retainLog ? state.log : "",
52
- duration: 0,
53
- errors: [],
54
- }));
45
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "compiling", statusLabel: state.status === "compiling" ? state.statusLabel : "", log: opts.retainLog ? state.log : "", duration: 0, errors: [] })); });
55
46
  }
56
47
  else if (data.code === "error") {
57
- subject.update((state) => ({
58
- ...state,
59
- status: "error",
60
- statusLabel: "",
61
- duration: 0,
62
- errors: data.errors,
63
- }));
48
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "error", statusLabel: "", duration: 0, errors: data.errors })); });
64
49
  }
65
50
  else if (data.code === "finished") {
66
- subject.update((state) => ({
67
- ...state,
68
- status: data.watching ? "waiting" : "success",
69
- statusLabel: "",
70
- duration: data.duration,
71
- log: opts.retainLog ? state.log : "",
72
- errors: data.errors,
73
- }));
51
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: data.watching ? "waiting" : "success", statusLabel: "", duration: data.duration, log: opts.retainLog ? state.log : "", errors: data.errors })); });
74
52
  }
75
53
  else if (data.code === "invalidated") {
76
- subject.update((state) => ({
77
- ...state,
78
- status: "compiling",
79
- statusLabel: data.changedFile
80
- ? `Rebuilding (${data.changedFile.replace(opts.baseDirectory, "")})`
81
- : "Rebuilding (changes detected)",
82
- log: opts.retainLog ? state.log : "",
83
- duration: 0,
84
- errors: [],
85
- }));
54
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "compiling", statusLabel: data.changedFile
55
+ ? "Rebuilding (".concat(data.changedFile.replace(opts.baseDirectory, ""), ")")
56
+ : "Rebuilding (changes detected)", log: opts.retainLog ? state.log : "", duration: 0, errors: [] })); });
86
57
  }
87
58
  });
88
- worker.on("exit", () => {
89
- subject.update((state) => ({
90
- ...state,
91
- status: "success",
92
- }));
59
+ worker.on("exit", function () {
60
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "success" })); });
93
61
  });
94
62
  return subject;
95
63
  }
@@ -1,5 +1,5 @@
1
- type FileList = string[];
2
- type Disposer = () => void;
1
+ declare type FileList = string[];
2
+ declare type Disposer = () => void;
3
3
  export declare function watchFileTree(pattern: string, callback: (files: FileList) => void): Promise<Disposer>;
4
4
  export declare function getFileTree(pattern: string): Promise<FileList>;
5
5
  export {};
@@ -4,35 +4,35 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getFileTree = exports.watchFileTree = void 0;
7
- const chokidar_1 = __importDefault(require("chokidar"));
8
- const glob_promise_1 = __importDefault(require("glob-promise"));
7
+ var chokidar_1 = __importDefault(require("chokidar"));
8
+ var glob_promise_1 = __importDefault(require("glob-promise"));
9
9
  function watchFileTree(pattern, callback) {
10
- const files = [];
11
- let ready = false;
12
- return new Promise((resolve) => {
10
+ var files = [];
11
+ var ready = false;
12
+ return new Promise(function (resolve) {
13
13
  // Watch, according
14
- const watcher = chokidar_1.default
14
+ var watcher = chokidar_1.default
15
15
  .watch(pattern)
16
- .on("add", (path) => {
16
+ .on("add", function (path) {
17
17
  files.push(path);
18
18
  if (ready)
19
19
  callback(files);
20
20
  })
21
- .on("unlink", (path) => {
22
- const i = files.indexOf(path);
21
+ .on("unlink", function (path) {
22
+ var i = files.indexOf(path);
23
23
  if (i !== -1)
24
24
  files.splice(i, 1);
25
25
  if (ready)
26
26
  callback(files);
27
27
  })
28
- .on("change", () => {
28
+ .on("change", function () {
29
29
  if (ready)
30
30
  callback(files);
31
31
  })
32
- .on("ready", () => {
32
+ .on("ready", function () {
33
33
  ready = true;
34
34
  callback(files);
35
- resolve(() => {
35
+ resolve(function () {
36
36
  watcher.close();
37
37
  });
38
38
  });