@rolster/rollup 1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Rolster Technology
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/index.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ import type { Plugin } from 'rollup';
2
+
3
+ interface RolsterTypescriptOptions {
4
+ declaration: boolean;
5
+ declarationDir: string;
6
+ include: string[];
7
+ tsconfig: string;
8
+ }
9
+
10
+ interface RolsterOptions {
11
+ entryFiles: string[];
12
+ packages?: string[];
13
+ path?: string;
14
+ plugins?: Plugin[];
15
+ typescript?: Partial<RolsterTypescriptOptions>;
16
+ }
17
+
18
+ interface RollupOptions {
19
+ external: string[];
20
+ input: string[];
21
+ output: string[];
22
+ plugins: Plugin[];
23
+ }
24
+
25
+ export default function rolster(options: RolsterOptions): RollupOptions[];
package/index.js ADDED
@@ -0,0 +1,51 @@
1
+ import typescript from '@rollup/plugin-typescript';
2
+ import commonjs from '@rollup/plugin-commonjs';
3
+ import resolve from '@rollup/plugin-node-resolve';
4
+
5
+ function rollupInput(entryFile, path) {
6
+ return [`${path}/esm/${entryFile}.js`];
7
+ }
8
+
9
+ function rollupOutput(entryFile, path) {
10
+ return [
11
+ {
12
+ file: `${path}/cjs/${entryFile}.js`,
13
+ format: 'cjs',
14
+ sourcemap: true,
15
+ inlineDynamicImports: true
16
+ },
17
+ {
18
+ file: `${path}/es/${entryFile}.js`,
19
+ format: 'es',
20
+ sourcemap: true,
21
+ inlineDynamicImports: true
22
+ }
23
+ ];
24
+ }
25
+
26
+ export default function rolster(options) {
27
+ const { entryFiles, packages, path, plugins, typescript } = options;
28
+
29
+ const rolsterTypescript = {
30
+ tsconfig: './tsconfig.app.json',
31
+ declaration: true,
32
+ declarationDir: 'dist',
33
+ include: ['node_modules/@rolster/types/index.d.ts']
34
+ };
35
+
36
+ const rolsterPlugins = [
37
+ commonjs(),
38
+ resolve(),
39
+ typescript({ ...rolsterTypescript, ...typescript }),
40
+ ...(plugins || [])
41
+ ];
42
+
43
+ return entryFiles.map((entryFile) => {
44
+ return {
45
+ external: packages || [],
46
+ input: rollupInput(entryFile, path || 'dist'),
47
+ output: rollupOutput(entryFile, path || 'dist'),
48
+ plugins: rolsterPlugins
49
+ };
50
+ });
51
+ }
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@rolster/rollup",
3
+ "version": "1.0.0",
4
+ "description": "Package containing the basic definitions for handling data types.",
5
+ "license": "MIT",
6
+ "module": "index.js",
7
+ "main": "index.js",
8
+ "unpkg": "index.js",
9
+ "types": "index.d.ts",
10
+ "author": "Rolster Technology <rolster.developments@gmail.com>",
11
+ "contributors": [
12
+ {
13
+ "name": "Daniel Andrés Castillo Pedroza",
14
+ "email": "ing.dacastillop@gmail.com"
15
+ }
16
+ ],
17
+ "files": [
18
+ "index.js",
19
+ "index.d.ts"
20
+ ],
21
+ "dependencies": {
22
+ "@rollup/plugin-commonjs": "^25.0.4",
23
+ "@rollup/plugin-node-resolve": "^15.2.1",
24
+ "@rollup/plugin-typescript": "^11.1.3",
25
+ "rollup": "^2.32.0"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/rolster-developments/typescript-rollup.git"
30
+ },
31
+ "keywords": [
32
+ "rolster",
33
+ "typescript",
34
+ "rollup"
35
+ ],
36
+ "publishConfig": {
37
+ "access": "public"
38
+ }
39
+ }
package/readme.md ADDED
@@ -0,0 +1,44 @@
1
+ # Rolster Types
2
+
3
+ Package containing the basic definitions for handling data types.
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ npm i @rolster/types
9
+ ```
10
+
11
+ ## Configuration
12
+
13
+ The package path must be added in the `files` property in the `tsconfig.json` file
14
+
15
+ ```json
16
+ {
17
+ "files": ["node_modules/@rolster/types/index.d.ts"]
18
+ }
19
+ ```
20
+
21
+ ## Interfaces
22
+
23
+ | Name | Description |
24
+ | -------------- | --------------------------------------------------- |
25
+ | `Undefined<T>` | Allows to type a generic data with undefined value. |
26
+ | `Nulleable<T>` | Allows to type a generic data with nulleable value. |
27
+ | `Unknown<T>` | Allows to type a generic data with unknown value. |
28
+
29
+ ## Implementation
30
+
31
+ ```ts
32
+ // Variable can contain an string|undefined value
33
+ const value1: Undefined<string> = 'string' || undefined;
34
+
35
+ // Variable can contain an boolean|null value
36
+ const value2: Nulleable<boolean> = false || null;
37
+
38
+ // Variable can contain an number|unknown value
39
+ const value3: Unknown<number> = 1044 || unknown;
40
+ ```
41
+
42
+ ## Contributing
43
+
44
+ - Daniel Andrés Castillo Pedroza :rocket: