@lowdefy/build 0.0.0-alpha.7 → 0.0.0-experimental-20231123101256

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 (115) hide show
  1. package/LICENSE +201 -0
  2. package/dist/build/addDefaultPages/404.js +50 -0
  3. package/dist/build/addDefaultPages/addDefaultPages.js +43 -0
  4. package/dist/build/addKeys.js +90 -0
  5. package/dist/build/buildApp.js +40 -0
  6. package/dist/build/buildAuth/buildAuth.js +46 -0
  7. package/dist/build/buildAuth/buildAuthPlugins.js +71 -0
  8. package/dist/build/buildAuth/buildPageAuth.js +50 -0
  9. package/dist/build/buildAuth/getPageRoles.js +33 -0
  10. package/dist/build/buildAuth/getProtectedPages.js +28 -0
  11. package/dist/build/buildAuth/validateAuthConfig.js +64 -0
  12. package/dist/build/buildConnections.js +46 -0
  13. package/dist/build/buildImports/buildIconImports.js +90 -0
  14. package/dist/build/buildImports/buildImports.js +30 -0
  15. package/dist/build/buildImports/buildImportsDev.js +106 -0
  16. package/dist/build/buildImports/buildImportsProd.js +54 -0
  17. package/dist/build/buildImports/buildStyleImports.js +25 -0
  18. package/dist/build/buildImports/defaultIconsDev.js +584 -0
  19. package/dist/build/buildImports/defaultIconsProd.js +21 -0
  20. package/dist/build/buildMenu.js +118 -0
  21. package/dist/build/buildPages/buildBlock/buildBlock.js +35 -0
  22. package/dist/build/buildPages/buildBlock/buildEvents.js +76 -0
  23. package/dist/build/buildPages/buildBlock/buildRequests.js +51 -0
  24. package/dist/build/buildPages/buildBlock/buildSubBlocks.js +30 -0
  25. package/dist/build/buildPages/buildBlock/countBlockOperators.js +31 -0
  26. package/dist/build/buildPages/buildBlock/countBlockTypes.js +18 -0
  27. package/dist/build/buildPages/buildBlock/moveSkeletonBlocksToArea.js +35 -0
  28. package/dist/build/buildPages/buildBlock/moveSubBlocksToArea.js +25 -0
  29. package/dist/build/buildPages/buildBlock/setBlockId.js +20 -0
  30. package/dist/build/buildPages/buildBlock/validateBlock.js +38 -0
  31. package/dist/build/buildPages/buildPage.js +45 -0
  32. package/dist/build/buildPages/buildPages.js +31 -0
  33. package/dist/build/buildPages/buildTestPage.js +46 -0
  34. package/dist/build/buildRefs/buildRefs.js +32 -0
  35. package/dist/build/buildRefs/evaluateBuildOperators.js +34 -0
  36. package/dist/build/buildRefs/getConfigFile.js +28 -0
  37. package/dist/build/buildRefs/getKey.js +24 -0
  38. package/dist/build/buildRefs/getRefContent.js +44 -0
  39. package/dist/build/buildRefs/getRefPath.js +30 -0
  40. package/dist/build/buildRefs/getRefsFromFile.js +37 -0
  41. package/dist/build/buildRefs/getUserJavascriptFunction.js +25 -0
  42. package/dist/build/buildRefs/makeRefDefinition.js +37 -0
  43. package/dist/build/buildRefs/parseNunjucks.js +20 -0
  44. package/dist/build/buildRefs/parseRefContent.js +37 -0
  45. package/dist/build/buildRefs/populateRefs.js +43 -0
  46. package/dist/build/buildRefs/recursiveBuild.js +85 -0
  47. package/dist/build/buildRefs/runRefResolver.js +33 -0
  48. package/dist/build/buildRefs/runTransformer.js +30 -0
  49. package/dist/build/buildTypes.js +124 -0
  50. package/dist/build/cleanBuildDirectory.js +19 -0
  51. package/dist/build/copyPublicFolder.js +26 -0
  52. package/dist/build/testSchema.js +32 -0
  53. package/dist/build/updateServerPackageJson.js +45 -0
  54. package/dist/build/validateConfig.js +30 -0
  55. package/dist/build/writeApp.js +19 -0
  56. package/dist/build/writeAuth.js +19 -0
  57. package/dist/build/writeConfig.js +19 -0
  58. package/dist/build/writeConnections.js +26 -0
  59. package/dist/build/writeGlobal.js +25 -0
  60. package/dist/build/writeMaps.js +26 -0
  61. package/dist/build/writeMenus.js +22 -0
  62. package/dist/build/writePages.js +26 -0
  63. package/dist/build/writePluginImports/generateImportFile.js +31 -0
  64. package/dist/build/writePluginImports/writeActionImports.js +22 -0
  65. package/dist/build/writePluginImports/writeAuthImports.js +34 -0
  66. package/dist/build/writePluginImports/writeBlockImports.js +22 -0
  67. package/dist/build/writePluginImports/writeConnectionImports.js +22 -0
  68. package/dist/build/writePluginImports/writeIconImports.js +31 -0
  69. package/dist/build/writePluginImports/writeOperatorImports.js +26 -0
  70. package/dist/build/writePluginImports/writePluginImports.js +52 -0
  71. package/dist/build/writePluginImports/writeStyleImports.js +34 -0
  72. package/dist/build/writeRequests.js +32 -0
  73. package/dist/build/writeTypes.js +19 -0
  74. package/dist/createContext.js +58 -0
  75. package/dist/defaultTypesMap.js +2125 -0
  76. package/dist/index.js +149 -1
  77. package/dist/lowdefySchema.js +873 -0
  78. package/dist/scripts/generateDefaultTypes.js +91 -0
  79. package/dist/scripts/run.js +33 -0
  80. package/dist/test/buildRefs/testBuildRefsAsyncFunction.js +22 -0
  81. package/dist/test/buildRefs/testBuildRefsErrorResolver.js +18 -0
  82. package/dist/test/buildRefs/testBuildRefsNullResolver.js +19 -0
  83. package/dist/test/buildRefs/testBuildRefsParsingResolver.js +39 -0
  84. package/dist/test/buildRefs/testBuildRefsResolver.js +23 -0
  85. package/dist/test/buildRefs/testBuildRefsTransform.js +25 -0
  86. package/dist/test/buildRefs/testBuildRefsTransformIdentity.js +21 -0
  87. package/dist/test/testContext.js +56 -0
  88. package/dist/utils/countOperators.js +30 -0
  89. package/dist/utils/createCheckDuplicateId.js +31 -0
  90. package/dist/utils/createCounter.js +33 -0
  91. package/dist/utils/createPluginTypesMap.js +113 -0
  92. package/dist/utils/formatErrorMessage.js +56 -0
  93. package/dist/utils/makeId.js +23 -0
  94. package/dist/utils/readConfigFile.js +27 -0
  95. package/dist/utils/writeBuildArtifact.js +23 -0
  96. package/package.json +77 -36
  97. package/CHANGELOG.md +0 -61
  98. package/dist/116.index.js +0 -1
  99. package/dist/231.index.js +0 -1
  100. package/dist/270.index.js +0 -2
  101. package/dist/270.index.js.LICENSE.txt +0 -45
  102. package/dist/319.index.js +0 -1
  103. package/dist/377.index.js +0 -1
  104. package/dist/422.index.js +0 -1
  105. package/dist/449.index.js +0 -1
  106. package/dist/5.index.js +0 -2
  107. package/dist/5.index.js.LICENSE.txt +0 -1
  108. package/dist/564.index.js +0 -1
  109. package/dist/641.index.js +0 -1
  110. package/dist/655.index.js +0 -1
  111. package/dist/657.index.js +0 -1
  112. package/dist/747.index.js +0 -1
  113. package/dist/903.index.js +0 -1
  114. package/dist/904.index.js +0 -1
  115. package/dist/remoteEntry.js +0 -1
