handoff-app 1.1.0-experimental.1 → 1.1.0-experimental.2

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.
@@ -80,7 +80,12 @@ function getL2StaticPathSegments(modulePath, workingPath) {
80
80
  }
81
81
  let list = fs_extra_1.default.readdirSync(docRoot);
82
82
  if (fs_extra_1.default.existsSync(pageRoot)) {
83
- list = [...new Set([...list, ...fs_extra_1.default.readdirSync(pageRoot)])];
83
+ var moreFiles = fs_extra_1.default.readdirSync(pageRoot);
84
+ for (var i = 0; i < moreFiles.length; i++) {
85
+ if (list.indexOf(moreFiles[i]) === -1) {
86
+ list.push(moreFiles[i]);
87
+ }
88
+ }
84
89
  }
85
90
  const result = [];
86
91
  for (const fileName of list) {
@@ -149,7 +154,14 @@ function resolveAffectedOutputPaths(handoff, options) {
149
154
  out.push(`${level1}/${level2}/index.html`);
150
155
  }
151
156
  out.push('system/index.html', 'system/component/index.html');
152
- return [...new Set(out)];
157
+ // ES5-compatible alternative to [...new Set(out)]
158
+ var unique = [];
159
+ for (var i = 0; i < out.length; i++) {
160
+ if (unique.indexOf(out[i]) === -1) {
161
+ unique.push(out[i]);
162
+ }
163
+ }
164
+ return unique;
153
165
  }
154
166
  if (singlePath) {
155
167
  return routePathToOutputPaths(singlePath);
@@ -159,7 +171,14 @@ function resolveAffectedOutputPaths(handoff, options) {
159
171
  for (const p of pathList) {
160
172
  out.push(...routePathToOutputPaths(p));
161
173
  }
162
- return [...new Set(out)];
174
+ // ES5-compatible alternative to [...new Set(out)]
175
+ var unique = [];
176
+ for (var i = 0; i < out.length; i++) {
177
+ if (unique.indexOf(out[i]) === -1) {
178
+ unique.push(out[i]);
179
+ }
180
+ }
181
+ return unique;
163
182
  }
164
183
  return [];
165
184
  }
@@ -183,5 +202,12 @@ function resolveComponentAffectedOutputPathsBatch(componentIds) {
183
202
  for (const id of componentIds) {
184
203
  out.push(`system/component/${id}/index.html`, `api/component/${id}.json`);
185
204
  }
186
- return [...new Set(out)];
205
+ // ES5-compatible alternative to [...new Set(out)]
206
+ var unique = [];
207
+ for (var i = 0; i < out.length; i++) {
208
+ if (unique.indexOf(out[i]) === -1) {
209
+ unique.push(out[i]);
210
+ }
211
+ }
212
+ return unique;
187
213
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handoff-app",
3
- "version": "1.1.0-experimental.1",
3
+ "version": "1.1.0-experimental.2",
4
4
  "description": "Automated documentation toolchain for building client side documentation from figma",
5
5
  "author ": {
6
6
  "name": "Convertiv",
@@ -18,7 +18,7 @@ import { JsonTreeView } from '../../../../components/ui/json-tree-view';
18
18
  import { RadioGroup, RadioGroupItem } from '../../../../components/ui/radio-group';
19
19
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../../../components/ui/select';
20
20
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../../../components/ui/tooltip';
21
- import { fetchPages, getClientRuntimeConfig, getCurrentSection, IParams, staticBuildMenu } from '../../../../components/util';
21
+ import { fetchPages, getClientRuntimeConfig, getCurrentSection, staticBuildMenu } from '../../../../components/util';
22
22
 
23
23
  export async function getStaticPaths() {
24
24
  return {
@@ -27,8 +27,8 @@ export async function getStaticPaths() {
27
27
  };
28
28
  }
29
29
 
30
- export const getStaticProps = async (context: { params: IParams }) => {
31
- const { page } = context.params as { page: string };
30
+ export const getStaticProps = async (context: { params: { page: string } }) => {
31
+ const { page } = context.params;
32
32
  const pages = fetchPages()!;
33
33
  const menu = staticBuildMenu();
34
34
  const config = getClientRuntimeConfig();
@@ -70,7 +70,12 @@ export function getL2StaticPathSegments(modulePath: string, workingPath: string)
70
70
  }
71
71
  let list: string[] = fs.readdirSync(docRoot);
72
72
  if (fs.existsSync(pageRoot)) {
73
- list = [...new Set([...list, ...fs.readdirSync(pageRoot)])];
73
+ var moreFiles = fs.readdirSync(pageRoot);
74
+ for (var i = 0; i < moreFiles.length; i++) {
75
+ if (list.indexOf(moreFiles[i]) === -1) {
76
+ list.push(moreFiles[i]);
77
+ }
78
+ }
74
79
  }
75
80
  const result: Array<{ level1: string; level2: string }> = [];
76
81
  for (const fileName of list) {
@@ -140,7 +145,14 @@ export function resolveAffectedOutputPaths(
140
145
  out.push(`${level1}/${level2}/index.html`);
141
146
  }
142
147
  out.push('system/index.html', 'system/component/index.html');
143
- return [...new Set(out)];
148
+ // ES5-compatible alternative to [...new Set(out)]
149
+ var unique = [];
150
+ for (var i = 0; i < out.length; i++) {
151
+ if (unique.indexOf(out[i]) === -1) {
152
+ unique.push(out[i]);
153
+ }
154
+ }
155
+ return unique;
144
156
  }
145
157
 
146
158
  if (singlePath) {
@@ -152,7 +164,14 @@ export function resolveAffectedOutputPaths(
152
164
  for (const p of pathList) {
153
165
  out.push(...routePathToOutputPaths(p));
154
166
  }
155
- return [...new Set(out)];
167
+ // ES5-compatible alternative to [...new Set(out)]
168
+ var unique = [];
169
+ for (var i = 0; i < out.length; i++) {
170
+ if (unique.indexOf(out[i]) === -1) {
171
+ unique.push(out[i]);
172
+ }
173
+ }
174
+ return unique;
156
175
  }
157
176
 
158
177
  return [];
@@ -179,5 +198,12 @@ export function resolveComponentAffectedOutputPathsBatch(componentIds: string[])
179
198
  for (const id of componentIds) {
180
199
  out.push(`system/component/${id}/index.html`, `api/component/${id}.json`);
181
200
  }
182
- return [...new Set(out)];
201
+ // ES5-compatible alternative to [...new Set(out)]
202
+ var unique = [];
203
+ for (var i = 0; i < out.length; i++) {
204
+ if (unique.indexOf(out[i]) === -1) {
205
+ unique.push(out[i]);
206
+ }
207
+ }
208
+ return unique;
183
209
  }