@lowdefy/server-dev 4.0.0-alpha.7 → 4.0.0-alpha.8

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 (54) hide show
  1. package/package.json +27 -30
  2. package/src/components/App.js +0 -57
  3. package/src/components/Context.js +0 -62
  4. package/src/components/Head.js +0 -28
  5. package/src/components/LowdefyContext.js +0 -50
  6. package/src/components/Page.js +0 -54
  7. package/src/components/Reload.js +0 -43
  8. package/src/components/block/Block.js +0 -57
  9. package/src/components/block/CategorySwitch.js +0 -117
  10. package/src/components/block/Container.js +0 -86
  11. package/src/components/block/List.js +0 -93
  12. package/src/components/block/LoadingBlock.js +0 -22
  13. package/src/components/block/MountEvents.js +0 -46
  14. package/src/components/createComponents.js +0 -29
  15. package/src/components/createLinkComponent.js +0 -97
  16. package/src/manager/getContext.mjs +0 -79
  17. package/src/manager/processes/initialBuild.mjs +0 -27
  18. package/src/manager/processes/installPlugins.mjs +0 -36
  19. package/src/manager/processes/lowdefyBuild.mjs +0 -39
  20. package/src/manager/processes/nextBuild.mjs +0 -31
  21. package/src/manager/processes/readDotEnv.mjs +0 -28
  22. package/src/manager/processes/reloadClients.mjs +0 -26
  23. package/src/manager/processes/restartServer.mjs +0 -27
  24. package/src/manager/processes/shutdownServer.mjs +0 -35
  25. package/src/manager/processes/startNextServer.mjs +0 -45
  26. package/src/manager/processes/startServer.mjs +0 -31
  27. package/src/manager/processes/startWatchers.mjs +0 -31
  28. package/src/manager/run.mjs +0 -92
  29. package/src/manager/utils/BatchChanges.mjs +0 -67
  30. package/src/manager/utils/getLowdefyVersion.mjs +0 -51
  31. package/src/manager/utils/setupWatcher.mjs +0 -49
  32. package/src/manager/utils/spawnProcess.mjs +0 -55
  33. package/src/manager/watchers/envWatcher.mjs +0 -34
  34. package/src/manager/watchers/lowdefyBuildWatcher.mjs +0 -45
  35. package/src/manager/watchers/nextBuildWatcher.mjs +0 -93
  36. package/src/pages/404.js +0 -19
  37. package/src/pages/[pageId].js +0 -19
  38. package/src/pages/_app.js +0 -39
  39. package/src/pages/_document.js +0 -38
  40. package/src/pages/api/auth/[...nextauth].js +0 -28
  41. package/src/pages/api/page/[pageId].js +0 -29
  42. package/src/pages/api/ping.js +0 -19
  43. package/src/pages/api/reload.js +0 -50
  44. package/src/pages/api/request/[pageId]/[requestId].js +0 -45
  45. package/src/pages/api/root.js +0 -25
  46. package/src/pages/index.js +0 -19
  47. package/src/utils/callRequest.js +0 -27
  48. package/src/utils/request.js +0 -36
  49. package/src/utils/setPageId.js +0 -33
  50. package/src/utils/setupLink.js +0 -52
  51. package/src/utils/useMutateCache.js +0 -34
  52. package/src/utils/usePageConfig.js +0 -29
  53. package/src/utils/useRootConfig.js +0 -29
  54. package/src/utils/waitForRestartedServer.js +0 -32
