@jsenv/plugin-bundling 2.1.6 → 2.1.9

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.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@jsenv/plugin-bundling",
3
- "version": "2.1.6",
3
+ "version": "2.1.9",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "https://github.com/jsenv/jsenv-core",
7
+ "url": "https://github.com/jsenv/core",
8
8
  "directory": "packages/jsenv-plugin-bundling"
9
9
  },
10
10
  "publishConfig": {
@@ -24,14 +24,14 @@
24
24
  "test": "node --conditions=development ./scripts/test.mjs"
25
25
  },
26
26
  "dependencies": {
27
- "@jsenv/babel-plugins": "1.1.5",
28
- "@jsenv/log": "3.3.4",
27
+ "@jsenv/babel-plugins": "1.1.6",
28
+ "@jsenv/log": "3.3.5",
29
29
  "@jsenv/url-meta": "8.1.0",
30
30
  "@jsenv/urls": "2.0.0",
31
31
  "@jsenv/sourcemap": "1.0.10",
32
- "acorn-import-assertions": "1.8.0",
33
- "lightningcss": "1.19.0",
34
- "rollup": "3.20.4"
32
+ "acorn-import-assertions": "1.9.0",
33
+ "lightningcss": "1.20.0",
34
+ "rollup": "3.21.8"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@jsenv/core": "*"
@@ -1,29 +1,31 @@
1
- import { fileURLToPath, pathToFileURL } from "node:url"
1
+ import { fileURLToPath, pathToFileURL } from "node:url";
2
+ import { fileUrlConverter } from "../file_url_converter.js";
2
3
 
3
4
  // Do not use until https://github.com/parcel-bundler/parcel-css/issues/181
4
5
  export const bundleCss = async ({ cssUrlInfos, context }) => {
5
- const bundledCssUrlInfos = {}
6
- const { bundleAsync } = await import("lightningcss")
7
- const targets = runtimeCompatToTargets(context.runtimeCompat)
6
+ const bundledCssUrlInfos = {};
7
+ const { bundleAsync } = await import("lightningcss");
8
+ const targets = runtimeCompatToTargets(context.runtimeCompat);
8
9
  for (const cssUrlInfo of cssUrlInfos) {
10
+ const filename = fileUrlConverter.asFilePath(cssUrlInfo.originalUrl);
9
11
  const { code, map } = await bundleAsync({
10
- filename: fileURLToPath(cssUrlInfo.originalUrl),
12
+ filename,
11
13
  targets,
12
14
  minify: false,
13
15
  resolver: {
14
16
  read: (specifier) => {
15
- const fileUrlObject = pathToFileURL(specifier)
16
- const fileUrl = String(fileUrlObject)
17
- const urlInfo = context.urlGraph.getUrlInfo(fileUrl)
18
- return urlInfo.content
17
+ const fileUrlObject = fileUrlConverter.asFileUrl(specifier);
18
+ const fileUrl = String(fileUrlObject);
19
+ const urlInfo = context.urlGraph.getUrlInfo(fileUrl);
20
+ return urlInfo.content;
19
21
  },
20
22
  resolve(specifier, from) {
21
- const fileUrlObject = new URL(specifier, pathToFileURL(from))
22
- const filePath = fileURLToPath(fileUrlObject)
23
- return filePath
23
+ const fileUrlObject = new URL(specifier, pathToFileURL(from));
24
+ const filePath = fileURLToPath(fileUrlObject);
25
+ return filePath;
24
26
  },
25
27
  },
26
- })
28
+ });
27
29
  bundledCssUrlInfos[cssUrlInfo.url] = {
28
30
  data: {
29
31
  bundlerName: "lightningcss",
@@ -31,26 +33,26 @@ export const bundleCss = async ({ cssUrlInfos, context }) => {
31
33
  contentType: "text/css",
32
34
  content: String(code),
33
35
  sourcemap: map,
34
- }
36
+ };
35
37
  }
36
- return bundledCssUrlInfos
37
- }
38
+ return bundledCssUrlInfos;
39
+ };
38
40
 
