-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create an ESM version of the package
- Loading branch information
1 parent
89a20bf
commit 6d29e3f
Showing
16 changed files
with
336 additions
and
5,220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
files: 'index.d.ts,esm/index.d.ts', | ||
from: /declare namespace[^}]*\}[^}]*\};/g, | ||
to: '\nexport = postcssRTLCSS', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import typescript from '@rollup/plugin-typescript'; | ||
import json from '@rollup/plugin-json'; | ||
import { terser } from "rollup-plugin-terser"; | ||
|
||
const getPlugins = (includeJson) => { | ||
const plugins = includeJson | ||
? [ | ||
json() | ||
] | ||
: []; | ||
return [ | ||
...plugins, | ||
typescript({ | ||
tsconfig: './tsconfig.json', | ||
declaration: true, | ||
outDir: './' | ||
}), | ||
terser({ | ||
output: { | ||
comments: false | ||
} | ||
}) | ||
]; | ||
}; | ||
|
||
const getConfig = (name, defaults = true) => ({ | ||
input: `src/${name}.ts`, | ||
external: [ | ||
'postcss', | ||
'rtlcss' | ||
], | ||
output: [ | ||
{ | ||
file: `dist/${name}.js`, | ||
format: 'cjs', | ||
exports: defaults ? 'default' : 'named' | ||
}, | ||
{ | ||
file: `dist/esm/${name}.js`, | ||
format: 'es', | ||
exports: defaults ? 'default' : 'named' | ||
} | ||
] | ||
}); | ||
|
||
export default [ | ||
{ | ||
plugins: getPlugins(true), | ||
...getConfig('index') | ||
}, | ||
{ | ||
plugins: getPlugins(), | ||
...getConfig('options', false) | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import dts from 'rollup-plugin-dts'; | ||
import tsconfig from './tsconfig.json'; | ||
|
||
const getConfig = (name) => ({ | ||
plugins: [ | ||
dts({ | ||
compilerOptions: { | ||
baseUrl: './dist', | ||
paths: tsconfig.compilerOptions.paths, | ||
} | ||
}) | ||
], | ||
input: `dist/${name}.d.ts`, | ||
output: [ | ||
{ | ||
file: `./${name}.d.ts` | ||
} | ||
] | ||
}); | ||
|
||
export default [ | ||
getConfig('index'), | ||
getConfig('options'), | ||
getConfig('esm/index'), | ||
getConfig('esm/options') | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#! /bin/sh | ||
|
||
RIMRAF="./node_modules/rimraf/bin.js" | ||
|
||
$RIMRAF dist/ | ||
$RIMRAF esm/ | ||
$RIMRAF index.js | ||
$RIMRAF index.d.ts | ||
$RIMRAF options.js | ||
$RIMRAF options.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#! /bin/sh | ||
|
||
mkdir esm | ||
|
||
## index | ||
cp dist/index.js index.js | ||
cp dist/esm/index.js esm/index.js | ||
|
||
# options | ||
cp dist/options.js options.js | ||
cp dist/esm/options.js esm/options.js | ||
|
||
# esm package | ||
cp package.esm.json esm/package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { Mode, Source, Autorename } from '@types'; | ||
|
||
export default { | ||
export { | ||
Mode, | ||
Source, | ||
Autorename | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.