@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 +9 -0
- package/README.md +16 -6
- package/example/entry.js +3 -1
- package/example/one.js +3 -1
- package/lib/bundler.js +0 -3
- package/lib/parse-filenames/index.js +0 -1
- package/lib/resolve-filenames/index.js +0 -1
- package/package.json +2 -2
package/ChangeLog
ADDED
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
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
|
-
##
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
59
|
+
### IIFE
|
|
50
60
|
|
|
51
61
|
Most likely we need IIFE so couple bundles can be loaded on page simultaneously.
|
|
52
62
|
|
|
53
|
-
|
|
63
|
+
### Result Example
|
|
54
64
|
|
|
55
65
|
```js
|
|
56
66
|
const __modules = {};
|
package/example/entry.js
CHANGED
package/example/one.js
CHANGED
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]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/bundler",
|
|
3
|
-
"version": "1.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": "^
|
|
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",
|