39
41
  const runtimeCompatToTargets = (runtimeCompat) => {
40
- const targets = {}
41
- ;["chrome", "firefox", "ie", "opera", "safari"].forEach((runtimeName) => {
42
- const version = runtimeCompat[runtimeName]
42
+ const targets = {};
43
+ ["chrome", "firefox", "ie", "opera", "safari"].forEach((runtimeName) => {
44
+ const version = runtimeCompat[runtimeName];
43
45
  if (version) {
44
- targets[runtimeName] = versionToBits(version)
46
+ targets[runtimeName] = versionToBits(version);
45
47
  }
46
- })
47
- return targets
48
- }
48
+ });
49
+ return targets;
50
+ };
49
51
 
50
52
  const versionToBits = (version) => {
51
53
  const [major, minor = 0, patch = 0] = version
52
54
  .split("-")[0]
53
55
  .split(".")
54
- .map((v) => parseInt(v, 10))
55
- return (major << 16) | (minor << 8) | patch
56
- }
56
+ .map((v) => parseInt(v, 10));
57
+ return (major << 16) | (minor << 8) | patch;
58
+ };
@@ -1,21 +1,21 @@
1
- import { fileSystemPathToUrl, urlToFileSystemPath } from "@jsenv/urls"
1
+ import { fileSystemPathToUrl, urlToFileSystemPath } from "@jsenv/urls";
2
2
 
3
3
  export const fileUrlConverter = {
4
4
  asFilePath: (fileUrl) => {
5
- const filePath = urlToFileSystemPath(fileUrl)
6
- const urlObject = new URL(fileUrl)
7
- const { searchParams } = urlObject
8
- return `${filePath}${stringifyQuery(searchParams)}`
5
+ const filePath = urlToFileSystemPath(fileUrl);
6
+ const urlObject = new URL(fileUrl);
7
+ const { searchParams } = urlObject;
8
+ return `${filePath}${stringifyQuery(searchParams)}`;
9
9
  },
10
10
  asFileUrl: (filePath) => {
11
11
  return decodeURIComponent(fileSystemPathToUrl(filePath)).replace(
12
12
  /[=](?=&|$)/g,
13
13
  "",
14
- )
14
+ );
15
15
  },
16
- }
16
+ };
17
17
 
18
18
  const stringifyQuery = (searchParams) => {
19
- const search = searchParams.toString()
20
- return search ? `?${search}` : ""
21
- }
19
+ const search = searchParams.toString();
20
+ return search ? `?${search}` : "";
21
+ };
@@ -8,5 +8,5 @@
8
8
  // import { createMagicSource } from "@jsenv/utils/sourcemap/magic_source.js"
9
9
 
10
10
  export const bundleJsClassic = () => {
11
- return {}
12
- }
11
+ return {};
12
+ };
@@ -1,12 +1,12 @@
1
- import { pathToFileURL } from "node:url"
1
+ import { pathToFileURL } from "node:url";
2
2
 
3
- import { URL_META } from "@jsenv/url-meta"
4
- import { isFileSystemPath } from "@jsenv/urls"
5
- import { createDetailedMessage } from "@jsenv/log"
6
- import { sourcemapConverter } from "@jsenv/sourcemap"
7
- import { globalThisClientFileUrl } from "@jsenv/core/src/plugins/transpilation/babel/global_this/babel_plugin_global_this_as_jsenv_import.js"
3
+ import { URL_META } from "@jsenv/url-meta";
4
+ import { isFileSystemPath } from "@jsenv/urls";
5
+ import { createDetailedMessage } from "@jsenv/log";
6
+ import { sourcemapConverter } from "@jsenv/sourcemap";
7
+ import { globalThisClientFileUrl } from "@jsenv/core/src/plugins/transpilation/babel/global_this/babel_plugin_global_this_as_jsenv_import.js";
8
8
 
9
- import { fileUrlConverter } from "./file_url_converter.js"
9
+ import { fileUrlConverter } from "../file_url_converter.js";
10
10
 