@@ -1,31 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
- /* eslint-disable no-console */
17
-
18
- import startNextServer from './startNextServer.mjs';
19
-
20
- async function startServer(context) {
21
- return new Promise((resolve, reject) => {
22
- try {
23
- startNextServer(context);
24
- } catch (error) {
25
- console.log(error);
26
- reject(error);
27
- }
28
- });
29
- }
30
-
31
- export default startServer;
@@ -1,31 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import envWatcher from '../watchers/envWatcher.mjs';
18
- import lowdefyBuildWatcher from '../watchers/lowdefyBuildWatcher.mjs';
19
- import nextBuildWatcher from '../watchers/nextBuildWatcher.mjs';
20
-
21
- function startWatchers(context) {
22
- return async () => {
23
- await Promise.all([
24
- envWatcher(context),
25
- lowdefyBuildWatcher(context),
26
- nextBuildWatcher(context),
27
- ]);
28
- };
29
- }
30
-
31
- export default startWatchers;
@@ -1,92 +0,0 @@
1
- #!/usr/bin/env node
2
- /*
3
- Copyright 2020-2021 Lowdefy, Inc
4
-
5
- Licensed under the Apache License, Version 2.0 (the "License");
6
- you may not use this file except in compliance with the License.
7
- You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
16
- */
17
-
18
- import { wait } from '@lowdefy/helpers';
19
- import opener from 'opener';
20
- import getContext from './getContext.mjs';
21
- import startServer from './processes/startServer.mjs';
22
-
23
- /*
24
- The run script does the following:
25
- - Run the initial Lowdefy build, install plugins, and next build and read .env
26
- - Start file watchers to reload config and restart server if necessary
27
- - Start the server
28
- - Open a browser window.
29
-
30
- Three watchers are started:
31
-
32
- ## Lowdefy build watcher
33
- Watches:
34
- - <config-dir>,
35
- - <watch-dirs>
36
- - !<ignore-dirs>
37
- The Lowdefy build watcher watches the Lowdefy config files for changes
38
- and runs Lowdefy build when they change, and triggers a soft reload.
39
-
40
- If lowdefy version in lowdefy.yaml
41
- is changed, the server warns and exits.
42
-
43
- ## .env watcher
44
-
45
- If the .env file is changed, the new file is parsed, and the server restarted with the new env
46
- and the server hard reloads.
47
-
48
- ## Next build watcher
49
-
50
- The Next build watcher watches for any files where the app should be rebuilt and restarted.
51
- It watches:
52
- - <build-dir>/plugins/**
53
- - <build-dir>/config.json
54
- - <server-dir>/package.json
55
-
56
- If app theme or config changes:
57
- - <build-dir>/config.json changes, rebuild and restart server.
58
-
59
- If new plugin type in an existing plugin package is used:
60
- - <build-dir>/plugins/** changes, rebuild next and restart server.
61
-
62
- If new plugin type in a new plugin package is used:
63
- - <server-dir>/package.json changes, run npm install, rebuild next and restart server.
64
-
65
- # Reload mechanism
66
-
67
- The web client creates a Server Sent Events connection with the server on the /api/reload route.
68
- The server watches the <build-dir>/reload file, which is written every time the server should reload,
69
- and sends an event to the client to reload the config. The client then uses a SWR cache mutation to
70
- fetch the new config.
71
-
72
- If the server is restarted, the event stream is closed because the original server was shut down. The client starts
73
- pinging the /api/ping route, until it detects a new server has started, and then reloads the window.
74
- */
75
-
76
- async function run() {
77
- const context = await getContext();
78
- await context.initialBuild();
79
- await context.startWatchers();
80
- try {
81
- const serverPromise = startServer(context);
82
- await wait(800);
83
- opener(`http://localhost:${context.options.port}`);
84
- await serverPromise;
85
- } catch (error) {
86
- console.log(error);
87
- context.shutdownServer();
88
- throw error;
89
- }
90
- }
91
-
92
- run();
@@ -1,67 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
- /* eslint-disable no-console */
17
-
18
- class BatchChanges {
19
- constructor({ fn, minDelay }) {
20
- this._call = this._call.bind(this);
21
- this.args = [];
22
- this.delay = minDelay || 500;
23
- this.fn = fn;
24
- this.minDelay = minDelay || 500;
25
- this.repeat = false;
26
- this.running = false;
27
- }
28
-
29
- newChange(...args) {
30
- this.args.push(args);
31
- this.delay = this.minDelay;
32
- this._startTimer();
33
- }
34
-
35
- _startTimer() {
36
- if (this.timer) {
37
- clearTimeout(this.timer);
38
- }
39
- if (this.running) {
40
- this.repeat = true;
41
- } else {
42
- this.timer = setTimeout(this._call, this.delay);
43
- }
44
- }
45
-
46
- async _call() {
47
- this.running = true;
48
- try {
49
- const args = this.args;
50
- this.args = [];
51
- await this.fn(args);
52
- this.running = false;
53
- if (this.repeat) {
54
- this.repeat = false;
55
- this._call();
56
- }
57
- } catch (error) {
58
- this.running = false;
59
- console.error(error);
60
- this.delay *= 2;
61
- console.warn(`Retrying in ${this.delay / 1000}s.`);
62
- this._startTimer();
63
- }
64
- }
65
- }
66
-
67
- export default BatchChanges;
@@ -1,51 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import path from 'path';
18
- import { type } from '@lowdefy/helpers';
19
- import { readFile } from '@lowdefy/node-utils';
20
- import YAML from 'yaml';
21
-
22
- async function getLowdefyVersion(context) {
23
- let lowdefyYaml = await readFile(path.join(context.directories.config, 'lowdefy.yaml'));
24
- if (!lowdefyYaml) {
25
- lowdefyYaml = await readFile(path.join(context.directories.config, 'lowdefy.yml'));
26
- }
27
- if (!lowdefyYaml) {
28
- throw new Error(`Could not find "lowdefy.yaml" file.`);
29
- }
30
- let lowdefy;
31
- try {
32
- lowdefy = YAML.parse(lowdefyYaml);
33
- } catch (error) {
34
- throw new Error(`Could not parse "lowdefy.yaml" file. Received error ${error.message}.`);
35
- }
36
- if (!lowdefy.lowdefy) {
37
- throw new Error(
38
- `No version specified in "lowdefy.yaml" file. Specify a version in the "lowdefy" field.`
39
- );
40
- }
41
- if (!type.isString(lowdefy.lowdefy)) {
42
- throw new Error(
43
- `Version number specified in "lowdefy.yaml" file should be a string. Received ${JSON.stringify(
44
- lowdefy.lowdefy
45
- )}.`
46
- );
47
- }
48
- return lowdefy.lowdefy;
49
- }
50
-
51
- export default getLowdefyVersion;
@@ -1,49 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import chokidar from 'chokidar';
18
- import BatchChanges from './BatchChanges.mjs';
19
-
20
- function setupWatcher({
21
- callback,
22
- watchDotfiles = false,
23
- ignorePaths = [],
24
- watchPaths,
25
- minDelay = 500,
26
- }) {
27
- return new Promise((resolve) => {
28
- // const { watch = [], watchIgnore = [] } = context.options;
29
- // const resolvedWatchPaths = watch.map((pathName) => path.resolve(pathName));
30
-
31
- const batchChanges = new BatchChanges({ fn: callback, minDelay });
32
- const defaultIgnorePaths = watchDotfiles
33
- ? []
34
- : [
35
- /(^|[/\\])\../, // ignore dotfiles
36
- ];
37
- const configWatcher = chokidar.watch(watchPaths, {
38
- ignored: [...defaultIgnorePaths, ...ignorePaths],
39
- persistent: true,
40
- ignoreInitial: true,
41
- });
42
- configWatcher.on('add', (...args) => batchChanges.newChange(...args));
43
- configWatcher.on('change', (...args) => batchChanges.newChange(...args));
44
- configWatcher.on('unlink', (...args) => batchChanges.newChange(...args));
45
- configWatcher.on('ready', () => resolve());
46
- });
47
- }
48
-
49
- export default setupWatcher;
@@ -1,55 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import { spawn } from 'child_process';
18
-
19
- function spawnProcess({ logger, command, args, processOptions, silent }) {
20
- const process = spawn(command, args, processOptions);
21
-
22
- process.stdout.on('data', (data) => {
23
- if (!silent) {
24
- data
25
- .toString('utf8')
26
- .split('\n')
27
- .forEach((line) => {
28
- if (line) {
29
- logger.log(line);
30
- }
31
- });
32
- }
33
- });
34
-
35
- process.stderr.on('data', (data) => {
36
- if (!silent) {
37
- data
38
- .toString('utf8')
39
- .split('\n')
40
- .forEach((line) => {
41
- if (line) {
42
- logger.warn(line);
43
- }
44
- });
45
- }
46
- });
47
-
48
- process.on('error', (error) => {
49
- throw error;
50
- });
51
-
52
- return process;
53
- }
54
-
55
- export default spawnProcess;
@@ -1,34 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
- /* eslint-disable no-console */
17
-
18
- import path from 'path';
19
- import setupWatcher from '../utils/setupWatcher.mjs';
20
-
21
- function envWatcher(context) {
22
- const callback = async () => {
23
- console.warn('.env file changed.');
24
- await context.readDotEnv();
25
- context.restartServer();
26
- };
27
- return setupWatcher({
28
- callback,
29
- watchPaths: [path.join(context.directories.config, '.env')],
30
- watchDotfiles: true,
31
- });
32
- }
33
-
34
- export default envWatcher;
@@ -1,45 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
- /* eslint-disable no-console */
17
-
18
- import getLowdefyVersion from '../utils/getLowdefyVersion.mjs';
19
- import setupWatcher from '../utils/setupWatcher.mjs';
20
-
21
- function lowdefyBuildWatcher(context) {
22
- const callback = async (filePaths) => {
23
- const lowdefyYamlModified = filePaths
24
- .flat()
25
- .some((filePath) => filePath.includes('lowdefy.yaml') || filePath.includes('lowdefy.yml'));
26
- if (lowdefyYamlModified) {
27
- const lowdefyVersion = await getLowdefyVersion(context);
28
- if (lowdefyVersion !== context.version && lowdefyVersion !== 'local') {
29
- context.shutdownServer();
30
- console.warn('Lowdefy version changed. You should restart your development server.');
31
- process.exit();
32
- }
33
- }
34
-
35
- await context.lowdefyBuild();
36
- context.reloadClients();
37
- };
38
- return setupWatcher({
39
- callback,
40
- ignorePaths: context.options.watchIgnore,
41
- watchPaths: [context.directories.config, ...context.options.watch],
42
- });
43
- }
44
-
45
- export default lowdefyBuildWatcher;
@@ -1,93 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
- /* eslint-disable no-console */
17
-
18
- import crypto from 'crypto';
19
- import path from 'path';
20
- import { readFile } from '@lowdefy/node-utils';
21
- import setupWatcher from '../utils/setupWatcher.mjs';
22
-
23
- const hashes = {};
24
-
25
- const watchedFiles = [
26
- 'build/config.json',
27
- 'build/plugins/blocks.js',
28
- 'build/plugins/connections.js',
29
- 'build/plugins/icons.js',
30
- 'build/plugins/operatorsClient.js',
31
- 'build/plugins/operatorsServer.js',
32
- 'build/plugins/styles.less',
33
- 'package.json',
34
- ];
35
-
36
- async function sha1(filePath) {
37
- const content = await readFile(filePath);
38
- return crypto
39
- .createHash('sha1')
40
- .update(content || '')
41
- .digest('hex');
42
- }
43
-
44
- async function nextBuildWatcher(context) {
45
- // Initialize hashes so that app does not rebuild the first time
46
- // Lowdefy build is run.
47
- await Promise.all(
48
- watchedFiles.map(async (filePath) => {
49
- const fullPath = path.resolve(context.directories.server, filePath);
50
- hashes[fullPath] = await sha1(fullPath);
51
- })
52
- );
53
-
54
- const callback = async (filePaths) => {
55
- let install = false;
56
- let build = false;
57
- await Promise.all(
58
- filePaths.flat().map(async (filePath) => {
59
- const hash = await sha1(filePath);
60
- if (hashes[filePath] === hash) {
61
- return;
62
- }
63
- build = true;
64
- if (filePath.endsWith('package.json')) {
65
- install = true;
66
- }
67
- hashes[filePath] = hash;
68
- })
69
- );
70
-
71
- if (!build) {
72
- return;
73
- }
74
-
75
- context.shutdownServer();
76
- if (install) {
77
- await context.installPlugins();
78
- }
79
- await context.nextBuild();
80
- context.restartServer();
81
- };
82
-
83
- return setupWatcher({
84
- callback,
85
- watchPaths: [
86
- path.join(context.directories.build, 'plugins'),
87
- path.join(context.directories.build, 'config.json'),
88
- path.join(context.directories.server, 'package.json'),
89
- ],
90
- });
91
- }
92
-
93
- export default nextBuildWatcher;
package/src/pages/404.js DELETED
@@ -1,19 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import App from '../components/App.js';
18
-
19
- export default App;
@@ -1,19 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import App from '../components/App.js';
18
-
19
- export default App;
package/src/pages/_app.js DELETED
@@ -1,39 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import React, { Suspense } from 'react';
18
-
19
- import { ErrorBoundary } from '@lowdefy/block-utils';
20
-
21
- import LowdefyContext from '../components/LowdefyContext.js';
22
-
23
- import '../../build/plugins/styles.less';
24
-
25
- const lowdefy = {};
26
-
27
- function App({ Component, pageProps }) {
28
- return (
29
- <ErrorBoundary>
30
- <Suspense>
31
- <LowdefyContext lowdefy={lowdefy}>
32
- <Component lowdefy={lowdefy} {...pageProps} />
33
- </LowdefyContext>
34
- </Suspense>
35
- </ErrorBoundary>
36
- );
37
- }
38
-
39
- export default App;
@@ -1,38 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import React from 'react';
18
- import Document, { Html, Head, Main, NextScript } from 'next/document';
19
-
20
- class LowdefyDocument extends Document {
21
- render() {
22
- return (
23
- <Html>
24
- <Head>
25
- <link rel="manifest" href="/manifest.webmanifest" />
26
- <link rel="icon" type="image/svg+xml" href="/icon.svg" />
27
- <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
28
- </Head>
29
- <body>
30
- <Main />
31
- <NextScript />
32
- </body>
33
- </Html>
34
- );
35
- }
36
- }
37
-
38
- export default LowdefyDocument;