Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
2969d4ad7b | |||
2dbc1bd1e1 | |||
15c274be9e | |||
0a6a49b7ad | |||
0b6409b468 | |||
1c327e6526 | |||
00ab4d3610 | |||
0adb181bbf | |||
053ef1f770 | |||
d35f32d68f | |||
fb6207d963 | |||
e6c2288c24 | |||
b925fffc58 | |||
5289d2af92 | |||
b7d1321f3f | |||
3d32d703bf | |||
f2c02e6afc | |||
1a4ff7811c | |||
93431fc2e1 | |||
1c039592ce | |||
cb575d2427 | |||
d6ad2797cb |
3
.gitignore
vendored
3
.gitignore
vendored
@ -16,4 +16,5 @@ dist_web/
|
||||
dist_serve/
|
||||
dist_ts_web/
|
||||
|
||||
# custom
|
||||
# custom
|
||||
.rpt2_cache
|
@ -1,6 +0,0 @@
|
||||
const plugins = [
|
||||
'@babel/plugin-proposal-class-properties',
|
||||
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true } ],
|
||||
];
|
||||
|
||||
module.exports = { plugins };
|
3
cli.js
Normal file
3
cli.js
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
process.env.CLI_CALL = 'true';
|
||||
require('./dist/index');
|
4
cli.ts.js
Normal file
4
cli.ts.js
Normal file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
process.env.CLI_CALL = 'true';
|
||||
require('@gitzone/tsrun');
|
||||
require('./ts/index');
|
1195
package-lock.json
generated
1195
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@gitzone/tsbundle",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.16",
|
||||
"private": false,
|
||||
"description": "a bundler using rollup for painless bundling of web projects",
|
||||
"main": "dist/index.js",
|
||||
@ -8,28 +8,34 @@
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"test": "cd test && node ../cli.ts.js",
|
||||
"build": "(tsbuild)",
|
||||
"format": "(gitzone format)"
|
||||
},
|
||||
"bin": {
|
||||
"tsbundle": "cli.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.0.22",
|
||||
"@gitzone/tsrun": "^1.2.6",
|
||||
"@gitzone/tstest": "^1.0.15",
|
||||
"@pushrocks/tapbundle": "^3.0.7",
|
||||
"@types/node": "^10.11.7",
|
||||
"@types/node": "^11.13.8",
|
||||
"tslint": "^5.11.0",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.4.3",
|
||||
"@babel/core": "^7.4.4",
|
||||
"@babel/plugin-proposal-class-properties": "^7.4.4",
|
||||
"@babel/plugin-proposal-decorators": "^7.4.4",
|
||||
"@babel/preset-env": "^7.4.4",
|
||||
"@pushrocks/early": "^3.0.3",
|
||||
"@pushrocks/smartcli": "^3.0.7",
|
||||
"rollup": "^1.10.1",
|
||||
"rollup-plugin-babel": "^4.3.2",
|
||||
"rollup-plugin-commonjs": "^9.3.4",
|
||||
"rollup-plugin-json": "^4.0.0",
|
||||
"rollup-plugin-node-resolve": "^4.2.3",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
"rollup-plugin-typescript2": "^0.20.1"
|
||||
"rollup-plugin-typescript2": "^0.21.0"
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,18 @@ a bundler using rollup for painless bundling of web projects
|
||||
[](https://prettier.io/)
|
||||
|
||||
## Usage
|
||||
|
||||
Use TypeScript for best in class intellisense.
|
||||
|
||||
tsbundle will bundle modern JavaScript websites in an Google Bot conformant way so things like AdSense do work.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
|
||||
For further information read the linked docs at the top of this readme.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
|
||||
|
@ -1,37 +1,57 @@
|
||||
import resolve from 'rollup-plugin-node-resolve'
|
||||
import commonjs from 'rollup-plugin-commonjs'
|
||||
import sourceMaps from 'rollup-plugin-sourcemaps'
|
||||
import typescript from 'rollup-plugin-typescript2'
|
||||
import json from 'rollup-plugin-json'
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import sourceMaps from 'rollup-plugin-sourcemaps';
|
||||
import typescript from 'rollup-plugin-typescript2';
|
||||
import json from 'rollup-plugin-json';
|
||||
import babel from 'rollup-plugin-babel';
|
||||
|
||||
const pkg = require('./package.json')
|
||||
const pkg = require('./package.json');
|
||||
|
||||
export default {
|
||||
input: `src/index.ts`,
|
||||
input: `ts_web/index.ts`,
|
||||
output: {
|
||||
file: 'ts/index.ts',
|
||||
format: 'es',
|
||||
sourcemap: true
|
||||
},
|
||||
name: 'tsbundle',
|
||||
// file: 'dist_web/bundle.js',
|
||||
file: 'dist_web/bundle.js',
|
||||
format: 'iife',
|
||||
sourcemap: true
|
||||
},
|
||||
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
|
||||
external: [],
|
||||
watch: {
|
||||
include: 'src/**',
|
||||
include: 'src/**'
|
||||
},
|
||||
plugins: [
|
||||
// Allow json resolution
|
||||
json(),
|
||||
// Compile TypeScript files
|
||||
typescript({ useTsconfigDeclarationDir: true }),
|
||||
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
|
||||
commonjs(),
|
||||
typescript({ useTsconfigDeclarationDir: true, tsconfigOverride: {
|
||||
compilerOptions: {
|
||||
declaration: true,
|
||||
emitDecoratorMetadata: true,
|
||||
experimentalDecorators: true,
|
||||
inlineSourceMap: true,
|
||||
noEmitOnError: true,
|
||||
lib: ['es2016', 'es2017', 'dom'],
|
||||
noImplicitAny: false
|
||||
}
|
||||
} }),
|
||||
// Allow node_modules resolution, so you can use 'external' to control
|
||||
// which external modules to include in the bundle
|
||||
// https://github.com/rollup/rollup-plugin-node-resolve#usage
|
||||
resolve(),
|
||||
commonjs({
|
||||
namedExports: {
|
||||
'node_modules/@pushrocks/smartstate/dist/index.js': ['Smartstate']
|
||||
}
|
||||
}),
|
||||
|
||||
// Resolve source maps to the original source
|
||||
sourceMaps(),
|
||||
babel()
|
||||
],
|
||||
}
|
||||
babel({
|
||||
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
||||
babelrc: false,
|
||||
presets: [["@babel/preset-env", { modules: false }]]
|
||||
})
|
||||
]
|
||||
};
|
||||
|
3
test/ts_web/index.ts
Normal file
3
test/ts_web/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
const myConst = 'hello';
|
||||
|
||||
console.log(myConst);
|
59
ts/index.ts
59
ts/index.ts
@ -1,3 +1,60 @@
|
||||
import * as plugins from './tsbundle.plugins';
|
||||
|
||||
export let standardExport = 'Hi there! :) This is an exported string';
|
||||
const rollupOptions: plugins.rollup.RollupOptions = {
|
||||
input: `ts_web/index.ts`,
|
||||
output: {
|
||||
name: 'tsbundle',
|
||||
// file: 'dist_web/bundle.js',
|
||||
file: 'dist_web/bundle.js',
|
||||
format: 'iife',
|
||||
sourcemap: true
|
||||
},
|
||||
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
|
||||
external: [],
|
||||
watch: {
|
||||
include: ['src/**']
|
||||
},
|
||||
plugins: [
|
||||
// Compile TypeScript files
|
||||
plugins.rollupTypescript({
|
||||
useTsconfigDeclarationDir: true,
|
||||
tsconfigOverride: {
|
||||
compilerOptions: {
|
||||
declaration: true,
|
||||
emitDecoratorMetadata: true,
|
||||
experimentalDecorators: true,
|
||||
inlineSourceMap: true,
|
||||
noEmitOnError: true,
|
||||
lib: ['es2016', 'es2017', 'dom'],
|
||||
noImplicitAny: false
|
||||
}
|
||||
}
|
||||
}),
|
||||
// Allow node_modules resolution, so you can use 'external' to control
|
||||
// which external modules to include in the bundle
|
||||
// https://github.com/rollup/rollup-plugin-node-resolve#usage
|
||||
plugins.rollupResolve(),
|
||||
plugins.rollupCommonjs({
|
||||
namedExports: {
|
||||
'node_modules/@pushrocks/smartstate/dist/index.js': ['Smartstate']
|
||||
}
|
||||
}),
|
||||
|
||||
// Resolve source maps to the original source
|
||||
plugins.rollupSourceMaps(),
|
||||
plugins.rollupBabel({
|
||||
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
||||
babelrc: false,
|
||||
presets: [['@babel/preset-env', { modules: false }]]
|
||||
})
|
||||
]
|
||||
};
|
||||
|
||||
async function build() {
|
||||
// create a bundle
|
||||
const bundle = await plugins.rollup.rollup(rollupOptions);
|
||||
bundle.generate(rollupOptions.output);
|
||||
bundle.write(rollupOptions.output);
|
||||
}
|
||||
|
||||
build();
|
||||
|
@ -1,2 +1,15 @@
|
||||
const removeme = {};
|
||||
export { removeme };
|
||||
import * as rollup from 'rollup';
|
||||
import rollupBabel from 'rollup-plugin-babel';
|
||||
import rollupCommonjs from 'rollup-plugin-commonjs';
|
||||
import rollupResolve from 'rollup-plugin-node-resolve';
|
||||
import rollupSourceMaps from 'rollup-plugin-sourcemaps';
|
||||
import rollupTypescript from 'rollup-plugin-typescript2';
|
||||
|
||||
export {
|
||||
rollup,
|
||||
rollupBabel,
|
||||
rollupCommonjs,
|
||||
rollupResolve,
|
||||
rollupSourceMaps,
|
||||
rollupTypescript,
|
||||
};
|
1
ts/tsbundle.rollup.prepend.ts
Normal file
1
ts/tsbundle.rollup.prepend.ts
Normal file
@ -0,0 +1 @@
|
||||
import * as plugins from './tsbundle.plugins';
|
Reference in New Issue
Block a user