11
11
  export const bundleJsModules = async ({
12
12
  jsModuleUrlInfos,
@@ -15,6 +15,7 @@ export const bundleJsModules = async ({
15
15
  chunks = {},
16
16
  strictExports = false,
17
17
  preserveDynamicImport = false,
18
+ augmentDynamicImportUrlSearchParams = () => {},
18
19
  rollup,
19
20
  rollupInput = {},
20
21
  rollupOutput = {},
@@ -29,32 +30,32 @@ export const bundleJsModules = async ({
29
30
  urlGraph,
30
31
  runtimeCompat,
31
32
  sourcemaps,
32
- } = context
33
+ } = context;
33
34
 
34
- let manualChunks
35
+ let manualChunks;
35
36
  if (Object.keys(chunks).length) {
36
- const associations = URL_META.resolveAssociations(chunks, rootDirectoryUrl)
37
+ const associations = URL_META.resolveAssociations(chunks, rootDirectoryUrl);
37
38
  manualChunks = (id) => {
38
39
  if (rollupOutput.manualChunks) {
39
- const manualChunkName = rollupOutput.manualChunks(id)
40
+ const manualChunkName = rollupOutput.manualChunks(id);
40
41
  if (manualChunkName) {
41
- return manualChunkName
42
+ return manualChunkName;
42
43
  }
43
44
  }
44
- const url = fileUrlConverter.asFileUrl(id)
45
- const urlObject = new URL(url)
46
- urlObject.search = ""
47
- const urlWithoutSearch = urlObject.href
45
+ const url = fileUrlConverter.asFileUrl(id);
46
+ const urlObject = new URL(url);
47
+ urlObject.search = "";
48
+ const urlWithoutSearch = urlObject.href;
48
49
  const meta = URL_META.applyAssociations({
49
50
  url: urlWithoutSearch,
50
51
  associations,
51
- })
52
- const chunkName = Object.keys(meta).find((key) => meta[key])
53
- return chunkName || null
54
- }
52
+ });
53
+ const chunkName = Object.keys(meta).find((key) => meta[key]);
54
+ return chunkName || null;
55
+ };
55
56
  }
56
57
 
57
- const resultRef = { current: null }
58
+ const resultRef = { current: null };
58
59
  try {
59
60
  await applyRollupPlugins({
60
61
  rollup,
@@ -73,6 +74,7 @@ export const bundleJsModules = async ({
73
74
  sourcemaps,
74
75
  include,
75
76
  preserveDynamicImport,
77
+ augmentDynamicImportUrlSearchParams,
76
78
  strictExports,
77
79
  resultRef,
78
80
  }),
@@ -81,29 +83,25 @@ export const bundleJsModules = async ({
81
83
  input: [],
82
84
  onwarn: (warning) => {
83
85
  if (warning.code === "CIRCULAR_DEPENDENCY") {
84
- return
86
+ return;
85
87
  }
86
88
  if (warning.code === "THIS_IS_UNDEFINED") {
87
- const fileUrl = pathToFileURL(warning.id).href
89
+ const fileUrl = pathToFileURL(warning.id).href;
88
90
  if (fileUrl === globalThisClientFileUrl) {
89
- return
91
+ return;
90
92
  }
91
93
  }
92
94
  if (warning.code === "EVAL") {
93
95
  // ideally we should disable only for jsenv files
94
- return
96
+ return;
95
97
  }
96
- logger.warn(String(warning))
98
+ logger.warn(String(warning));
97
99
  },
98
100
  ...rollupInput,
99
101
  },
100
102
  rollupOutput: {
101
103
  compact: context.minification,
102
- // cannot be enabled otherwise:
103
- // - rollup rename InlineContent export into one letter export like "n"
104
- // - inline content detection cannot detect new InlineContent() calls
105
- // -> inline content is not detected, among other things url are not versioned
106
- minifyInternalExports: false, // context.minification,
104
+ minifyInternalExports: context.minification,
107
105
  generatedCode: {
108
106
  arrowFunctions: context.isSupportedOnCurrentClients("arrow_function"),
109
107
  constBindings: context.isSupportedOnCurrentClients("const_bindings"),
@@ -117,18 +115,18 @@ export const bundleJsModules = async ({
117
115
  ...rollupOutput,
118
116
  manualChunks,
119
117
  },
120
- })
121
- return resultRef.current.jsModuleBundleUrlInfos
118
+ });
119
+ return resultRef.current.jsModuleBundleUrlInfos;
122
120
  } catch (e) {
123
121
  if (e.code === "MISSING_EXPORT") {
124
122
  const detailedMessage = createDetailedMessage(e.message, {
125
123
  frame: e.frame,
126
- })
127
- throw new Error(detailedMessage, { cause: e })
124
+ });
125
+ throw new Error(detailedMessage, { cause: e });
128
126
  }
129
- throw e
127
+ throw e;
130
128
  }
131
- }
129
+ };
132
130
 
