Skip to content

Commit c2f2568

Browse files
committed
Added Types to Main Class
1 parent 0c7934f commit c2f2568

File tree

2 files changed

+311
-163
lines changed

2 files changed

+311
-163
lines changed

packages/url-utils/rollup.config.js

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ import resolve from 'rollup-plugin-node-resolve';
55
import json from '@rollup/plugin-json';
66
import {terser} from 'rollup-plugin-terser';
77

8+
function onwarn(warning, warn) {
9+
// Suppress circular dependency warnings from dependencies (htmlparser2, cheerio)
10+
// These are harmless warnings from third-party libraries, not our code
11+
if (warning.code === 'CIRCULAR_DEPENDENCY' &&
12+
(warning.message.includes('htmlparser2') || warning.message.includes('cheerio'))) {
13+
return;
14+
}
15+
// Use default for everything else
16+
warn(warning);
17+
}
18+
819
export default [
920
// Node build.
1021
// No transpilation or bundling other than conversion from es modules to cjs
@@ -13,8 +24,11 @@ export default [
1324
output: {
1425
file: 'cjs/UrlUtils.js',
1526
format: 'cjs',
16-
interop: false
27+
interop: false,
28+
exports: 'default'
1729
},
30+
external: ['lodash', 'cheerio', 'moment', 'moment-timezone', 'remark', 'remark-footnotes', 'unist-util-visit', 'url', 'events', 'string_decoder', 'buffer'],
31+
onwarn,
1832
plugins: [
1933
typescript(),
2034
commonjs({
@@ -33,6 +47,8 @@ export default [
3347
format: 'es',
3448
sourcemap: true
3549
}],
50+
external: ['lodash', 'cheerio', 'moment', 'moment-timezone', 'remark', 'remark-footnotes', 'unist-util-visit', 'url', 'events', 'string_decoder', 'buffer'],
51+
onwarn,
3652
plugins: [
3753
resolve({
3854
browser: true
@@ -48,14 +64,27 @@ export default [
4864
// Standalone UMD browser build (minified).
4965
// Transpiles to es version supported by preset-env's default browsers list,
5066
// bundles all dependencies and polyfills.
67+
// Note: Dependencies are external - browser users need to provide them
5168
{
5269
input: 'src/UrlUtils.ts',
5370
output: {
5471
file: 'umd/url-utils.min.js',
5572
format: 'umd',
5673
name: 'GhostUrlUtils',
57-
sourcemap: true
74+
sourcemap: true,
75+
globals: {
76+
lodash: '_',
77+
cheerio: 'cheerio',
78+
moment: 'moment',
79+
'moment-timezone': 'moment',
80+
url: 'url',
81+
events: 'events',
82+
string_decoder: 'string_decoder',
83+
buffer: 'buffer'
84+
}
5885
},
86+
external: ['lodash', 'cheerio', 'moment', 'moment-timezone', 'remark', 'remark-footnotes', 'unist-util-visit', 'url', 'events', 'string_decoder', 'buffer'],
87+
onwarn,
5988
plugins: [
6089
resolve({
6190
browser: true

0 commit comments

Comments
 (0)