fyn 2.1.5 → 3.0.0

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
@@ -3,7 +3,6 @@
3
3
  [![NPM version][npm-image]][npm-url]
4
4
  [![Apache 2.0 License][apache-2.0-blue-image]][apache-2.0-url]
5
5
  [![Build Status][build-image]][build-url]
6
- [![Coverage Status][coveralls-image]][coveralls-url]
7
6
 
8
7
  **fyn** is the package manager for [fynpo], a zero setup monorepo manager for node.js.
9
8
 
@@ -265,16 +264,10 @@ Licensed under the [Apache License, Version 2.0](https://www.apache.org/licenses
265
264
  [ini]: https://www.npmjs.com/package/ini
266
265
  [node_preserve_symlinks]: https://nodejs.org/docs/latest-v8.x/api/cli.html#cli_node_preserve_symlinks_1
267
266
  [require-at]: https://www.npmjs.com/package/require-at
268
- [travis-image]: https://travis-ci.org/electrode-io/fyn.svg?branch=master
269
- [travis-url]: https://travis-ci.org/electrode-io/fyn
267
+ [build-image]: https://github.com/jchip/fynjs/actions/workflows/ci.yml/badge.svg
268
+ [build-url]: https://github.com/jchip/fynjs/actions/workflows/ci.yml
270
269
  [npm-image]: https://badge.fury.io/js/fyn.svg
271
270
  [npm-url]: https://npmjs.org/package/fyn
272
- [coveralls-image]: https://coveralls.io/repos/github/electrode-io/fyn/badge.svg?branch=master
273
- [coveralls-url]: https://coveralls.io/github/electrode-io/fyn?branch=master
274
- [daviddm-image]: https://david-dm.org/electrode-io/fyn/status.svg
275
- [daviddm-url]: https://david-dm.org/electrode-io/fyn
276
- [daviddm-dev-image]: https://david-dm.org/electrode-io/fyn/dev-status.svg
277
- [daviddm-dev-url]: https://david-dm.org/electrode-io/fyn?type=dev
278
271
  [apache-2.0-blue-image]: https://img.shields.io/badge/License-Apache%202.0-blue.svg
279
272
  [apache-2.0-url]: https://www.apache.org/licenses/LICENSE-2.0
280
273
  [npm scripts]: https://docs.npmjs.com/misc/scripts
@@ -290,6 +283,3 @@ Licensed under the [Apache License, Version 2.0](https://www.apache.org/licenses
290
283
  [npm link]: https://docs.npmjs.com/cli/link.html
291
284
  [@npmcli/run-script]: https://www.npmjs.com/package/@npmcli/run-script
292
285
  [npmlog]: https://www.npmjs.com/package/npmlog
293
- [build-image]: https://github.com/jchip/fynpo/actions/workflows/ci.yml/badge.svg
294
- [build-url]: https://github.com/jchip/fynpo/actions/workflows/ci.yml
295
- [fynpo]: https://github.com/jchip/fynpo
package/bin/bundle.js CHANGED
@@ -17,7 +17,7 @@ if (maj >= 8) {
17
17
  console.log(`Failed loading v8-compile-cache`, err);
18
18
  }
19
19
  }
20
- module.exports = "../dist/fyn.js";
20
+ module.exports = "../dist/fyn.mjs";
21
21
  } else {
22
22
  console.log("Sorry, fyn does not support node version below 8. Your version is", maj);
23
23
  process.exit(1);
package/bin/index.js CHANGED
@@ -1,3 +1,24 @@
1
1
  "use strict";
2
2
 
3
- module.exports = require(require("./bundle"));
3
+ //
4
+ // The release bundle is ESM (dist/fyn.mjs) because chalker uses top-level await to optionally
5
+ // load ESM-only chalk, and no CJS output format can represent module-scope await.
6
+ //
7
+ // This file stays CJS so package.json can remain type: commonjs. Reaching an ESM bundle from
8
+ // CJS costs one async hop, so run/fun return promises - which is what bin/fyn.js and
9
+ // bin/fun.js already expected.
10
+ //
11
+ const Path = require("path");
12
+ const { pathToFileURL } = require("url");
13
+
14
+ const bundle = require("./bundle");
15
+
16
+ // resolve to an absolute file URL so the import does not depend on the caller's cwd
17
+ const bundleUrl = pathToFileURL(Path.join(__dirname, bundle)).href;
18
+
19
+ const loadBundle = () => import(bundleUrl).then(m => m.default || m);
20
+
21
+ module.exports = {
22
+ run: (...args) => loadBundle().then(m => m.run(...args)),
23
+ fun: (...args) => loadBundle().then(m => m.fun(...args))
24
+ };