133
131
  const rollupPluginJsenv = ({
134
132
  // logger,
@@ -141,48 +139,49 @@ const rollupPluginJsenv = ({
141
139
 
142
140
  include,
143
141
  preserveDynamicImport,
142
+ augmentDynamicImportUrlSearchParams,
144
143
  strictExports,
145
144
 
146
145
  resultRef,
147
146
  }) => {
148
147
  let _rollupEmitFile = () => {
149
- throw new Error("not implemented")
150
- }
148
+ throw new Error("not implemented");
149
+ };
151
150
  const format = jsModuleUrlInfos.some((jsModuleUrlInfo) =>
152
151
  jsModuleUrlInfo.filename.endsWith(".cjs"),
153
152
  )
154
153
  ? "cjs"
155
- : "esm"
154
+ : "esm";
156
155
  const emitChunk = (chunk) => {
157
156
  return _rollupEmitFile({
158
157
  type: "chunk",
159
158
  ...chunk,
160
- })
161
- }
162
- let importCanBeBundled = () => true
159
+ });
160
+ };
161
+ let importCanBeBundled = () => true;
163
162
  if (include) {
164
163
  const associations = URL_META.resolveAssociations(
165
164
  { bundle: include },
166
165
  rootDirectoryUrl,
167
- )
166
+ );
168
167
  importCanBeBundled = (url) => {
169
- return URL_META.applyAssociations({ url, associations }).bundle
170
- }
168
+ return URL_META.applyAssociations({ url, associations }).bundle;
169
+ };
171
170
  }
172
- const urlImporters = {}
171
+ const urlImporters = {};
173
172
 
174
173
  return {
175
174
  name: "jsenv",
176
175
  async buildStart() {
177
- _rollupEmitFile = (...args) => this.emitFile(...args)
178
- let previousNonEntryPointModuleId
176
+ _rollupEmitFile = (...args) => this.emitFile(...args);
177
+ let previousNonEntryPointModuleId;
179
178
  jsModuleUrlInfos.forEach((jsModuleUrlInfo) => {
180
- const id = jsModuleUrlInfo.url
179
+ const id = jsModuleUrlInfo.url;
181
180
  if (jsModuleUrlInfo.isEntryPoint) {
182
181
  emitChunk({
183
182
  id,
184
- })
185
- return
183
+ });
184
+ return;
186
185
  }
187
186
  emitChunk({
188
187
  id,
@@ -194,33 +193,33 @@ const rollupPluginJsenv = ({
194
193
  : jsModuleUrlInfo.dependents.size < 2
195
194
  ? "allow-extension"
196
195
  : "strict",
197
- })
198
- previousNonEntryPointModuleId = id
199
- })
196
+ });
197
+ previousNonEntryPointModuleId = id;
198
+ });
200
199
  },
