@packtrack/layout 1.3.1 → 1.3.3

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.
@@ -206,12 +206,12 @@ export class Layout {
206
206
  findSection(path, base, source = base) {
207
207
  const parts = path.split('.');
208
208
  if (parts.length == 0) {
209
- throw `section '${path}' not found from '${source.name}': invalid name`;
209
+ throw new Error(`Section '${path}' not found from '${source.domainName}': invalid name`);
210
210
  }
211
211
  if (parts.length == 1) {
212
212
  const localSection = base.sections.find(section => section.name == parts[0]);
213
213
  if (!localSection) {
214
- throw new Error(`Section '${path}' not found from '${source.name}': section does not exist in '${base.name}'`);
214
+ throw new Error(`Section '${path}' not found from '${source.domainName}': section does not exist in '${base.name}'`);
215
215
  }
216
216
  return localSection;
217
217
  }
@@ -219,19 +219,19 @@ export class Layout {
219
219
  let pool = base;
220
220
  for (let index = 0; index < parts.length; index++) {
221
221
  if (pool instanceof Layout || !pool.parent) {
222
- throw new Error(`Section '${path}' could not be found from '${source.name}': district '${pool.name}' does not have a parent`);
222
+ throw new Error(`Section '${path}' could not be found from '${source.domainName}': district '${pool.name}' does not have a parent`);
223
223
  }
224
224
  pool = pool.parent;
225
225
  }
226
226
  for (let part of parts) {
227
227
  const child = (pool instanceof District ? pool.children : pool.districts).find(child => child.name == part);
228
228
  if (!child) {
229
- throw new Error(`Section '${path}' could not be found from '${source.name}': district '${pool.name}' does not have a child named '${part}'`);
229
+ throw new Error(`Section '${path}' could not be found from '${source.domainName}': district '${pool.name}' does not have a child named '${part}'`);
230
230
  }
231
231
  pool = child;
232
232
  }
233
233
  if (pool instanceof Layout) {
234
- throw new Error(`Section '${path}' could not be found from '${source.name}': a layout cannot directly include a section`);
234
+ throw new Error(`Section '${path}' could not be found from '${source.domainName}': a layout cannot directly include a section`);
235
235
  }
236
236
  return this.findSection(sectionName, pool, source);
237
237
  }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@packtrack/layout",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
+ "type": "module",
4
5
  "main": ".built/index.js",
5
6
  "typings": ".built/index.d.ts",
6
7
  "sideEffects": false,
package/source/layout.ts CHANGED
@@ -293,14 +293,14 @@ export class Layout {
293
293
  const parts = path.split('.');
294
294
 
295
295
  if (parts.length == 0) {
296
- throw `section '${path}' not found from '${source.name}': invalid name`;
296
+ throw new Error(`Section '${path}' not found from '${source.domainName}': invalid name`);
297
297
  }
298
298
 
299
299
  if (parts.length == 1) {
300
300
  const localSection = base.sections.find(section => section.name == parts[0]);
301
301
 
302
302
  if (!localSection) {
303
- throw new Error(`Section '${path}' not found from '${source.name}': section does not exist in '${base.name}'`);
303
+ throw new Error(`Section '${path}' not found from '${source.domainName}': section does not exist in '${base.name}'`);
304
304
  }
305
305
 
306
306
  return localSection;
@@ -312,7 +312,7 @@ export class Layout {
312
312
 
313
313
  for (let index = 0; index < parts.length; index++) {
314
314
  if (pool instanceof Layout || !pool.parent) {
315
- throw new Error(`Section '${path}' could not be found from '${source.name}': district '${pool.name}' does not have a parent`);
315
+ throw new Error(`Section '${path}' could not be found from '${source.domainName}': district '${pool.name}' does not have a parent`);
316
316
  }
317
317
 
318
318
  pool = pool.parent!;
@@ -322,14 +322,14 @@ export class Layout {
322
322
  const child = (pool instanceof District ? pool.children : pool.districts).find(child => child.name == part);
323
323
 
324
324
  if (!child) {
325
- throw new Error(`Section '${path}' could not be found from '${source.name}': district '${pool.name}' does not have a child named '${part}'`);
325
+ throw new Error(`Section '${path}' could not be found from '${source.domainName}': district '${pool.name}' does not have a child named '${part}'`);
326
326
  }
327
327
 
328
328
  pool = child;
329
329
  }
330
330
 
331
331
  if (pool instanceof Layout) {
332
- throw new Error(`Section '${path}' could not be found from '${source.name}': a layout cannot directly include a section`);
332
+ throw new Error(`Section '${path}' could not be found from '${source.domainName}': a layout cannot directly include a section`);
333
333
  }
334
334
 
335
335
  return this.findSection(sectionName, pool, source);
package/tsconfig.json CHANGED
@@ -3,6 +3,7 @@
3
3
  "target": "esnext",
4
4
  "module": "esnext",
5
5
  "outDir": ".built",
6
+ "moduleResolution": "bundler",
6
7
  "declaration": true,
7
8
  "lib": [
8
9
  "esnext"