Skip to content

Commit

Permalink
move external dependencies to devDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffersonRibeiro committed Feb 21, 2024
1 parent 49aad35 commit aca0016
Show file tree
Hide file tree
Showing 6 changed files with 2,317 additions and 3,660 deletions.
4 changes: 4 additions & 0 deletions packages/generator-widget/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Fixed

- We moved external dependencies to devDependencies as it is more logical since those packages are not bundled by Rollup. This change also fix a [Server-side Request Forgery](https://security.snyk.io/vuln/SNYK-JS-IP-6240864) vulnerability reported by Snyk.

## [10.7.1] - 2024-02-15

### Changed
Expand Down
4 changes: 4 additions & 0 deletions packages/pluggable-widgets-tools/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Fixed

- We moved external dependencies to devDependencies as it is more logical since those packages are not bundled by Rollup. This change also fix a [Server-side Request Forgery](https://security.snyk.io/vuln/SNYK-JS-IP-6240864) vulnerability reported by Snyk.

## [10.7.1] - 2024-02-15

### Fixed
Expand Down
44 changes: 20 additions & 24 deletions packages/pluggable-widgets-tools/configs/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ const assetsDirName = "assets";
const absoluteOutAssetsDir = join(absoluteOutPackageDir, assetsDirName);
const outAssetsDir = join(outWidgetDir, assetsDirName);

const commonExternalLibs = [
// "mendix" and internals under "mendix/"
/^mendix($|\/)/,

// "react"
/^react$/,

// "react/jsx-runtime"
/^react\/jsx-runtime$/,

// "react-dom"
/^react-dom$/
];

const webExternal = [...commonExternalLibs, /^big.js$/];

/**
* This function is used by postcss-url.
* Its main purpose to "adjust" asset path so that
Expand Down Expand Up @@ -115,7 +131,7 @@ export default async args => {
file: join(outDir, `${widgetName}.editorPreview.js`),
sourcemap: !production ? "inline" : false
},
external: editorPreviewExternal,
external: commonExternalLibs,
plugins: [
postcss({
extensions: [".css", ".sass", ".scss"],
Expand All @@ -131,7 +147,7 @@ export default async args => {
extensions,
transpile: production,
babelConfig: { presets: [["@babel/preset-env", { targets: { safari: "12" } }]] },
external: editorPreviewExternal
external: commonExternalLibs
})
],
onwarn
Expand All @@ -147,7 +163,7 @@ export default async args => {
file: join(outDir, `${widgetName}.editorConfig.js`),
sourcemap: false
},
external: editorConfigExternal,
external: commonExternalLibs,
treeshake: { moduleSideEffects: false },
plugins: [
url({ include: ["**/*.svg"], limit: 143360 }), // SVG file size limit of 140 kB
Expand All @@ -156,7 +172,7 @@ export default async args => {
extensions,
transpile: true,
babelConfig: { presets: [["@babel/preset-env", { targets: { ie: "11" } }]] },
external: editorConfigExternal
external: commonExternalLibs
})
],
onwarn
Expand Down Expand Up @@ -318,26 +334,6 @@ const imagesAndFonts = [
"**/*.eot"
];

const commonExternalLibs = [
// "mendix" and internals under "mendix/"
/^mendix($|\/)/,

// "react"
/^react$/,

// "react/jsx-runtime"
/^react\/jsx-runtime$/,

// "react-dom"
/^react-dom$/
];

const webExternal = commonExternalLibs.concat(/^big.js$/);

const editorPreviewExternal = commonExternalLibs;

const editorConfigExternal = commonExternalLibs;

export function postCssPlugin(outputFormat, production, postcssPlugins = []) {
return postcss({
extensions: [".css", ".sass", ".scss"],
Expand Down
60 changes: 30 additions & 30 deletions packages/pluggable-widgets-tools/configs/rollup.config.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,36 @@ const outWidgetFile = join(widgetPackage.replace(/\./g, "/"), widgetName.toLower
const mpkDir = join(sourcePath, "dist", widgetVersion);
const mpkFile = join(mpkDir, process.env.MPKOUTPUT ? process.env.MPKOUTPUT : `${widgetPackage}.${widgetName}.mpk`);

const extensions = [".js", ".jsx", ".tsx", ".ts"];

const editorConfigExternal = [
// "mendix" and internals under "mendix/"
/^mendix($|\/)/,

// "react"
/^react$/,

// "react/jsx-runtime"
/^react\/jsx-runtime$/,

// "react-dom"
/^react-dom$/
];

const nativeExternal = [
/^mendix($|\/)/,
/^react-native($|\/)/,
/^big.js$/,
/^react($|\/)/,
/^react-native-gesture-handler($|\/)/,
/^react-native-reanimated($|\/)/,
/^react-native-fast-image($|\/)/,
/^react-native-svg($|\/)/,
/^react-native-vector-icons($|\/)/,
/^react-navigation($|\/)/,
/^react-native-safe-area-context($|\/)/
];

export default async args => {
const production = Boolean(args.configProduction);

Expand Down Expand Up @@ -250,33 +280,3 @@ export default async args => {
}
}
};

const extensions = [".js", ".jsx", ".tsx", ".ts"];

const editorConfigExternal = [
// "mendix" and internals under "mendix/"
/^mendix($|\/)/,

// "react"
/^react$/,

// "react/jsx-runtime"
/^react\/jsx-runtime$/,

// "react-dom"
/^react-dom$/
];

const nativeExternal = [
/^mendix($|\/)/,
/^react-native($|\/)/,
/^big.js$/,
/^react($|\/)/,
/^react-native-gesture-handler($|\/)/,
/^react-native-reanimated($|\/)/,
/^react-native-fast-image($|\/)/,
/^react-native-svg($|\/)/,
/^react-native-vector-icons($|\/)/,
/^react-navigation($|\/)/,
/^react-native-safe-area-context($|\/)/
];
Loading

0 comments on commit aca0016

Please sign in to comment.