201
200
  async generateBundle(outputOptions, rollupResult) {
202
- _rollupEmitFile = (...args) => this.emitFile(...args)
201
+ _rollupEmitFile = (...args) => this.emitFile(...args);
203
202
 
204
- const jsModuleBundleUrlInfos = {}
203
+ const jsModuleBundleUrlInfos = {};
205
204
  Object.keys(rollupResult).forEach((fileName) => {
206
- const rollupFileInfo = rollupResult[fileName]
205
+ const rollupFileInfo = rollupResult[fileName];
207
206
  // there is 3 types of file: "placeholder", "asset", "chunk"
208
207
  if (rollupFileInfo.type === "chunk") {
209
208
  const sourceUrls = Object.keys(rollupFileInfo.modules).map((id) =>
210
209
  fileUrlConverter.asFileUrl(id),
211
- )
210
+ );
212
211
 
213
- let url
214
- let originalUrl
212
+ let url;
213
+ let originalUrl;
215
214
  if (rollupFileInfo.facadeModuleId) {
216
- url = fileUrlConverter.asFileUrl(rollupFileInfo.facadeModuleId)
217
- originalUrl = url
215
+ url = fileUrlConverter.asFileUrl(rollupFileInfo.facadeModuleId);
216
+ originalUrl = url;
218
217
  } else {
219
- url = new URL(rollupFileInfo.fileName, buildDirectoryUrl).href
218
+ url = new URL(rollupFileInfo.fileName, buildDirectoryUrl).href;
220
219
  if (rollupFileInfo.isDynamicEntry) {
221
- originalUrl = sourceUrls[sourceUrls.length - 1]
220
+ originalUrl = sourceUrls[sourceUrls.length - 1];
222
221
  } else {
223
- originalUrl = url
222
+ originalUrl = url;
224
223
  }
225
224
  }
226
225
 
@@ -240,13 +239,13 @@ const rollupPluginJsenv = ({
240
239
  contentType: "text/javascript",
241
240
  content: rollupFileInfo.code,
242
241
  sourcemap: rollupFileInfo.map,
243
- }
244
- jsModuleBundleUrlInfos[url] = jsModuleBundleUrlInfo
242
+ };
243
+ jsModuleBundleUrlInfos[url] = jsModuleBundleUrlInfo;
245
244
  }
246
- })
245
+ });
247
246
  resultRef.current = {
248
247
  jsModuleBundleUrlInfos,
249
- }
248
+ };
250
249
  },
251
250
  outputOptions: (outputOptions) => {
252
251
  // const sourcemapFile = buildDirectoryUrl
@@ -256,87 +255,98 @@ const rollupPluginJsenv = ({
256
255
  sourcemap: sourcemaps === "file" || sourcemaps === "inline",
257
256
  // sourcemapFile,
258
257
  sourcemapPathTransform: (relativePath) => {
259
- return new URL(relativePath, buildDirectoryUrl).href
258
+ return new URL(relativePath, buildDirectoryUrl).href;
260
259
  },
261
260
  entryFileNames: () => {
262
- return `[name].js`
261
+ return `[name].js`;
263
262
  },
264
263
  chunkFileNames: (chunkInfo) => {
265
264
  const insideJs = willBeInsideJsDirectory({
266
265
  chunkInfo,
267
266
  fileUrlConverter,
268
267
  jsModuleUrlInfos,
269
- })
270
- let nameFromUrlInfo
268
+ });
269
+ let nameFromUrlInfo;
271
270
  if (chunkInfo.facadeModuleId) {
272
- const url = fileUrlConverter.asFileUrl(chunkInfo.facadeModuleId)
271
+ const url = fileUrlConverter.asFileUrl(chunkInfo.facadeModuleId);
273
272
  const urlInfo = jsModuleUrlInfos.find(
274
273
  (jsModuleUrlInfo) => jsModuleUrlInfo.url === url,
275
- )
274
+ );
276
275
  if (urlInfo) {
277
- nameFromUrlInfo = urlInfo.filename
276
+ nameFromUrlInfo = urlInfo.filename;
278
277
  }
279
278
  }
280
- const name = nameFromUrlInfo || `${chunkInfo.name}.js`
281
- return insideJs ? `${assetsDirectory}js/${name}` : `${name}`
279
+ const name = nameFromUrlInfo || `${chunkInfo.name}.js`;
280
+ return insideJs ? `${assetsDirectory}js/${name}` : `${name}`;
282
281
  },
283
282
  // https://rollupjs.org/guide/en/#outputpaths
284
283
  // paths: (id) => {
285
284
  // return id
286
285
  // },
287
- })
286
+ });
288
287
  },
289
288
  // https://rollupjs.org/guide/en/#resolvedynamicimport