@@ -0,0 +1,64 @@
1
+ /* eslint-disable no-param-reassign */ /*
2
+ Copyright 2020-2023 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
+ */ import { type } from '@lowdefy/helpers';
16
+ import { validate } from '@lowdefy/ajv';
17
+ import lowdefySchema from '../../lowdefySchema.js';
18
+ async function validateAuthConfig({ components }) {
19
+ if (type.isNone(components.auth)) {
20
+ components.auth = {};
21
+ }
22
+ if (!type.isObject(components.auth)) {
23
+ throw new Error('lowdefy.auth is not an object.');
24
+ }
25
+ if (type.isNone(components.auth.authPages)) {
26
+ components.auth.authPages = {};
27
+ }
28
+ if (type.isNone(components.auth.pages)) {
29
+ components.auth.pages = {};
30
+ }
31
+ if (type.isNone(components.auth.pages.roles)) {
32
+ components.auth.pages.roles = {};
33
+ }
34
+ if (type.isNone(components.auth.callbacks)) {
35
+ components.auth.callbacks = [];
36
+ }
37
+ if (type.isNone(components.auth.events)) {
38
+ components.auth.events = [];
39
+ }
40
+ if (type.isNone(components.auth.providers)) {
41
+ components.auth.providers = [];
42
+ }
43
+ if (type.isNone(components.auth.session)) {
44
+ components.auth.session = {};
45
+ }
46
+ if (type.isNone(components.auth.theme)) {
47
+ components.auth.theme = {};
48
+ }
49
+ validate({
50
+ schema: lowdefySchema.definitions.authConfig,
51
+ data: components.auth
52
+ });
53
+ if (components.auth.pages.protected === true && components.auth.pages.public === true || type.isArray(components.auth.pages.protected) && type.isArray(components.auth.pages.public)) {
54
+ throw new Error('Protected and public pages are mutually exclusive. When protected pages are listed, all unlisted pages are public by default and visa versa.');
55
+ }
56
+ if (components.auth.pages.protected === false) {
57
+ throw new Error('Protected pages can not be set to false.');
58
+ }
59
+ if (components.auth.pages.public === false) {
60
+ throw new Error('Public pages can not be set to false.');
61
+ }
62
+ return components;
63
+ }
64
+ export default validateAuthConfig;
@@ -0,0 +1,46 @@
1
+ /* eslint-disable no-param-reassign */ /*
2
+ Copyright 2020-2023 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
+ */ import { type } from '@lowdefy/helpers';
16
+ import countOperators from '../utils/countOperators.js';
17
+ import createCheckDuplicateId from '../utils/createCheckDuplicateId.js';
18
+ function buildConnections({ components, context }) {
19
+ const checkDuplicateConnectionId = createCheckDuplicateId({
20
+ message: 'Duplicate connectionId "{{ id }}".'
21
+ });
22
+ if (type.isArray(components.connections)) {
23
+ components.connections.forEach((connection)=>{
24
+ if (type.isUndefined(connection.id)) {
25
+ throw new Error(`Connection id missing.`);
26
+ }
27
+ if (!type.isString(connection.id)) {
28
+ throw new Error(`Connection id is not a string. Received ${JSON.stringify(connection.id)}.`);
29
+ }
30
+ checkDuplicateConnectionId({
31
+ id: connection.id
32
+ });
33
+ if (!type.isString(connection.type)) {
34
+ throw new Error(`Connection type is not a string at connection "${connection.id}". Received ${JSON.stringify(connection.type)}.`);
35
+ }
36
+ context.typeCounters.connections.increment(connection.type);
37
+ connection.connectionId = connection.id;
38
+ connection.id = `connection:${connection.id}`;
39
+ countOperators(connection.properties || {}, {
40
+ counter: context.typeCounters.operators.server
41
+ });
42
+ });
43
+ }
44
+ return components;
45
+ }
46
+ export default buildConnections;
@@ -0,0 +1,90 @@
1
+ /*
2
+ Copyright 2020-2023 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
+ */ const iconPackages = {
16
+ 'react-icons/ai': /"(Ai[A-Z0-9]\w*)"/gm,
17
+ 'react-icons/bi': /"(Bi[A-Z0-9]\w*)"/gm,
18
+ 'react-icons/bs': /"(Bs[A-Z0-9]\w*)"/gm,
19
+ 'react-icons/cg': /"(Cg[A-Z0-9]\w*)"/gm,
20
+ 'react-icons/ci': /"(Ci[A-Z0-9]\w*)"/gm,
21
+ 'react-icons/di': /"(Di[A-Z0-9]\w*)"/gm,
22
+ 'react-icons/fa': /"(Fa[A-Z0-9]\w*)"/gm,
23
+ 'react-icons/fc': /"(Fc[A-Z0-9]\w*)"/gm,
24
+ 'react-icons/fi': /"(Fi[A-Z0-9]\w*)"/gm,
25
+ 'react-icons/gi': /"(Gi[A-Z0-9]\w*)"/gm,
26
+ 'react-icons/go': /"(Go[A-Z0-9]\w*)"/gm,
27
+ 'react-icons/gr': /"(Gr[A-Z0-9]\w*)"/gm,
28
+ 'react-icons/hi': /"(Hi[A-Z0-9]\w*)"/gm,
29
+ 'react-icons/im': /"(Im[A-Z0-9]\w*)"/gm,
30
+ 'react-icons/io': /"(IoIos[A-Z0-9]\w*)"/gm,
31
+ 'react-icons/io5': /"(Io[A-Z0-9]\w*)"/gm,
32
+ 'react-icons/lu': /"(Lu[A-Z0-9]\w*)"/gm,
33
+ 'react-icons/md': /"(Md[A-Z0-9]\w*)"/gm,
34
+ 'react-icons/pi': /"(Pi[A-Z0-9]\w*)"/gm,
35
+ 'react-icons/ri': /"(Ri[A-Z0-9]\w*)"/gm,
36
+ 'react-icons/rx': /"(Rx[A-Z0-9]\w*)"/gm,
37
+ 'react-icons/si': /"(Si[A-Z0-9]\w*)"/gm,
38
+ 'react-icons/sl': /"(Sl[A-Z0-9]\w*)"/gm,
39
+ 'react-icons/tb': /"(Tb[A-Z0-9]\w*)"/gm,
40
+ 'react-icons/tfi': /"(Tfi[A-Z0-9]\w*)"/gm,
41
+ 'react-icons/ti': /"(Ti[A-Z0-9]\w*)"/gm,
42
+ 'react-icons/vsc': /"(Vsc[A-Z0-9]\w*)"/gm,
43
+ 'react-icons/wi': /"(Wi[A-Z0-9]\w*)"/gm
44
+ };
45
+ function getConfigIcons({ components, icons, regex }) {
46
+ [
47
+ ...JSON.stringify(components.global || {}).matchAll(regex)
48
+ ].map((match)=>icons.add(match[1]));
49
+ [
50
+ ...JSON.stringify(components.menus || []).matchAll(regex)
51
+ ].map((match)=>icons.add(match[1]));
52
+ [
53
+ ...JSON.stringify(components.pages || []).matchAll(regex)
54
+ ].map((match)=>icons.add(match[1]));
55
+ }
56
+ function getBlockDefaultIcons({ blocks, context, icons, regex }) {
57
+ blocks.forEach((block)=>{
58
+ (context.typesMap.icons[block.typeName] || []).forEach((icon)=>{
59
+ [
60
+ ...JSON.stringify(icon).matchAll(regex)
61
+ ].map((match)=>icons.add(match[1]));
62
+ });
63
+ });
64
+ }
65
+ function buildIconImports({ blocks, components, context, defaults = {} }) {
66
+ const iconImports = [];
67
+ Object.entries(iconPackages).forEach(([iconPackage, regex])=>{
68
+ defaults;
69
+ const icons = new Set(defaults[iconPackage]);
70
+ getConfigIcons({
71
+ components,
72
+ icons,
73
+ regex
74
+ });
75
+ getBlockDefaultIcons({
76
+ blocks,
77
+ context,
78
+ icons,
79
+ regex
80
+ });
81
+ iconImports.push({
82
+ icons: [
83
+ ...icons
84
+ ],
85
+ package: iconPackage
86
+ });
87
+ });
88
+ return iconImports;
89
+ }
90
+ export default buildIconImports;
@@ -0,0 +1,30 @@
1
+ /*
2
+ Copyright 2020-2023 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
+ */ import buildImportsDev from './buildImportsDev.js';
16
+ import buildImportsProd from './buildImportsProd.js';
17
+ function buildImports({ components, context }) {
18
+ if (context.stage === 'dev') {
19
+ components.imports = buildImportsDev({
20
+ components,
21
+ context
22
+ });
23
+ } else {
24
+ components.imports = buildImportsProd({
25
+ components,
26
+ context
27
+ });
28
+ }
29
+ }
30
+ export default buildImports;
@@ -0,0 +1,106 @@
1
+ /*
2
+ Copyright 2020-2023 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
+ */ import buildIconImports from './buildIconImports.js';
16
+ import buildStyleImports from './buildStyleImports.js';
17
+ import defaultIconsDev from './defaultIconsDev.js';
18
+ function getPluginPackages({ components }) {
19
+ const pluginPackages = new Set();
20
+ function getPackages(types) {
21
+ Object.values(types).forEach((type)=>{
22
+ pluginPackages.add(type.package);
23
+ });
24
+ }
25
+ getPackages(components.types.actions);
26
+ getPackages(components.types.auth.adapters);
27
+ getPackages(components.types.auth.callbacks);
28
+ getPackages(components.types.auth.events);
29
+ getPackages(components.types.auth.providers);
30
+ getPackages(components.types.blocks);
31
+ getPackages(components.types.connections);
32
+ getPackages(components.types.requests);
33
+ getPackages(components.types.operators.client);
34
+ getPackages(components.types.operators.server);
35
+ return pluginPackages;
36
+ }
37
+ function buildImportClassDev({ pluginPackages, map }) {
38
+ return Object.entries(map).map(([typeName, type])=>({
39
+ originalTypeName: type.originalTypeName,
40
+ package: type.package,
41
+ typeName
42
+ })).filter((type)=>pluginPackages.has(type.package));
43
+ }
44
+ function buildImportsDev({ components, context }) {
45
+ const pluginPackages = getPluginPackages({
46
+ components
47
+ });
48
+ const blocks = buildImportClassDev({
49
+ pluginPackages,
50
+ map: context.typesMap.blocks
51
+ });
52
+ return {
53
+ actions: buildImportClassDev({
54
+ pluginPackages,
55
+ map: context.typesMap.actions
56
+ }),
57
+ auth: {
58
+ adapters: buildImportClassDev({
59
+ pluginPackages,
60
+ map: context.typesMap.auth.adapters
61
+ }),
62
+ callbacks: buildImportClassDev({
63
+ pluginPackages,
64
+ map: context.typesMap.auth.callbacks
65
+ }),
66
+ events: buildImportClassDev({
67
+ pluginPackages,
68
+ map: context.typesMap.auth.events
69
+ }),
70
+ providers: buildImportClassDev({
71
+ pluginPackages,
72
+ map: context.typesMap.auth.providers
73
+ })
74
+ },
75
+ blocks,
76
+ connections: buildImportClassDev({
77
+ pluginPackages,
78
+ map: context.typesMap.connections
79
+ }),
80
+ icons: buildIconImports({
81
+ blocks,
82
+ components,
83
+ context,
84
+ defaults: defaultIconsDev
85
+ }),
86
+ requests: buildImportClassDev({
87
+ pluginPackages,
88
+ map: context.typesMap.requests
89
+ }),
90
+ operators: {
91
+ client: buildImportClassDev({
92
+ pluginPackages,
93
+ map: context.typesMap.operators.client
94
+ }),
95
+ server: buildImportClassDev({
96
+ pluginPackages,
97
+ map: context.typesMap.operators.server
98
+ })
99
+ },
100
+ styles: buildStyleImports({
101
+ blocks,
102
+ context
103
+ })
104
+ };
105
+ }
106
+ export default buildImportsDev;
@@ -0,0 +1,54 @@
1
+ /*
2
+ Copyright 2020-2023 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
+ */ import buildIconImports from './buildIconImports.js';
16
+ import buildStyleImports from './buildStyleImports.js';
17
+ import defaultIconsProd from './defaultIconsProd.js';
18
+ function buildImportClassProd(types) {
19
+ return Object.entries(types).map(([typeName, type])=>({
20
+ originalTypeName: type.originalTypeName,
21
+ package: type.package,
22
+ typeName
23
+ }));
24
+ }
25
+ function buildImportsProd({ components, context }) {
26
+ const blocks = buildImportClassProd(components.types.blocks);
27
+ return {
28
+ actions: buildImportClassProd(components.types.actions),
29
+ auth: {
30
+ adapters: buildImportClassProd(components.types.auth.adapters),
31
+ callbacks: buildImportClassProd(components.types.auth.callbacks),
32
+ events: buildImportClassProd(components.types.auth.events),
33
+ providers: buildImportClassProd(components.types.auth.providers)
34
+ },
35
+ blocks,
36
+ connections: buildImportClassProd(components.types.connections),
37
+ icons: buildIconImports({
38
+ blocks,
39
+ components,
40
+ context,
41
+ defaults: defaultIconsProd
42
+ }),
43
+ requests: buildImportClassProd(components.types.requests),
44
+ operators: {
45
+ client: buildImportClassProd(components.types.operators.client),
46
+ server: buildImportClassProd(components.types.operators.server)
47
+ },
48
+ styles: buildStyleImports({
49
+ blocks,
50
+ context
51
+ })
52
+ };
53
+ }
54
+ export default buildImportsProd;
@@ -0,0 +1,25 @@
1
+ /*
2
+ Copyright 2020-2023 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
+ */ function buildStyleImports({ blocks, context }) {
16
+ const styles = new Set();
17
+ blocks.forEach((block)=>{
18
+ styles.add(...(context.typesMap.styles.packages[block.package] || []).map((style)=>`${block.package}/${style}`));
19
+ styles.add(...(context.typesMap.styles.blocks[block.typeName] || []).map((style)=>`${block.package}/${style}`));
20
+ });
21
+ return [
22
+ ...styles
23
+ ].filter((style)=>!!style);
24
+ }
25
+ export default buildStyleImports;