paralayer 1.0.2 → 1.0.4

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 (2) hide show
  1. package/dist/paralayer.js +4 -11
  2. package/package.json +2 -2
package/dist/paralayer.js CHANGED
@@ -153,7 +153,7 @@ export class Paralayer extends $utils.Unit {
153
153
  .map(path => {
154
154
  const file = this.files[path];
155
155
  if (!file)
156
- throw this.never;
156
+ return '';
157
157
  if (file.names.length === 0)
158
158
  return '';
159
159
  const names = file.names;
@@ -190,7 +190,6 @@ export class Paralayer extends $utils.Unit {
190
190
  return [...imports].join('\n');
191
191
  }
192
192
  generateSetupContent(allLayers) {
193
- const nocheck = '// @ts-nocheck';
194
193
  const layers = allLayers.toSorted((layer1, layer2) => {
195
194
  if (layer1.length !== layer2.length)
196
195
  return layer1.length - layer2.length;
@@ -198,17 +197,11 @@ export class Paralayer extends $utils.Unit {
198
197
  });
199
198
  const vars = layers.map(layer => {
200
199
  const $layerName = this.getLayerName(layer, '$camel');
200
+ if (this.options.globalize)
201
+ return `globalThis.${$layerName} = {}`;
201
202
  return `const ${$layerName} = {}`;
202
203
  });
203
- let globals = [];
204
- if (this.options.globalize) {
205
- globals = layers.map(layer => {
206
- const $layerName = this.getLayerName(layer, '$camel');
207
- return `globalThis.${$layerName} = ${$layerName}`;
208
- });
209
- globals.unshift('');
210
- }
211
- return [nocheck, '', ...vars, ...globals, ''].join('\n');
204
+ return [...vars].join('\n');
212
205
  }
213
206
  getLayer(path) {
214
207
  const name = $path.basename(path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paralayer",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "imkost",
@@ -18,7 +18,7 @@
18
18
  "release:minor": "npm version minor && npm run release:raw"
19
19
  },
20
20
  "bin": {
21
- "paralayer": "./bin.js"
21
+ "paralayer": "bin.js"
22
22
  },
23
23
  "exports": {
24
24
  ".": {