290
289
  resolveDynamicImport: (specifier, importer) => {
291
290
  if (preserveDynamicImport) {
292
- let urlObject
291
+ let urlObject;
293
292
  if (specifier[0] === "/") {
294
- urlObject = new URL(specifier.slice(1), rootDirectoryUrl)
293
+ urlObject = new URL(specifier.slice(1), rootDirectoryUrl);
295
294
  } else {
296
295
  if (isFileSystemPath(importer)) {
297
- importer = fileUrlConverter.asFileUrl(importer)
296
+ importer = fileUrlConverter.asFileUrl(importer);
298
297
  }
299
- urlObject = new URL(specifier, importer)
298
+ urlObject = new URL(specifier, importer);
300
299
  }
301
- urlObject.searchParams.set("as_js_classic", "")
302
- return { external: true, id: urlObject.href }
300
+ const searchParamsToAdd =
301
+ augmentDynamicImportUrlSearchParams(urlObject);
302
+ if (searchParamsToAdd) {
303
+ Object.keys(searchParamsToAdd).forEach((key) => {
304
+ const value = searchParamsToAdd[key];
305
+ if (value === undefined) {
306
+ urlObject.searchParams.delete(key);
307
+ } else {
308
+ urlObject.searchParams.set(key, value);
309
+ }
310
+ });
311
+ }
312
+ return { external: true, id: urlObject.href };
303
313
  }
304
- return null
314
+ return null;
305
315
  },
306
316
  resolveId: (specifier, importer = rootDirectoryUrl) => {
307
317
  if (isFileSystemPath(importer)) {
308
- importer = fileUrlConverter.asFileUrl(importer)
318
+ importer = fileUrlConverter.asFileUrl(importer);
309
319
  }
310
- let url
320
+ let url;
311
321
  if (specifier[0] === "/") {
312
- url = new URL(specifier.slice(1), rootDirectoryUrl).href
322
+ url = new URL(specifier.slice(1), rootDirectoryUrl).href;
313
323
  } else {
314
- url = new URL(specifier, importer).href
324
+ url = new URL(specifier, importer).href;
315
325
  }
316
- const existingImporter = urlImporters[url]
326
+ const existingImporter = urlImporters[url];
317
327
  if (!existingImporter) {
318
- urlImporters[url] = importer
328
+ urlImporters[url] = importer;
319
329
  }
320
330
  if (!url.startsWith("file:")) {
321
- return { id: url, external: true }
331
+ return { id: url, external: true };
322
332
  }
323
333
  if (!importCanBeBundled(url)) {
324
- return { id: url, external: true }
334
+ return { id: url, external: true };
325
335
  }
326
- const urlInfo = urlGraph.getUrlInfo(url)
336
+ const urlInfo = urlGraph.getUrlInfo(url);
327
337
  if (!urlInfo) {
328
- // happen when excluded by urlAnalysis.include
329
- return { id: url, external: true }
338
+ // happen when excluded by referenceAnalysis.include
339
+ return { id: url, external: true };
330
340
  }
331
341
  if (!urlInfo.shouldHandle) {
332
- return { id: url, external: true }
342
+ return { id: url, external: true };
333
343
  }
334
- const filePath = fileUrlConverter.asFilePath(url)
335
- return filePath
344
+ const filePath = fileUrlConverter.asFilePath(url);
345
+ return filePath;
336
346
  },
337
347
  async load(rollupId) {
338
- const fileUrl = fileUrlConverter.asFileUrl(rollupId)
339
- const urlInfo = urlGraph.getUrlInfo(fileUrl)
348
+ const fileUrl = fileUrlConverter.asFileUrl(rollupId);
349
+ const urlInfo = urlGraph.getUrlInfo(fileUrl);
340
350
  return {
341
351
  code: urlInfo.content,
342
352
  map:
@@ -344,10 +354,10 @@ const rollupPluginJsenv = ({
344
354
  urlInfo.sourcemap
345
355
  ? sourcemapConverter.toFilePaths(urlInfo.sourcemap)
346
356
  : null,
347
- }
357
+ };
348
358
  },
349
- }
350
- }
359
+ };
360
+ };
351
361
 
