@jsenv/core 39.2.11 → 39.2.13

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/README.md CHANGED
@@ -12,69 +12,22 @@ Jsenv is a suite of tools that can be used in projects involving JavaScript.
12
12
  It favors standards and simplicity.
13
13
  As a result it can be enjoyed by people without much experience in tooling or seeking for simple tools without hidden complexities.
14
14
 
15
- If you want to try jsenv on your machine, use [#CLI](#cli).
15
+ If you want to try jsenv on your machine, use [@jsenv/cli](./packages/related/cli/readme.md).
16
16
 
17
- Link to [documentation](./docs/users/users.md)
18
-
19
- # CLI
20
-
21
- The following command init jsenv on your machine.
22
-
23
- ```console
24
- npx @jsenv/cli
25
- ```
26
-
27
- > If you don't have `npx` command you must [install Node.js](https://nodejs.org/en/download/package-manager)
28
-
29
- The command init jsenv in a directory. It can be a new directory or an existing one.
30
-
31
- ```console
32
- > npx @jsenv/cli
33
- Welcome in jsenv CLI
34
- ? Enter a directory: ›
35
- ```
36
-
37
- Then you'll be prompted to select a template.
38
-
39
- ```console
40
- > npx @jsenv/cli
41
- ✔ Enter a directory: › demo
42
- ? Select a template: › - Use arrow-keys. Return to submit.
43
- ❯ web
44
- web-components
45
- web-react
46
- web-preact
47
- node-package
48
- ```
49
-
50
- A template is a project pre-configured with jsenv.
51
- Selecting "web" would init [template-web/](./packages/related/cli/template-web/):
52
-
53
- ```console
54
- > npx @jsenv/cli
55
- ✔ Enter a directory: › demo
56
- ✔ Select a template: › web
57
- ✔ init jsenv in "[...]/demo/" (done in 0.01 second)
58
- ----- 2 commands to run -----
59
- cd demo
60
- npm install
61
- -----------------------------
62
- ```
63
-
64
- <!-- For example in order to start a dev server you would rather do `npm run dev` that would be declared in [package.json#scripts.dev](./packages/related/create-jsenv/demo-web/package.json#L8) to execute [scripts/dev.mjs](./packages/related/create-jsenv/demo-web/scripts/dev.mjs). -->
17
+ Link to [documentation](./md/users/users.md)
65
18
 
66
19
  # The best parts
67
20
 
68
- - Test files are [executed like standard files](./docs/users/d_test/d_test.md#14-executing-a-single-test)
69
- - [Isolated environment](./docs/users/d_test/d_test.md#33-isolated-environment) for each test file
70
- - Execute [tests in multiple browsers](./docs/users/d_test/d_test.md#32-execute-on-more-browsers>): Chrome, Safari, Firefox
71
- - [Large browser support during dev](./docs/users/b_dev/b_dev.md#21-browser-support>). Because some people might be happy to use an other browser than the latest chrome during dev. Moreover it is useful to reproduce bug specific to certain browsers.
72
- - [Large browser support after build](./docs/users/c_build/c_build.md#211-maximal-browser-support). Because some product still needs to support old versions of Firefox, Chrome and Safari.
73
- - [Single set of files after build](./docs/users/c_build/c_build.md#212-same-build-for-all-browsers). Because a single one is simpler to properly support in every aspects.
21
+ - Test files are [executed like standard files](./md/users/d_test/d_test.md#14-executing-a-single-test)
22
+ - [Isolated environment](./md/users/d_test/d_test.md#33-isolated-environment) for each test file
23
+ - Execute [tests in multiple browsers](./md/users/d_test/d_test.md#32-execute-on-more-browsers>): Chrome, Safari, Firefox
24
+ - [Large browser support during dev](./md/users/b_dev/b_dev.md#21-browser-support>). Because some people might be happy to use an other browser than the latest chrome during dev. Moreover it is useful to reproduce bug specific to certain browsers.
25
+ - [Large browser support after build](./md/users/c_build/c_build.md#211-maximal-browser-support). Because some product still needs to support old versions of Firefox, Chrome and Safari.
26
+ - [Single set of files after build](./md/users/c_build/c_build.md#212-same-build-for-all-browsers). Because a single one is simpler to properly support in every aspects.
74
27
  - Versioning during build is robust and <a href="https://bundlers.tooling.report/hashing/avoid-cascade/" target="_blank">avoids cascading hash changes</a><sup>↗</sup>
75
28
  - Advanced support of top level await, allowing to use it everywhere
76
29
  - Advanced support of web workers including worker type module
77
- - Unlock [js module features on a classic `<script>`](./docs/users/g_plugins/g_plugins.md#22-asjsclassic>).
30
+ - Unlock [js module features on a classic `<script>`](./md/users/g_plugins/g_plugins.md#22-asjsclassic>).
78
31
 
79
32
  <!--
80
33
  The following commands can be used to skip the prompt
@@ -1401,6 +1401,35 @@ const resourceToPathname = (resource) => {
1401
1401
  return resource;
1402
1402
  };
1403
1403
 
1404
+ const urlToFilename$1 = (url) => {
1405
+ const pathname = urlToPathname$1(url);
1406
+ return pathnameToFilename(pathname);
1407
+ };
1408
+
1409
+ const pathnameToFilename = (pathname) => {
1410
+ const pathnameBeforeLastSlash = pathname.endsWith("/")
1411
+ ? pathname.slice(0, -1)
1412
+ : pathname;
1413
+ const slashLastIndex = pathnameBeforeLastSlash.lastIndexOf("/");
1414
+ const filename =
1415
+ slashLastIndex === -1
1416
+ ? pathnameBeforeLastSlash
1417
+ : pathnameBeforeLastSlash.slice(slashLastIndex + 1);
1418
+ return filename;
1419
+ };
1420
+
1421
+ const urlToBasename = (url) => {
1422
+ const filename = urlToFilename$1(url);
1423
+ return filenameToBasename(filename);
1424
+ };
1425
+
1426
+ const filenameToBasename = (filename) => {
1427
+ const dotLastIndex = filename.lastIndexOf(".");
1428
+ const basename =
1429
+ dotLastIndex === -1 ? filename : filename.slice(0, dotLastIndex);
1430
+ return basename;
1431
+ };
1432
+
1404
1433
  const urlToExtension$1 = (url) => {
1405
1434
  const pathname = urlToPathname$1(url);
1406
1435
  return pathnameToExtension$1(pathname);
@@ -1554,14 +1583,13 @@ const renderUrlOrRelativeUrlFilename = (urlOrRelativeUrl, renderer) => {
1554
1583
  };
1555
1584
 
1556
1585
  const setUrlFilename = (url, filename) => {
1557
- const urlObject = new URL(url);
1558
- let { origin, search, hash } = urlObject;
1559
- // origin is "null" for "file://" urls with Node.js
1560
- if (origin === "null" && urlObject.href.startsWith("file:")) {
1561
- origin = "file://";
1562
- }
1563
- const parentPathname = new URL("./", urlObject).pathname;
1564
- return `${origin}${parentPathname}${filename}${search}${hash}`;
1586
+ const parentPathname = new URL("./", url).pathname;
1587
+ return transformUrlPathname(url, (pathname) => {
1588
+ if (typeof filename === "function") {
1589
+ filename = filename(pathnameToFilename(pathname));
1590
+ }
1591
+ return `${parentPathname}${filename}`;
1592
+ });
1565
1593
  };
1566
1594
 
1567
1595
  const transformUrlPathname = (url, transformer) => {
@@ -1773,27 +1801,6 @@ const urlIsInsideOf = (url, otherUrl) => {
1773
1801
  return isInside;
1774
1802
  };
1775
1803
 
1776
- const urlToFilename$1 = (url) => {
1777
- const pathname = urlToPathname$1(url);
1778
- const pathnameBeforeLastSlash = pathname.endsWith("/")
1779
- ? pathname.slice(0, -1)
1780
- : pathname;
1781
- const slashLastIndex = pathnameBeforeLastSlash.lastIndexOf("/");
1782
- const filename =
1783
- slashLastIndex === -1
1784
- ? pathnameBeforeLastSlash
1785
- : pathnameBeforeLastSlash.slice(slashLastIndex + 1);
1786
- return filename;
1787
- };
1788
-
1789
- const urlToBasename = (url) => {
1790
- const filename = urlToFilename$1(url);
1791
- const dotLastIndex = filename.lastIndexOf(".");
1792
- const basename =
1793
- dotLastIndex === -1 ? filename : filename.slice(0, dotLastIndex);
1794
- return basename;
1795
- };
1796
-
1797
1804
  const urlToFileSystemPath = (url) => {
1798
1805
  let urlString = String(url);
1799
1806
  if (urlString[urlString.length - 1] === "/") {
@@ -3283,6 +3290,203 @@ const writeDirectory = async (
3283
3290
  }
3284
3291
  };
3285
3292
 
3293
+ const mediaTypeInfos = {
3294
+ "application/json": {
3295
+ extensions: ["json", "map"],
3296
+ isTextual: true,
3297
+ },
3298
+ "application/importmap+json": {
3299
+ extensions: ["importmap"],
3300
+ isTextual: true,
3301
+ },
3302
+ "application/manifest+json": {
3303
+ extensions: ["webmanifest"],
3304
+ isTextual: true,
3305
+ },
3306
+ "application/octet-stream": {},
3307
+ "application/pdf": {
3308
+ extensions: ["pdf"],
3309
+ },
3310
+ "application/xml": {
3311
+ extensions: ["xml"],
3312
+ isTextual: true,
3313
+ },
3314
+ "application/x-gzip": {
3315
+ extensions: ["gz"],
3316
+ },
3317
+ "application/wasm": {
3318
+ extensions: ["wasm"],
3319
+ },
3320
+ "application/zip": {
3321
+ extensions: ["zip"],
3322
+ },
3323
+ "audio/basic": {
3324
+ extensions: ["au", "snd"],
3325
+ },
3326
+ "audio/mpeg": {
3327
+ extensions: ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"],
3328
+ },
3329
+ "audio/midi": {
3330
+ extensions: ["midi", "mid", "kar", "rmi"],
3331
+ },
3332
+ "audio/mp4": {
3333
+ extensions: ["m4a", "mp4a"],
3334
+ },
3335
+ "audio/ogg": {
3336
+ extensions: ["oga", "ogg", "spx"],
3337
+ },
3338
+ "audio/webm": {
3339
+ extensions: ["weba"],
3340
+ },
3341
+ "audio/x-wav": {
3342
+ extensions: ["wav"],
3343
+ },
3344
+ "font/ttf": {
3345
+ extensions: ["ttf"],
3346
+ },
3347
+ "font/woff": {
3348
+ extensions: ["woff"],
3349
+ },
3350
+ "font/woff2": {
3351
+ extensions: ["woff2"],
3352
+ },
3353
+ "image/png": {
3354
+ extensions: ["png"],
3355
+ },
3356
+ "image/gif": {
3357
+ extensions: ["gif"],
3358
+ },
3359
+ "image/jpeg": {
3360
+ extensions: ["jpg"],
3361
+ },
3362
+ "image/svg+xml": {
3363
+ extensions: ["svg", "svgz"],
3364
+ isTextual: true,
3365
+ },
3366
+ "text/plain": {
3367
+ extensions: ["txt"],
3368
+ isTextual: true,
3369
+ },
3370
+ "text/html": {
3371
+ extensions: ["html"],
3372
+ isTextual: true,
3373
+ },
3374
+ "text/css": {
3375
+ extensions: ["css"],
3376
+ isTextual: true,
3377
+ },
3378
+ "text/javascript": {
3379
+ extensions: ["js", "cjs", "mjs", "ts", "jsx", "tsx"],
3380
+ isTextual: true,
3381
+ },
3382
+ "text/markdown": {
3383
+ extensions: ["md", "mdx"],
3384
+ isTextual: true,
3385
+ },
3386
+ "text/x-sass": {
3387
+ extensions: ["sass"],
3388
+ isTextual: true,
3389
+ },
3390
+ "text/x-scss": {
3391
+ extensions: ["scss"],
3392
+ isTextual: true,
3393
+ },
3394
+ "text/cache-manifest": {
3395
+ extensions: ["appcache"],
3396
+ },
3397
+ "video/mp4": {
3398
+ extensions: ["mp4", "mp4v", "mpg4"],
3399
+ },
3400
+ "video/mpeg": {
3401
+ extensions: ["mpeg", "mpg", "mpe", "m1v", "m2v"],
3402
+ },
3403
+ "video/ogg": {
3404
+ extensions: ["ogv"],
3405
+ },
3406
+ "video/webm": {
3407
+ extensions: ["webm"],
3408
+ },
3409
+ };
3410
+
3411
+ const CONTENT_TYPE = {
3412
+ parse: (string) => {
3413
+ const [mediaType, charset] = string.split(";");
3414
+ return { mediaType: normalizeMediaType(mediaType), charset };
3415
+ },
3416
+
3417
+ stringify: ({ mediaType, charset }) => {
3418
+ if (charset) {
3419
+ return `${mediaType};${charset}`;
3420
+ }
3421
+ return mediaType;
3422
+ },
3423
+
3424
+ asMediaType: (value) => {
3425
+ if (typeof value === "string") {
3426
+ return CONTENT_TYPE.parse(value).mediaType;
3427
+ }
3428
+ if (typeof value === "object") {
3429
+ return value.mediaType;
3430
+ }
3431
+ return null;
3432
+ },
3433
+
3434
+ isJson: (value) => {
3435
+ const mediaType = CONTENT_TYPE.asMediaType(value);
3436
+ return (
3437
+ mediaType === "application/json" ||
3438
+ /^application\/\w+\+json$/.test(mediaType)
3439
+ );
3440
+ },
3441
+
3442
+ isTextual: (value) => {
3443
+ const mediaType = CONTENT_TYPE.asMediaType(value);
3444
+ if (mediaType.startsWith("text/")) {
3445
+ return true;
3446
+ }
3447
+ const mediaTypeInfo = mediaTypeInfos[mediaType];
3448
+ if (mediaTypeInfo && mediaTypeInfo.isTextual) {
3449
+ return true;
3450
+ }
3451
+ // catch things like application/manifest+json, application/importmap+json
3452
+ if (/^application\/\w+\+json$/.test(mediaType)) {
3453
+ return true;
3454
+ }
3455
+ return false;
3456
+ },
3457
+
3458
+ isBinary: (value) => !CONTENT_TYPE.isTextual(value),
3459
+
3460
+ asFileExtension: (value) => {
3461
+ const mediaType = CONTENT_TYPE.asMediaType(value);
3462
+ const mediaTypeInfo = mediaTypeInfos[mediaType];
3463
+ return mediaTypeInfo ? `.${mediaTypeInfo.extensions[0]}` : "";
3464
+ },
3465
+
3466
+ fromUrlExtension: (url) => {
3467
+ const { pathname } = new URL(url);
3468
+ const extensionWithDot = extname(pathname);
3469
+ if (!extensionWithDot || extensionWithDot === ".") {
3470
+ return "application/octet-stream";
3471
+ }
3472
+ const extension = extensionWithDot.slice(1);
3473
+ const mediaTypeFound = Object.keys(mediaTypeInfos).find((mediaType) => {
3474
+ const mediaTypeInfo = mediaTypeInfos[mediaType];
3475
+ return (
3476
+ mediaTypeInfo.extensions && mediaTypeInfo.extensions.includes(extension)
3477
+ );
3478
+ });
3479
+ return mediaTypeFound || "application/octet-stream";
3480
+ },
3481
+ };
3482
+
3483
+ const normalizeMediaType = (value) => {
3484
+ if (value === "application/javascript") {
3485
+ return "text/javascript";
3486
+ }
3487
+ return value;
3488
+ };
3489
+
3286
3490
  const writeFileSync = (destination, content = "") => {
3287
3491
  const destinationUrl = assertAndNormalizeFileUrl(destination);
3288
3492
  const destinationUrlObject = new URL(destinationUrl);
@@ -3552,203 +3756,6 @@ process.platform === "win32";
3552
3756
 
3553
3757
  process.platform === "win32";
3554
3758
 
3555
- const mediaTypeInfos = {
3556
- "application/json": {
3557
- extensions: ["json", "map"],
3558
- isTextual: true,
3559
- },
3560
- "application/importmap+json": {
3561
- extensions: ["importmap"],
3562
- isTextual: true,
3563
- },
3564
- "application/manifest+json": {
3565
- extensions: ["webmanifest"],
3566
- isTextual: true,
3567
- },
3568
- "application/octet-stream": {},
3569
- "application/pdf": {
3570
- extensions: ["pdf"],
3571
- },
3572
- "application/xml": {
3573
- extensions: ["xml"],
3574
- isTextual: true,
3575
- },
3576
- "application/x-gzip": {
3577
- extensions: ["gz"],
3578
- },
3579
- "application/wasm": {
3580
- extensions: ["wasm"],
3581
- },
3582
- "application/zip": {
3583
- extensions: ["zip"],
3584
- },
3585
- "audio/basic": {
3586
- extensions: ["au", "snd"],
3587
- },
3588
- "audio/mpeg": {
3589
- extensions: ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"],
3590
- },
3591
- "audio/midi": {
3592
- extensions: ["midi", "mid", "kar", "rmi"],
3593
- },
3594
- "audio/mp4": {
3595
- extensions: ["m4a", "mp4a"],
3596
- },
3597
- "audio/ogg": {
3598
- extensions: ["oga", "ogg", "spx"],
3599
- },
3600
- "audio/webm": {
3601
- extensions: ["weba"],
3602
- },
3603
- "audio/x-wav": {
3604
- extensions: ["wav"],
3605
- },
3606
- "font/ttf": {
3607
- extensions: ["ttf"],
3608
- },
3609
- "font/woff": {
3610
- extensions: ["woff"],
3611
- },
3612
- "font/woff2": {
3613
- extensions: ["woff2"],
3614
- },
3615
- "image/png": {
3616
- extensions: ["png"],
3617
- },
3618
- "image/gif": {
3619
- extensions: ["gif"],
3620
- },
3621
- "image/jpeg": {
3622
- extensions: ["jpg"],
3623
- },
3624
- "image/svg+xml": {
3625
- extensions: ["svg", "svgz"],
3626
- isTextual: true,
3627
- },
3628
- "text/plain": {
3629
- extensions: ["txt"],
3630
- isTextual: true,
3631
- },
3632
- "text/html": {
3633
- extensions: ["html"],
3634
- isTextual: true,
3635
- },
3636
- "text/css": {
3637
- extensions: ["css"],
3638
- isTextual: true,
3639
- },
3640
- "text/javascript": {
3641
- extensions: ["js", "cjs", "mjs", "ts", "jsx", "tsx"],
3642
- isTextual: true,
3643
- },
3644
- "text/markdown": {
3645
- extensions: ["md", "mdx"],
3646
- isTextual: true,
3647
- },
3648
- "text/x-sass": {
3649
- extensions: ["sass"],
3650
- isTextual: true,
3651
- },
3652
- "text/x-scss": {
3653
- extensions: ["scss"],
3654
- isTextual: true,
3655
- },
3656
- "text/cache-manifest": {
3657
- extensions: ["appcache"],
3658
- },
3659
- "video/mp4": {
3660
- extensions: ["mp4", "mp4v", "mpg4"],
3661
- },
3662
- "video/mpeg": {
3663
- extensions: ["mpeg", "mpg", "mpe", "m1v", "m2v"],
3664
- },
3665
- "video/ogg": {
3666
- extensions: ["ogv"],
3667
- },
3668
- "video/webm": {
3669
- extensions: ["webm"],
3670
- },
3671
- };
3672
-
3673
- const CONTENT_TYPE = {
3674
- parse: (string) => {
3675
- const [mediaType, charset] = string.split(";");
3676
- return { mediaType: normalizeMediaType(mediaType), charset };
3677
- },
3678
-
3679
- stringify: ({ mediaType, charset }) => {
3680
- if (charset) {
3681
- return `${mediaType};${charset}`;
3682
- }
3683
- return mediaType;
3684
- },
3685
-
3686
- asMediaType: (value) => {
3687
- if (typeof value === "string") {
3688
- return CONTENT_TYPE.parse(value).mediaType;
3689
- }
3690
- if (typeof value === "object") {
3691
- return value.mediaType;
3692
- }
3693
- return null;
3694
- },
3695
-
3696
- isJson: (value) => {
3697
- const mediaType = CONTENT_TYPE.asMediaType(value);
3698
- return (
3699
- mediaType === "application/json" ||
3700
- /^application\/\w+\+json$/.test(mediaType)
3701
- );
3702
- },
3703
-
3704
- isTextual: (value) => {
3705
- const mediaType = CONTENT_TYPE.asMediaType(value);
3706
- if (mediaType.startsWith("text/")) {
3707
- return true;
3708
- }
3709
- const mediaTypeInfo = mediaTypeInfos[mediaType];
3710
- if (mediaTypeInfo && mediaTypeInfo.isTextual) {
3711
- return true;
3712
- }
3713
- // catch things like application/manifest+json, application/importmap+json
3714
- if (/^application\/\w+\+json$/.test(mediaType)) {
3715
- return true;
3716
- }
3717
- return false;
3718
- },
3719
-
3720
- isBinary: (value) => !CONTENT_TYPE.isTextual(value),
3721
-
3722
- asFileExtension: (value) => {
3723
- const mediaType = CONTENT_TYPE.asMediaType(value);
3724
- const mediaTypeInfo = mediaTypeInfos[mediaType];
3725
- return mediaTypeInfo ? `.${mediaTypeInfo.extensions[0]}` : "";
3726
- },
3727
-
3728
- fromUrlExtension: (url) => {
3729
- const { pathname } = new URL(url);
3730
- const extensionWithDot = extname(pathname);
3731
- if (!extensionWithDot || extensionWithDot === ".") {
3732
- return "application/octet-stream";
3733
- }
3734
- const extension = extensionWithDot.slice(1);
3735
- const mediaTypeFound = Object.keys(mediaTypeInfos).find((mediaType) => {
3736
- const mediaTypeInfo = mediaTypeInfos[mediaType];
3737
- return (
3738
- mediaTypeInfo.extensions && mediaTypeInfo.extensions.includes(extension)
3739
- );
3740
- });
3741
- return mediaTypeFound || "application/octet-stream";
3742
- },
3743
- };
3744
-
3745
- const normalizeMediaType = (value) => {
3746
- if (value === "application/javascript") {
3747
- return "text/javascript";
3748
- }
3749
- return value;
3750
- };
3751
-
3752
3759
  const ensureEmptyDirectory = async (source) => {
3753
3760
  const stats = await readEntryStat(source, {
3754
3761
  nullIfNotFound: true,
@@ -19592,7 +19599,7 @@ const jsenvPluginAutoreloadClient = () => {
19592
19599
  url: htmlUrlInfo.url,
19593
19600
  });
19594
19601
  const autoreloadClientReference = htmlUrlInfo.dependencies.inject({
19595
- type: "js_import",
19602
+ type: "script",
19596
19603
  subtype: "js_module",
19597
19604
  expectedType: "js_module",
19598
19605
  specifier: autoreloadClientFileUrl,
@@ -20117,7 +20124,7 @@ const jsenvPluginRibbon = ({
20117
20124
  url: urlInfo.url,
20118
20125
  });
20119
20126
  const ribbonClientFileReference = urlInfo.dependencies.inject({
20120
- type: "js_import",
20127
+ type: "script",
20121
20128
  subtype: "js_module",
20122
20129
  expectedType: "js_module",
20123
20130
  specifier: ribbonClientFileUrl.href,
@@ -21777,8 +21784,10 @@ const defaultRuntimeCompat = {
21777
21784
  * Use versioning on files written in the build directory
21778
21785
  * @param {('search_param'|'filename')} [buildParameters.versioningMethod="search_param"]
21779
21786
  * Controls how url are versioned in the build directory
21780
- * @param {('none'|'inline'|'file'|'programmatic'} [buildParameters.sourcemaps="none"]
21787
+ * @param {('none'|'inline'|'file'|'programmatic')} [buildParameters.sourcemaps="none"]
21781
21788
  * Generate sourcemaps in the build directory
21789
+ * @param {('error'|'copy'|'preserve')|function} [buildParameters.directoryReferenceEffect="error"]
21790
+ * What to do when a reference leads to a directory on the filesystem
21782
21791
  * @return {Object} buildReturnValue
21783
21792
  * @return {Object} buildReturnValue.buildInlineContents
21784
21793
  * Contains content that is inline into build files
@@ -21825,6 +21834,8 @@ const build = async ({
21825
21834
  outDirectoryUrl,
21826
21835
  assetManifest = versioningMethod === "filename",
21827
21836
  assetManifestFileRelativeUrl = "asset-manifest.json",
21837
+ returnBuildInlineContents,
21838
+ returnBuildManifest,
21828
21839
  ...rest
21829
21840
  }) => {
21830
21841
  // param validation
@@ -22349,8 +22360,8 @@ build ${entryPointKeys.length} entry points`);
22349
22360
  }),
22350
22361
  );
22351
22362
  return {
22352
- buildInlineContents,
22353
- buildManifest,
22363
+ ...(returnBuildInlineContents ? { buildInlineContents } : {}),
22364
+ ...(returnBuildManifest ? { buildManifest } : {}),
22354
22365
  };
22355
22366
  };
22356
22367
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "39.2.11",
3
+ "version": "39.2.13",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -52,7 +52,7 @@
52
52
  "monorepo:publish": "node ./scripts/monorepo/publish_packages.mjs",
53
53
  "monorepo:upgrade_versions": "node ./scripts/monorepo/upgrade_external_versions.mjs",
54
54
  "monorepo:node_modules_clear": "npx @jsenv/snapshot clear **/node_modules/",
55
- "doc:build": "node ./docs/build.js",
55
+ "md:build": "node ./md/build.js",
56
56
  "performances": "node --expose-gc ./scripts/performance/generate_performance_report.mjs --log --once",
57
57
  "build:file_size": "node ./scripts/build/build_file_size.mjs --log",
58
58
  "prettier": "prettier --write .",
@@ -66,23 +66,24 @@
66
66
  "dependencies": {
67
67
  "@financial-times/polyfill-useragent-normaliser": "1.10.2",
68
68
  "@jsenv/abort": "4.3.0",
69
- "@jsenv/ast": "6.2.9",
70
- "@jsenv/filesystem": "4.9.5",
71
- "@jsenv/humanize": "1.2.6",
69
+ "@jsenv/ast": "6.2.11",
70
+ "@jsenv/filesystem": "4.9.6",
71
+ "@jsenv/humanize": "1.2.7",
72
72
  "@jsenv/importmap": "1.2.1",
73
73
  "@jsenv/integrity": "0.0.2",
74
- "@jsenv/js-module-fallback": "1.3.30",
74
+ "@jsenv/js-module-fallback": "1.3.32",
75
75
  "@jsenv/node-esm-resolution": "1.0.2",
76
- "@jsenv/plugin-bundling": "2.7.2",
76
+ "@jsenv/plugin-bundling": "2.7.3",
77
77
  "@jsenv/plugin-minification": "1.5.5",
78
- "@jsenv/plugin-supervisor": "1.5.10",
79
- "@jsenv/plugin-transpilation": "1.4.14",
78
+ "@jsenv/plugin-supervisor": "1.5.12",
79
+ "@jsenv/plugin-transpilation": "1.4.16",
80
80
  "@jsenv/runtime-compat": "1.3.1",
81
- "@jsenv/server": "15.2.16",
82
- "@jsenv/sourcemap": "1.2.19",
81
+ "@jsenv/server": "15.2.17",
82
+ "@jsenv/sourcemap": "1.2.20",
83
83
  "@jsenv/url-meta": "8.5.0",
84
- "@jsenv/urls": "2.4.1",
85
- "@jsenv/utils": "2.1.2"
84
+ "@jsenv/urls": "2.5.0",
85
+ "@jsenv/utils": "2.1.2",
86
+ "anchor-markdown-header": "0.7.0"
86
87
  },
87
88
  "devDependencies": {
88
89
  "@babel/eslint-parser": "7.24.8",
@@ -78,8 +78,10 @@ export const defaultRuntimeCompat = {
78
78
  * Use versioning on files written in the build directory
79
79
  * @param {('search_param'|'filename')} [buildParameters.versioningMethod="search_param"]
80
80
  * Controls how url are versioned in the build directory
81
- * @param {('none'|'inline'|'file'|'programmatic'} [buildParameters.sourcemaps="none"]
81
+ * @param {('none'|'inline'|'file'|'programmatic')} [buildParameters.sourcemaps="none"]
82
82
  * Generate sourcemaps in the build directory
83
+ * @param {('error'|'copy'|'preserve')|function} [buildParameters.directoryReferenceEffect="error"]
84
+ * What to do when a reference leads to a directory on the filesystem
83
85
  * @return {Object} buildReturnValue
84
86
  * @return {Object} buildReturnValue.buildInlineContents
85
87
  * Contains content that is inline into build files
@@ -126,6 +128,8 @@ export const build = async ({
126
128
  outDirectoryUrl,
127
129
  assetManifest = versioningMethod === "filename",
128
130
  assetManifestFileRelativeUrl = "asset-manifest.json",
131
+ returnBuildInlineContents,
132
+ returnBuildManifest,
129
133
  ...rest
130
134
  }) => {
131
135
  // param validation
@@ -652,8 +656,8 @@ build ${entryPointKeys.length} entry points`);
652
656
  }),
653
657
  );
654
658
  return {
655
- buildInlineContents,
656
- buildManifest,
659
+ ...(returnBuildInlineContents ? { buildInlineContents } : {}),
660
+ ...(returnBuildManifest ? { buildManifest } : {}),
657
661
  };
658
662
  };
659
663
 
@@ -16,7 +16,7 @@ export const jsenvPluginAutoreloadClient = () => {
16
16
  url: htmlUrlInfo.url,
17
17
  });
18
18
  const autoreloadClientReference = htmlUrlInfo.dependencies.inject({
19
- type: "js_import",
19
+ type: "script",
20
20
  subtype: "js_module",
21
21
  expectedType: "js_module",
22
22
  specifier: autoreloadClientFileUrl,
@@ -42,7 +42,7 @@ export const jsenvPluginRibbon = ({
42
42
  url: urlInfo.url,
43
43
  });
44
44
  const ribbonClientFileReference = urlInfo.dependencies.inject({
45
- type: "js_import",
45
+ type: "script",
46
46
  subtype: "js_module",
47
47
  expectedType: "js_module",
48
48
  specifier: ribbonClientFileUrl.href,