@jsenv/core 40.10.0 → 40.11.1

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.
@@ -433,6 +433,11 @@ const detailsFromFirstReference = (reference) => {
433
433
  ) {
434
434
  return {};
435
435
  }
436
+ if (referenceInProject.type === "entry_point") {
437
+ return {
438
+ "first reference": referenceInProject.trace.message,
439
+ };
440
+ }
436
441
  return {
437
442
  "first reference in project": `${referenceInProject.trace.url}:${referenceInProject.trace.line}:${referenceInProject.trace.column}`,
438
443
  };
@@ -2911,6 +2916,7 @@ const createKitchen = ({
2911
2916
  dev = false,
2912
2917
  build = false,
2913
2918
  runtimeCompat,
2919
+ mode,
2914
2920
 
2915
2921
  ignore,
2916
2922
  ignoreProtocol = "remove",
@@ -2960,7 +2966,10 @@ const createKitchen = ({
2960
2966
  }
2961
2967
 
2962
2968
  if (packageDependencies === "auto") {
2963
- packageDependencies = build && nodeRuntimeEnabled ? "ignore" : "include";
2969
+ packageDependencies =
2970
+ build && (nodeRuntimeEnabled || mode === "package")
2971
+ ? "ignore"
2972
+ : "include";
2964
2973
  }
2965
2974
 
2966
2975
  const kitchen = {
@@ -3347,7 +3356,7 @@ ${ANSI.color(normalizedReturnValue, ANSI.YELLOW)}
3347
3356
  `no plugin has handled url during "fetchUrlContent" hook -> url will be ignored`,
3348
3357
  {
3349
3358
  "url": urlInfo.url,
3350
- "url reference trace": urlInfo.firstReference.trace.message,
3359
+ "url reference trace": urlInfo.firstReference?.trace.message,
3351
3360
  },
3352
3361
  ),
3353
3362
  );
@@ -7203,6 +7212,10 @@ const jsenvPluginProtocolFile = ({
7203
7212
  return null;
7204
7213
  }
7205
7214
  const { firstReference } = urlInfo;
7215
+ if (!firstReference) {
7216
+ console.warn("No firstReference for", urlInfo.url);
7217
+ return null;
7218
+ }
7206
7219
  let { fsStat } = firstReference;
7207
7220
  if (!fsStat) {
7208
7221
  fsStat = readEntryStatSync(urlInfo.url, { nullIfNotFound: true });
@@ -7231,6 +7244,9 @@ const jsenvPluginProtocolFile = ({
7231
7244
  return null;
7232
7245
  }
7233
7246
  const { firstReference } = urlInfo;
7247
+ if (!firstReference) {
7248
+ return null;
7249
+ }
7234
7250
  let { fsStat } = firstReference;
7235
7251
  if (!fsStat) {
7236
7252
  fsStat = readEntryStatSync(urlInfo.url, { nullIfNotFound: true });
@@ -7802,10 +7818,10 @@ const jsenvPluginNodeRuntime = ({ runtimeCompat }) => {
7802
7818
 
7803
7819
  const jsenvPluginImportMetaCss = () => {
7804
7820
  const importMetaCssClientFileUrl = import.meta.resolve(
7805
- "../js/import_meta_css.js",
7821
+ "../client/import_meta_css/import_meta_css.js",
7806
7822
  );
7807
7823
  const importMetaCssBuildFileUrl = import.meta.resolve(
7808
- "../js/import_meta_css_build.js",
7824
+ "../client/import_meta_css/import_meta_css_build.js",
7809
7825
  );
7810
7826
 
7811
7827
  return {
@@ -8838,7 +8854,7 @@ const jsenvPluginRibbon = ({
8838
8854
 
8839
8855
 
8840
8856
  const jsenvPluginDropToOpen = () => {
8841
- const clientFileUrl = import.meta.resolve("../js/drop_to_open.js");
8857
+ const clientFileUrl = import.meta.resolve("../client/drop_to_open/drop_to_open.js");
8842
8858
  return {
8843
8859
  name: "jsenv:drop_to_open",
8844
8860
  appliesDuring: "dev",
@@ -11322,31 +11338,60 @@ const jsenvPluginMappings = (mappings) => {
11322
11338
  * @param {string|url} params.buildDirectoryUrl
11323
11339
  * Directory where optimized files will be written
11324
11340
  * @param {object} params.entryPoints
11325
- * Object where keys are paths to source files and values are their future name in the build directory.
11326
- * Keys are relative to sourceDirectoryUrl
11327
- * @param {object} params.runtimeCompat
11328
- * Code generated will be compatible with these runtimes
11329
- * @param {string} [params.assetsDirectory]
11330
- * Directory where asset files will be written. By default sibling to the entry build file.
11331
- * @param {string|url} [params.base=""]
11332
- * Urls in build file contents will be prefixed with this string
11333
- * @param {boolean|object} [params.bundling=true]
11334
- * Reduce number of files written in the build directory
11335
- * @param {boolean|object} [params.minification=true]
11336
- * Minify the content of files written into the build directory
11337
- * @param {boolean} [params.versioning=true]
11338
- * Use versioning on files written in the build directory
11339
- * @param {('search_param'|'filename')} [params.versioningMethod="search_param"]
11340
- * Controls how url are versioned in the build directory
11341
- * @param {('none'|'inline'|'file'|'programmatic')} [params.sourcemaps="none"]
11342
- * Generate sourcemaps in the build directory
11343
- * @param {('error'|'copy'|'preserve')|function} [params.directoryReferenceEffect="error"]
11344
- * What to do when a reference leads to a directory on the filesystem
11341
+ * Object where keys are paths to source files and values are configuration objects for each entry point.
11342
+ * Keys are relative to sourceDirectoryUrl or bare specifiers
11343
+ * @param {object} [params.logs]
11344
+ * Configuration for build logging
11345
+ * @param {string|url} [params.outDirectoryUrl]
11346
+ * Directory for temporary build files and cache
11347
+ * @param {object} [params.buildDirectoryCleanPatterns]
11348
+ * Patterns for files to clean from build directory before building (defaults to all files)
11349
+ * @param {boolean} [params.returnBuildInlineContents]
11350
+ * Whether to return inline contents in the result
11351
+ * @param {boolean} [params.returnBuildManifest]
11352
+ * Whether to return build manifest in the result
11353
+ * @param {boolean} [params.returnBuildFileVersions]
11354
+ * Whether to return file versions in the result
11355
+ * @param {AbortSignal} [params.signal]
11356
+ * Signal to abort the build process
11357
+ * @param {boolean} [params.handleSIGINT=true]
11358
+ * Whether to handle SIGINT for graceful shutdown
11359
+ * @param {boolean} [params.writeOnFileSystem=true]
11360
+ * Whether to write build files to the filesystem
11361
+ * @param {boolean} [params.watch=false]
11362
+ * Whether to enable watch mode for continuous building
11363
+ * @param {object} [params.sourceFilesConfig]
11364
+ * Configuration for source file watching
11365
+ * @param {number} [params.cooldownBetweenFileEvents]
11366
+ * Cooldown time between file change events in watch mode
11367
+ *
11368
+ * Entry point configuration (values in params.entryPoints):
11369
+ * @param {string} [entryPoint.buildRelativeUrl]
11370
+ * Relative URL where this entry point will be written in the build directory
11371
+ * @param {object} [entryPoint.runtimeCompat]
11372
+ * Runtime compatibility configuration for this entry point
11373
+ * @param {string} [entryPoint.assetsDirectory]
11374
+ * Directory where asset files will be written for this entry point
11375
+ * @param {string|url} [entryPoint.base]
11376
+ * Base URL prefix for references in this entry point
11377
+ * @param {boolean|object} [entryPoint.bundling=true]
11378
+ * Whether to enable bundling for this entry point
11379
+ * @param {boolean|object} [entryPoint.minification=true]
11380
+ * Whether to enable minification for this entry point
11381
+ * @param {boolean} [entryPoint.versioning=true]
11382
+ * Whether to enable versioning for this entry point
11383
+ * @param {('search_param'|'filename')} [entryPoint.versioningMethod]
11384
+ * How URLs are versioned for this entry point (defaults to "search_param")
11385
+ * @param {('none'|'inline'|'file'|'programmatic')} [entryPoint.sourcemaps]
11386
+ * Sourcemap generation strategy for this entry point (defaults to "none")
11387
+ *
11345
11388
  * @return {Promise<Object>} buildReturnValue
11346
- * @return {Promise<Object>} buildReturnValue.buildInlineContents
11347
- * Contains content that is inline into build files
11348
- * @return {Promise<Object>} buildReturnValue.buildManifest
11349
- * Map build file paths without versioning to versioned file paths
11389
+ * @return {Promise<Object>} [buildReturnValue.buildInlineContents]
11390
+ * Contents that are inlined into build files (if returnBuildInlineContents is true)
11391
+ * @return {Promise<Object>} [buildReturnValue.buildManifest]
11392
+ * Map of build file paths without versioning to versioned file paths (if returnBuildManifest is true)
11393
+ * @return {Promise<Object>} [buildReturnValue.buildFileVersions]
11394
+ * Version information for build files (if returnBuildFileVersions is true)
11350
11395
  */
11351
11396
  const build = async ({
11352
11397
  sourceDirectoryUrl,
@@ -12107,6 +12152,7 @@ const build = async ({
12107
12152
 
12108
12153
  const entryPointDefaultParams = {
12109
12154
  buildRelativeUrl: undefined,
12155
+ mode: undefined,
12110
12156
  runtimeCompat: defaultRuntimeCompat,
12111
12157
  plugins: [],
12112
12158
  mappings: undefined,
@@ -12160,6 +12206,7 @@ const prepareEntryPointBuild = async (
12160
12206
  ) => {
12161
12207
  let {
12162
12208
  buildRelativeUrl,
12209
+ mode,
12163
12210
  runtimeCompat,
12164
12211
  plugins,
12165
12212
  mappings,
@@ -12234,7 +12281,7 @@ const prepareEntryPointBuild = async (
12234
12281
  assetsDirectory = `${assetsDirectory}/`;
12235
12282
  }
12236
12283
  if (entryPointParams.base === undefined) {
12237
- base = someEntryPointUseNode ? "./" : "/";
12284
+ base = mode === "package" || someEntryPointUseNode ? "./" : "/";
12238
12285
  }
12239
12286
  if (entryPointParams.bundling === undefined) {
12240
12287
  bundling = true;
@@ -12243,13 +12290,21 @@ const prepareEntryPointBuild = async (
12243
12290
  bundling = {};
12244
12291
  }
12245
12292
  if (entryPointParams.minification === undefined) {
12246
- minification = !someEntryPointUseNode;
12293
+ if (mode === "package" || someEntryPointUseNode) {
12294
+ minification = false;
12295
+ } else {
12296
+ minification = true;
12297
+ }
12247
12298
  }
12248
12299
  if (minification === true) {
12249
12300
  minification = {};
12250
12301
  }
12251
12302
  if (entryPointParams.versioning === undefined) {
12252
- versioning = !someEntryPointUseNode;
12303
+ if (mode === "package" || someEntryPointUseNode) {
12304
+ versioning = false;
12305
+ } else {
12306
+ versioning = true;
12307
+ }
12253
12308
  }
12254
12309
  if (entryPointParams.versioningMethod === undefined) {
12255
12310
  versioningMethod = entryPointDefaultParams.versioningMethod;
@@ -12258,7 +12313,14 @@ const prepareEntryPointBuild = async (
12258
12313
  assetManifest = versioningMethod === "filename";
12259
12314
  }
12260
12315
  if (entryPointParams.preserveComments === undefined) {
12261
- preserveComments = someEntryPointUseNode;
12316
+ if (mode === "package" || someEntryPointUseNode) {
12317
+ preserveComments = true;
12318
+ }
12319
+ }
12320
+ if (entryPointParams.sourcemaps === undefined) {
12321
+ if (mode === "package") {
12322
+ sourcemaps = "file";
12323
+ }
12262
12324
  }
12263
12325
  }
12264
12326
 
@@ -12285,6 +12347,7 @@ const prepareEntryPointBuild = async (
12285
12347
  ignoreProtocol: "keep",
12286
12348
  build: true,
12287
12349
  runtimeCompat,
12350
+ mode,
12288
12351
  initialContext: contextSharedDuringBuild,
12289
12352
  sourcemaps,
12290
12353
  sourcemapsSourcesContent,
@@ -12385,6 +12448,7 @@ const prepareEntryPointBuild = async (
12385
12448
  ignoreProtocol: "remove",
12386
12449
  build: true,
12387
12450
  runtimeCompat,
12451
+ mode,
12388
12452
  initialContext: contextSharedDuringBuild,
12389
12453
  sourcemaps,
12390
12454
  sourcemapsComment: "relative",
@@ -1,14 +1,11 @@
1
- import "file:///Users/dmail/Documents/dev/jsenv/core/packages/internal/plugin-transpilation/src/babel/new_stylesheet/client/new_stylesheet.js";
2
-
3
- const installImportMetaCss = importMeta => {
1
+ const installImportMetaCss = (importMeta) => {
4
2
  let cssText = "";
5
- let stylesheet = new CSSStyleSheet({
6
- baseUrl: importMeta.url
7
- });
3
+ let stylesheet = new CSSStyleSheet({ baseUrl: importMeta.url });
8
4
  let adopted = false;
5
+
9
6
  const css = {
10
7
  toString: () => cssText,
11
- update: value => {
8
+ update: (value) => {
12
9
  cssText = value;
13
10
  cssText += `
14
11
  /* sourceURL=${importMeta.url} */
@@ -17,17 +14,23 @@ const installImportMetaCss = importMeta => {
17
14
  },
18
15
  inject: () => {
19
16
  if (!adopted) {
20
- document.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];
17
+ document.adoptedStyleSheets = [
18
+ ...document.adoptedStyleSheets,
19
+ stylesheet,
20
+ ];
21
21
  adopted = true;
22
22
  }
23
23
  },
24
24
  remove: () => {
25
25
  if (adopted) {
26
- document.adoptedStyleSheets = document.adoptedStyleSheets.filter(s => s !== stylesheet);
26
+ document.adoptedStyleSheets = document.adoptedStyleSheets.filter(
27
+ (s) => s !== stylesheet,
28
+ );
27
29
  adopted = false;
28
30
  }
29
- }
31
+ },
30
32
  };
33
+
31
34
  Object.defineProperty(importMeta, "css", {
32
35
  get() {
33
36
  return css;
@@ -35,8 +38,9 @@ const installImportMetaCss = importMeta => {
35
38
  set(value) {
36
39
  css.update(value);
37
40
  css.inject();
38
- }
41
+ },
39
42
  });
43
+
40
44
  return css.remove;
41
45
  };
42
46
 
@@ -1,9 +1,6 @@
1
- import "file:///Users/dmail/Documents/dev/jsenv/core/packages/internal/plugin-transpilation/src/babel/new_stylesheet/client/new_stylesheet.js";
1
+ const installImportMetaCss = (importMeta) => {
2
+ const stylesheet = new CSSStyleSheet({ baseUrl: importMeta.url });
2
3
 
3
- const installImportMetaCss = importMeta => {
4
- const stylesheet = new CSSStyleSheet({
5
- baseUrl: importMeta.url
6
- });
7
4
  let called = false;
8
5
  // eslint-disable-next-line accessor-pairs
9
6
  Object.defineProperty(importMeta, "css", {
@@ -14,8 +11,11 @@ const installImportMetaCss = importMeta => {
14
11
  }
15
12
  called = true;
16
13
  stylesheet.replaceSync(value);
17
- document.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];
18
- }
14
+ document.adoptedStyleSheets = [
15
+ ...document.adoptedStyleSheets,
16
+ stylesheet,
17
+ ];
18
+ },
19
19
  });
20
20
  };
21
21
 
@@ -492,6 +492,11 @@ const detailsFromFirstReference = (reference) => {
492
492
  ) {
493
493
  return {};
494
494
  }
495
+ if (referenceInProject.type === "entry_point") {
496
+ return {
497
+ "first reference": referenceInProject.trace.message,
498
+ };
499
+ }
495
500
  return {
496
501
  "first reference in project": `${referenceInProject.trace.url}:${referenceInProject.trace.line}:${referenceInProject.trace.column}`,
497
502
  };
@@ -2951,6 +2956,7 @@ const createKitchen = ({
2951
2956
  dev = false,
2952
2957
  build = false,
2953
2958
  runtimeCompat,
2959
+ mode,
2954
2960
 
2955
2961
  ignore,
2956
2962
  ignoreProtocol = "remove",
@@ -3000,7 +3006,10 @@ const createKitchen = ({
3000
3006
  }
3001
3007
 
3002
3008
  if (packageDependencies === "auto") {
3003
- packageDependencies = build && nodeRuntimeEnabled ? "ignore" : "include";
3009
+ packageDependencies =
3010
+ build && (nodeRuntimeEnabled || mode === "package")
3011
+ ? "ignore"
3012
+ : "include";
3004
3013
  }
3005
3014
 
3006
3015
  const kitchen = {
@@ -3387,7 +3396,7 @@ ${ANSI.color(normalizedReturnValue, ANSI.YELLOW)}
3387
3396
  `no plugin has handled url during "fetchUrlContent" hook -> url will be ignored`,
3388
3397
  {
3389
3398
  "url": urlInfo.url,
3390
- "url reference trace": urlInfo.firstReference.trace.message,
3399
+ "url reference trace": urlInfo.firstReference?.trace.message,
3391
3400
  },
3392
3401
  ),
3393
3402
  );
@@ -6908,6 +6917,10 @@ const jsenvPluginProtocolFile = ({
6908
6917
  return null;
6909
6918
  }
6910
6919
  const { firstReference } = urlInfo;
6920
+ if (!firstReference) {
6921
+ console.warn("No firstReference for", urlInfo.url);
6922
+ return null;
6923
+ }
6911
6924
  let { fsStat } = firstReference;
6912
6925
  if (!fsStat) {
6913
6926
  fsStat = readEntryStatSync(urlInfo.url, { nullIfNotFound: true });
@@ -6936,6 +6949,9 @@ const jsenvPluginProtocolFile = ({
6936
6949
  return null;
6937
6950
  }
6938
6951
  const { firstReference } = urlInfo;
6952
+ if (!firstReference) {
6953
+ return null;
6954
+ }
6939
6955
  let { fsStat } = firstReference;
6940
6956
  if (!fsStat) {
6941
6957
  fsStat = readEntryStatSync(urlInfo.url, { nullIfNotFound: true });
@@ -7842,10 +7858,10 @@ const jsenvPluginNodeRuntime = ({ runtimeCompat }) => {
7842
7858
 
7843
7859
  const jsenvPluginImportMetaCss = () => {
7844
7860
  const importMetaCssClientFileUrl = import.meta.resolve(
7845
- "../js/import_meta_css.js",
7861
+ "../client/import_meta_css/import_meta_css.js",
7846
7862
  );
7847
7863
  const importMetaCssBuildFileUrl = import.meta.resolve(
7848
- "../js/import_meta_css_build.js",
7864
+ "../client/import_meta_css/import_meta_css_build.js",
7849
7865
  );
7850
7866
 
7851
7867
  return {
@@ -8878,7 +8894,7 @@ const jsenvPluginRibbon = ({
8878
8894
 
8879
8895
 
8880
8896
  const jsenvPluginDropToOpen = () => {
8881
- const clientFileUrl = import.meta.resolve("../js/drop_to_open.js");
8897
+ const clientFileUrl = import.meta.resolve("../client/drop_to_open/drop_to_open.js");
8882
8898
  return {
8883
8899
  name: "jsenv:drop_to_open",
8884
8900
  appliesDuring: "dev",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "40.10.0",
3
+ "version": "40.11.1",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -75,14 +75,14 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "@financial-times/polyfill-useragent-normaliser": "1.10.2",
78
- "@jsenv/ast": "6.7.14",
79
- "@jsenv/js-module-fallback": "1.4.22",
80
- "@jsenv/plugin-bundling": "2.10.0",
78
+ "@jsenv/ast": "6.7.15",
79
+ "@jsenv/js-module-fallback": "1.4.23",
80
+ "@jsenv/plugin-bundling": "2.10.2",
81
81
  "@jsenv/plugin-minification": "1.7.2",
82
- "@jsenv/plugin-supervisor": "1.7.8",
83
- "@jsenv/plugin-transpilation": "1.5.60",
82
+ "@jsenv/plugin-supervisor": "1.7.9",
83
+ "@jsenv/plugin-transpilation": "1.5.62",
84
84
  "@jsenv/server": "16.3.2",
85
- "@jsenv/sourcemap": "1.3.10",
85
+ "@jsenv/sourcemap": "1.3.11",
86
86
  "react-table": "7.8.0"
87
87
  },
88
88
  "devDependencies": {
@@ -130,6 +130,7 @@
130
130
  "playwright": "1.56.1",
131
131
  "preact": "10.27.2",
132
132
  "prettier": "3.6.2",
133
+ "prettier-plugin-css-order": "git+https://github.com/dmail-fork/prettier-plugin-css-order.git",
133
134
  "prettier-plugin-embed": "0.5.0",
134
135
  "prettier-plugin-organize-imports": "4.3.0",
135
136
  "prettier-plugin-packagejson": "2.5.19",
@@ -141,7 +142,7 @@
141
142
  "node": ">=20.8.0"
142
143
  },
143
144
  "volta": {
144
- "node": "25.0.0",
145
+ "node": "25.1.0",
145
146
  "npm": "11.6.2"
146
147
  },
147
148
  "publishConfig": {
@@ -87,31 +87,60 @@ import { jsenvPluginMappings } from "./jsenv_plugin_mappings.js";
87
87
  * @param {string|url} params.buildDirectoryUrl
88
88
  * Directory where optimized files will be written
89
89
  * @param {object} params.entryPoints
90
- * Object where keys are paths to source files and values are their future name in the build directory.
91
- * Keys are relative to sourceDirectoryUrl
92
- * @param {object} params.runtimeCompat
93
- * Code generated will be compatible with these runtimes
94
- * @param {string} [params.assetsDirectory]
95
- * Directory where asset files will be written. By default sibling to the entry build file.
96
- * @param {string|url} [params.base=""]
97
- * Urls in build file contents will be prefixed with this string
98
- * @param {boolean|object} [params.bundling=true]
99
- * Reduce number of files written in the build directory
100
- * @param {boolean|object} [params.minification=true]
101
- * Minify the content of files written into the build directory
102
- * @param {boolean} [params.versioning=true]
103
- * Use versioning on files written in the build directory
104
- * @param {('search_param'|'filename')} [params.versioningMethod="search_param"]
105
- * Controls how url are versioned in the build directory
106
- * @param {('none'|'inline'|'file'|'programmatic')} [params.sourcemaps="none"]
107
- * Generate sourcemaps in the build directory
108
- * @param {('error'|'copy'|'preserve')|function} [params.directoryReferenceEffect="error"]
109
- * What to do when a reference leads to a directory on the filesystem
90
+ * Object where keys are paths to source files and values are configuration objects for each entry point.
91
+ * Keys are relative to sourceDirectoryUrl or bare specifiers
92
+ * @param {object} [params.logs]
93
+ * Configuration for build logging
94
+ * @param {string|url} [params.outDirectoryUrl]
95
+ * Directory for temporary build files and cache
96
+ * @param {object} [params.buildDirectoryCleanPatterns]
97
+ * Patterns for files to clean from build directory before building (defaults to all files)
98
+ * @param {boolean} [params.returnBuildInlineContents]
99
+ * Whether to return inline contents in the result
100
+ * @param {boolean} [params.returnBuildManifest]
101
+ * Whether to return build manifest in the result
102
+ * @param {boolean} [params.returnBuildFileVersions]
103
+ * Whether to return file versions in the result
104
+ * @param {AbortSignal} [params.signal]
105
+ * Signal to abort the build process
106
+ * @param {boolean} [params.handleSIGINT=true]
107
+ * Whether to handle SIGINT for graceful shutdown
108
+ * @param {boolean} [params.writeOnFileSystem=true]
109
+ * Whether to write build files to the filesystem
110
+ * @param {boolean} [params.watch=false]
111
+ * Whether to enable watch mode for continuous building
112
+ * @param {object} [params.sourceFilesConfig]
113
+ * Configuration for source file watching
114
+ * @param {number} [params.cooldownBetweenFileEvents]
115
+ * Cooldown time between file change events in watch mode
116
+ *
117
+ * Entry point configuration (values in params.entryPoints):
118
+ * @param {string} [entryPoint.buildRelativeUrl]
119
+ * Relative URL where this entry point will be written in the build directory
120
+ * @param {object} [entryPoint.runtimeCompat]
121
+ * Runtime compatibility configuration for this entry point
122
+ * @param {string} [entryPoint.assetsDirectory]
123
+ * Directory where asset files will be written for this entry point
124
+ * @param {string|url} [entryPoint.base]
125
+ * Base URL prefix for references in this entry point
126
+ * @param {boolean|object} [entryPoint.bundling=true]
127
+ * Whether to enable bundling for this entry point
128
+ * @param {boolean|object} [entryPoint.minification=true]
129
+ * Whether to enable minification for this entry point
130
+ * @param {boolean} [entryPoint.versioning=true]
131
+ * Whether to enable versioning for this entry point
132
+ * @param {('search_param'|'filename')} [entryPoint.versioningMethod]
133
+ * How URLs are versioned for this entry point (defaults to "search_param")
134
+ * @param {('none'|'inline'|'file'|'programmatic')} [entryPoint.sourcemaps]
135
+ * Sourcemap generation strategy for this entry point (defaults to "none")
136
+ *
110
137
  * @return {Promise<Object>} buildReturnValue
111
- * @return {Promise<Object>} buildReturnValue.buildInlineContents
112
- * Contains content that is inline into build files
113
- * @return {Promise<Object>} buildReturnValue.buildManifest
114
- * Map build file paths without versioning to versioned file paths
138
+ * @return {Promise<Object>} [buildReturnValue.buildInlineContents]
139
+ * Contents that are inlined into build files (if returnBuildInlineContents is true)
140
+ * @return {Promise<Object>} [buildReturnValue.buildManifest]
141
+ * Map of build file paths without versioning to versioned file paths (if returnBuildManifest is true)
142
+ * @return {Promise<Object>} [buildReturnValue.buildFileVersions]
143
+ * Version information for build files (if returnBuildFileVersions is true)
115
144
  */
116
145
  export const build = async ({
117
146
  sourceDirectoryUrl,
@@ -874,6 +903,7 @@ export const build = async ({
874
903
 
875
904
  const entryPointDefaultParams = {
876
905
  buildRelativeUrl: undefined,
906
+ mode: undefined,
877
907
  runtimeCompat: defaultRuntimeCompat,
878
908
  plugins: [],
879
909
  mappings: undefined,
@@ -927,6 +957,7 @@ const prepareEntryPointBuild = async (
927
957
  ) => {
928
958
  let {
929
959
  buildRelativeUrl,
960
+ mode,
930
961
  runtimeCompat,
931
962
  plugins,
932
963
  mappings,
@@ -1001,7 +1032,7 @@ const prepareEntryPointBuild = async (
1001
1032
  assetsDirectory = `${assetsDirectory}/`;
1002
1033
  }
1003
1034
  if (entryPointParams.base === undefined) {
1004
- base = someEntryPointUseNode ? "./" : "/";
1035
+ base = mode === "package" || someEntryPointUseNode ? "./" : "/";
1005
1036
  }
1006
1037
  if (entryPointParams.bundling === undefined) {
1007
1038
  bundling = true;
@@ -1010,13 +1041,21 @@ const prepareEntryPointBuild = async (
1010
1041
  bundling = {};
1011
1042
  }
1012
1043
  if (entryPointParams.minification === undefined) {
1013
- minification = !someEntryPointUseNode;
1044
+ if (mode === "package" || someEntryPointUseNode) {
1045
+ minification = false;
1046
+ } else {
1047
+ minification = true;
1048
+ }
1014
1049
  }
1015
1050
  if (minification === true) {
1016
1051
  minification = {};
1017
1052
  }
1018
1053
  if (entryPointParams.versioning === undefined) {
1019
- versioning = !someEntryPointUseNode;
1054
+ if (mode === "package" || someEntryPointUseNode) {
1055
+ versioning = false;
1056
+ } else {
1057
+ versioning = true;
1058
+ }
1020
1059
  }
1021
1060
  if (entryPointParams.versioningMethod === undefined) {
1022
1061
  versioningMethod = entryPointDefaultParams.versioningMethod;
@@ -1025,7 +1064,14 @@ const prepareEntryPointBuild = async (
1025
1064
  assetManifest = versioningMethod === "filename";
1026
1065
  }
1027
1066
  if (entryPointParams.preserveComments === undefined) {
1028
- preserveComments = someEntryPointUseNode;
1067
+ if (mode === "package" || someEntryPointUseNode) {
1068
+ preserveComments = true;
1069
+ }
1070
+ }
1071
+ if (entryPointParams.sourcemaps === undefined) {
1072
+ if (mode === "package") {
1073
+ sourcemaps = "file";
1074
+ }
1029
1075
  }
1030
1076
  }
1031
1077
 
@@ -1052,6 +1098,7 @@ const prepareEntryPointBuild = async (
1052
1098
  ignoreProtocol: "keep",
1053
1099
  build: true,
1054
1100
  runtimeCompat,
1101
+ mode,
1055
1102
  initialContext: contextSharedDuringBuild,
1056
1103
  sourcemaps,
1057
1104
  sourcemapsSourcesContent,
@@ -1152,6 +1199,7 @@ const prepareEntryPointBuild = async (
1152
1199
  ignoreProtocol: "remove",
1153
1200
  build: true,
1154
1201
  runtimeCompat,
1202
+ mode,
1155
1203
  initialContext: contextSharedDuringBuild,
1156
1204
  sourcemaps,
1157
1205
  sourcemapsComment: "relative",
@@ -303,6 +303,11 @@ const detailsFromFirstReference = (reference) => {
303
303
  ) {
304
304
  return {};
305
305
  }
306
+ if (referenceInProject.type === "entry_point") {
307
+ return {
308
+ "first reference": referenceInProject.trace.message,
309
+ };
310
+ }
306
311
  return {
307
312
  "first reference in project": `${referenceInProject.trace.url}:${referenceInProject.trace.line}:${referenceInProject.trace.column}`,
308
313
  };
@@ -39,6 +39,7 @@ export const createKitchen = ({
39
39
  dev = false,
40
40
  build = false,
41
41
  runtimeCompat,
42
+ mode,
42
43
 
43
44
  ignore,
44
45
  ignoreProtocol = "remove",
@@ -88,7 +89,10 @@ export const createKitchen = ({
88
89
  }
89
90
 
90
91
  if (packageDependencies === "auto") {
91
- packageDependencies = build && nodeRuntimeEnabled ? "ignore" : "include";
92
+ packageDependencies =
93
+ build && (nodeRuntimeEnabled || mode === "package")
94
+ ? "ignore"
95
+ : "include";
92
96
  }
93
97
 
94
98
  const kitchen = {
@@ -475,7 +479,7 @@ ${ANSI.color(normalizedReturnValue, ANSI.YELLOW)}
475
479
  `no plugin has handled url during "fetchUrlContent" hook -> url will be ignored`,
476
480
  {
477
481
  "url": urlInfo.url,
478
- "url reference trace": urlInfo.firstReference.trace.message,
482
+ "url reference trace": urlInfo.firstReference?.trace.message,
479
483
  },
480
484
  ),
481
485
  );