352
362
  const applyRollupPlugins = async ({
353
363
  rollup,
@@ -356,10 +366,10 @@ const applyRollupPlugins = async ({
356
366
  rollupOutput,
357
367
  }) => {
358
368
  if (!rollup) {
359
- const rollupModule = await import("rollup")
360
- rollup = rollupModule.rollup
369
+ const rollupModule = await import("rollup");
370
+ rollup = rollupModule.rollup;
361
371
  }
362
- const { importAssertions } = await import("acorn-import-assertions")
372
+ const { importAssertions } = await import("acorn-import-assertions");
363
373
  const rollupReturnValue = await rollup({
364
374
  ...rollupInput,
365
375
  plugins: rollupPlugins,
@@ -367,10 +377,10 @@ const applyRollupPlugins = async ({
367
377
  importAssertions,
368
378
  ...(rollupInput.acornInjectPlugins || []),
369
379
  ],
370
- })
371
- const rollupOutputArray = await rollupReturnValue.generate(rollupOutput)
372
- return rollupOutputArray
373
- }
380
+ });
381
+ const rollupOutputArray = await rollupReturnValue.generate(rollupOutput);
382
+ return rollupOutputArray;
383
+ };
374
384
 
375
385
  const willBeInsideJsDirectory = ({
376
386
  chunkInfo,
@@ -383,19 +393,19 @@ const willBeInsideJsDirectory = ({
383
393
  // both will be inside the js/ directory
384
394
  if (!chunkInfo.facadeModuleId) {
385
395
  // generated by rollup
386
- return true
396
+ return true;
387
397
  }
388
- const url = fileUrlConverter.asFileUrl(chunkInfo.facadeModuleId)
398
+ const url = fileUrlConverter.asFileUrl(chunkInfo.facadeModuleId);
389
399
  const jsModuleUrlInfo = jsModuleUrlInfos.find(
390
400
  (jsModuleUrlInfo) => jsModuleUrlInfo.url === url,
391
- )
401
+ );
392
402
  if (!jsModuleUrlInfo) {
393
403
  // generated by rollup
394
- return true
404
+ return true;
395
405
  }
396
406
  if (!jsModuleUrlInfo.isEntryPoint) {
397
407
  // not an entry point, jsenv will put it inside js/ directory
398
- return true
408
+ return true;
399
409
  }
400
- return false
401
- }
410
+ return false;
411
+ };
@@ -1,46 +1,46 @@
1
- import { bundleCss } from "./css/css_bundling_lightning_css.js"
2
- import { bundleJsClassic } from "./js_classic/bundle_js_classic.js"
3
- import { bundleJsModules } from "./js_module/bundle_js_modules.js"
1
+ import { bundleCss } from "./css/css_bundling_lightning_css.js";
2
+ import { bundleJsClassic } from "./js_classic/bundle_js_classic.js";
3
+ import { bundleJsModules } from "./js_module/bundle_js_modules.js";
4
4
 
5
5
  export const jsenvPluginBundling = ({
6
6
  css = {},
7
7
  js_classic = {},
8
8
  js_module = {},
9
9
  } = {}) => {
10
- const bundle = {}
10
+ const bundle = {};
11
11
 
12
12
  if (css) {
13
13
  bundle.css = (cssUrlInfos, context) => {
14
14
  return bundleCss({
15
15
  cssUrlInfos,
16
16
  context,
17
- })
18
- }
17
+ });
18
+ };
19
19
  }
20
20
  if (js_classic) {
21
21
  bundle.js_classic = (jsClassicUrlInfos, context) => {
22
22
  return bundleJsClassic({
23
23
  jsClassicUrlInfos,
24
24
  context,
25
- })
26
- }
25
+ });
26
+ };
27
27
  }
28
28
  if (js_module) {
29
29
  if (js_module === true) {
30
- js_module = {}
30
+ js_module = {};
31
31
  }
32
32
  bundle.js_module = (jsModuleUrlInfos, context) => {
33
33
  return bundleJsModules({
34
34
  jsModuleUrlInfos,
35
35
  context,
36
36
  ...js_module,
37
- })
38
- }
37
+ });
38
+ };
39
39
  }
40
40
 
41
41
  return {
42
42
  name: "jsenv:bundling",
43
43
  appliesDuring: "build",
44
44
  bundle,
45
- }
46
- }
45
+ };
46
+ };
package/src/main.js CHANGED
@@ -1,2 +1,2 @@
1
- export { jsenvPluginBundling } from "./jsenv_plugin_bundling.js"
2
- export { bundleJsModules } from "./js_module/bundle_js_modules.js"
1
+ export { jsenvPluginBundling } from "./jsenv_plugin_bundling.js";
2
+ export { bundleJsModules } from "./js_module/bundle_js_modules.js";