@putout/bundler 1.0.0 → 1.0.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.
package/ChangeLog ADDED
@@ -0,0 +1,9 @@
1
+ 2024.02.19, v1.0.1
2
+
3
+ fix:
4
+ - 375e409 readme: internals
5
+ - 080b5df readme: Bundle -> Bundler
6
+
7
+ feature:
8
+ - a2caadd @putout/bundler: @putout/plugin-nodejs v11.0.0
9
+ - 7ad6e51 @putout/bundler: add
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Bundle [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
1
+ # Bundler [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
2
2
 
3
3
  [NPMURL]: https://npmjs.org/package/@putout/bundler "npm"
4
4
  [NPMIMGURL]: https://img.shields.io/npm/v/@putout/bundler.svg?style=flat&longCache=true
@@ -15,12 +15,22 @@
15
15
  npm i @putout/bundle
16
16
  ```
17
17
 
18
- ## Convert ESM to CommonJS
18
+ ## API
19
+
20
+ ```js
21
+ import {bundle} from '@putout/bundler';
22
+
23
+ console.log(bundle(CWD, entry, filesystem));
24
+ ```
25
+
26
+ ## Internals
27
+
28
+ ### Convert ESM to CommonJS
19
29
 
20
30
  To Simplify things up all files converted to CommonJS first.
21
31
  Let's suppose none of them use top-level await to get things simpler.
22
32
 
23
- ## Parse filenames
33
+ ### Parse filenames
24
34
 
25
35
  Traverse all files starting from `entry` and get all filenames.
26
36
 
@@ -30,7 +40,7 @@ Traverse all files starting from `entry` and get all filenames.
30
40
  - [`resolve-require`](https://putout.cloudcmd.io/#/gist/833539f66cb238fcc3b6ca6cee61ef9e/79a068c96b686bb0eacdf3f570d532981499b114);
31
41
  - [`bundle-files`](https://putout.cloudcmd.io/#/gist/7dd3bffa8e88f7542c84065f622b63d7/3b1e68e0babc3a72af947076ed9801c0034a096e);
32
42
 
33
- ## Bundle all files to object
43
+ ### Bundle all files to object
34
44
 
35
45
  Traverse filesystem and create object that contains filename and file content:
36
46
 
@@ -46,11 +56,11 @@ const __filesystem = {
46
56
  };
47
57
  ```
48
58
 
49
- ## IIFE
59
+ ### IIFE
50
60
 
51
61
  Most likely we need IIFE so couple bundles can be loaded on page simultaneously.
52
62
 
53
- ## Result Example
63
+ ### Result Example
54
64
 
55
65
  ```js
56
66
  const __modules = {};
package/example/entry.js CHANGED
@@ -1,2 +1,4 @@
1
- const one = require("./one.js");
1
+ 'use strict';
2
+
3
+ const one = require('./one.js');
2
4
  console.log(one);
package/example/one.js CHANGED
@@ -1 +1,3 @@
1
- module.exports = "hello";
1
+ 'use strict';
2
+
3
+ module.exports = 'hello';
package/lib/bundler.js CHANGED
@@ -46,7 +46,6 @@ export const bundler = (from, entry, filesystem, {
46
46
  ],
47
47
  });
48
48
 
49
- debugger;
50
49
  const places = findPlaces(ast, filesystem, {
51
50
  rules: {
52
51
  'parse-filenames': ['on', {
@@ -58,8 +57,6 @@ export const bundler = (from, entry, filesystem, {
58
57
  ],
59
58
  });
60
59
 
61
- debugger;
62
-
63
60
  const code = print(ast);
64
61
 
65
62
  merge(filesystem, [code]);
@@ -17,7 +17,6 @@ const getMessage = ({message}) => message;
17
17
  export const report = (root, {file}) => file;
18
18
  export const fix = () => {};
19
19
  export const scan = (root, {push, options}) => {
20
- debugger;
21
20
  const {entry = '/index.js'} = options;
22
21
  const files = new Set();
23
22
  const processingNames = new Set([entry]);
@@ -33,4 +33,3 @@ export const scan = (root, {push, trackFile, options}) => {
33
33
  push(file);
34
34
  }
35
35
  };
36
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/bundler",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Lint Filesystem with 🐊Putout",
@@ -38,7 +38,7 @@
38
38
  "@putout/operator-filesystem": "^4.0.1",
39
39
  "@putout/operator-json": "^2.0.0",
40
40
  "@putout/plugin-filesystem": "^4.0.0",
41
- "@putout/plugin-nodejs": "^10.3.0",
41
+ "@putout/plugin-nodejs": "^11.0.0",
42
42
  "@putout/processor-filesystem": "^4.0.0",
43
43
  "chalk": "^5.3.0",
44
44
  "enquirer": "^2.4.1",