├── .prettierignore ├── qa ├── samples │ ├── packages │ │ ├── loaders │ │ │ ├── assets │ │ │ │ ├── .placeholder │ │ │ │ └── css │ │ │ │ │ └── styles.css │ │ │ ├── .npmignore │ │ │ ├── .npmbuildrc │ │ │ ├── src │ │ │ │ ├── file.json │ │ │ │ ├── css │ │ │ │ │ └── green-border.css │ │ │ │ ├── style │ │ │ │ │ └── red-border.css │ │ │ │ ├── blue-border.scss │ │ │ │ └── index.js │ │ │ ├── .gitignore │ │ │ ├── .npmbundlerrc │ │ │ └── package.json │ │ ├── alias-test │ │ │ ├── .gitignore │ │ │ ├── src │ │ │ │ ├── ignore │ │ │ │ │ ├── util.js │ │ │ │ │ ├── README.md │ │ │ │ │ ├── model │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── node_modules │ │ │ │ │ │ └── fs │ │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── package.json │ │ │ │ │ └── index.js │ │ │ │ ├── external-path-modules │ │ │ │ │ ├── README.md │ │ │ │ │ ├── browser │ │ │ │ │ │ ├── react.js │ │ │ │ │ │ └── react-module.js │ │ │ │ │ ├── node_modules │ │ │ │ │ │ └── react │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ └── path │ │ │ │ │ │ │ └── to │ │ │ │ │ │ │ └── module │ │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── package.json │ │ │ │ │ ├── inner │ │ │ │ │ │ └── index.js │ │ │ │ │ └── index.js │ │ │ │ ├── cartesian-product │ │ │ │ │ ├── model.js │ │ │ │ │ ├── random.js │ │ │ │ │ ├── things.js │ │ │ │ │ ├── display.js │ │ │ │ │ ├── platform.js │ │ │ │ │ ├── util │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── my-is-object.js │ │ │ │ │ ├── my-jss │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── browser │ │ │ │ │ │ ├── platform.js │ │ │ │ │ │ ├── random.js │ │ │ │ │ │ ├── things.js │ │ │ │ │ │ └── model │ │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── node_modules │ │ │ │ │ │ ├── jss │ │ │ │ │ │ │ └── index.js │ │ │ │ │ │ ├── fs │ │ │ │ │ │ │ └── index.js │ │ │ │ │ │ ├── react │ │ │ │ │ │ │ └── index.js │ │ │ │ │ │ ├── is-object │ │ │ │ │ │ │ └── index.js │ │ │ │ │ │ ├── fancy-util │ │ │ │ │ │ │ └── index.js │ │ │ │ │ │ └── fs-browser │ │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── README.md │ │ │ │ │ └── package.json │ │ │ │ ├── inner-override │ │ │ │ │ ├── README.md │ │ │ │ │ ├── is-object.js │ │ │ │ │ ├── inner │ │ │ │ │ │ ├── replaced.js │ │ │ │ │ │ ├── is-object.js │ │ │ │ │ │ ├── browser │ │ │ │ │ │ │ ├── is-object.js │ │ │ │ │ │ │ └── replaced.js │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── browser │ │ │ │ │ │ ├── replaced.js │ │ │ │ │ │ └── is-object.js │ │ │ │ │ ├── node_modules │ │ │ │ │ │ └── is-object │ │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── package.json │ │ │ │ │ └── index.js │ │ │ │ ├── parent-package │ │ │ │ │ ├── test │ │ │ │ │ │ ├── is-object.js │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ ├── browser │ │ │ │ │ │ │ └── is-object.js │ │ │ │ │ │ └── inner │ │ │ │ │ │ │ └── deep │ │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── node_modules │ │ │ │ │ │ └── is-object │ │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── README.md │ │ │ │ │ └── index.js │ │ │ │ ├── collision-pkg-file │ │ │ │ │ ├── test │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ ├── is-object.js │ │ │ │ │ │ └── browser │ │ │ │ │ │ │ └── is-object.js │ │ │ │ │ ├── README.md │ │ │ │ │ └── index.js │ │ │ │ ├── outside-precedence │ │ │ │ │ ├── README.md │ │ │ │ │ ├── inner-vs-outer │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ ├── inner │ │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ │ ├── file.js │ │ │ │ │ │ │ └── file-browser.js │ │ │ │ │ │ ├── file.js │ │ │ │ │ │ ├── file-browser.js │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── file-vs-module │ │ │ │ │ │ ├── file.js │ │ │ │ │ │ ├── file-browser-file.js │ │ │ │ │ │ ├── file-browser-module.js │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── index.js │ │ │ │ │ └── outside │ │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── scripts │ │ │ │ ├── clean.js │ │ │ │ └── remove-aliases.js │ │ │ ├── webpack.config.js │ │ │ ├── .npmbundlerrc │ │ │ └── package.json │ │ └── .gitignore │ ├── .gitignore │ ├── lerna.json │ └── package.json ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle ├── .gitignore ├── poshi │ ├── master │ │ └── tests │ │ │ └── HelloPoshi.testcase │ └── portal-ext.properties └── README.md ├── CODEOWNERS ├── resources └── devtools │ ├── find-generator │ ├── .gitignore │ ├── package.json │ └── find-generator.js │ └── link-js-toolkit │ ├── .gitignore │ ├── package.json │ ├── setup-project.js │ └── link-js-toolkit.js ├── .editorconfig ├── packages ├── generator-liferay-js │ ├── src │ │ ├── adapt │ │ │ └── templates │ │ │ │ ├── .npmbuildrc.ejs │ │ │ │ ├── .npmbundlerrc.ejs │ │ │ │ └── features │ │ │ │ └── localization │ │ │ │ └── Language.properties.ejs │ │ ├── facet-project │ │ │ └── templates │ │ │ │ ├── .npmbuildrc.ejs │ │ │ │ ├── .npmignore.ejs │ │ │ │ ├── assets │ │ │ │ └── .placeholder.ejs │ │ │ │ ├── README.md.ejs │ │ │ │ ├── .gitignore.ejs │ │ │ │ ├── .npmbundlerrc.ejs │ │ │ │ └── package.json.ejs │ │ ├── facet-portlet │ │ │ └── templates │ │ │ │ └── assets │ │ │ │ └── css │ │ │ │ └── styles.css.ejs │ │ ├── utils │ │ │ ├── __tests__ │ │ │ │ └── __fixtures__ │ │ │ │ │ ├── prj-without-l10n │ │ │ │ │ └── .npmbundlerrc │ │ │ │ │ ├── prj-with-implicit-l10n │ │ │ │ │ ├── .npmbundlerrc │ │ │ │ │ └── features │ │ │ │ │ │ └── localization │ │ │ │ │ │ └── Language.properties │ │ │ │ │ ├── prj-without-description │ │ │ │ │ └── package.json │ │ │ │ │ ├── prj │ │ │ │ │ └── package.json │ │ │ │ │ └── prj-with-explicit-l10n │ │ │ │ │ └── .npmbundlerrc │ │ │ └── modifier │ │ │ │ ├── gitignore.js │ │ │ │ └── assets │ │ │ │ └── css │ │ │ │ └── styles.css.js │ │ ├── facet-localization │ │ │ ├── templates │ │ │ │ └── features │ │ │ │ │ └── localization │ │ │ │ │ └── Language.properties.ejs │ │ │ └── constants.js │ │ ├── target-shared-bundle │ │ │ ├── templates │ │ │ │ ├── .babelrc.ejs │ │ │ │ └── src │ │ │ │ │ └── index.js.ejs │ │ │ ├── target-description.json │ │ │ └── index.js │ │ ├── target-vuejs-portlet │ │ │ ├── templates │ │ │ │ └── .babelrc.ejs │ │ │ ├── target-description.json │ │ │ ├── dependencies.json │ │ │ └── index.js │ │ ├── target-vanilla-portlet │ │ │ ├── templates │ │ │ │ └── .babelrc.ejs │ │ │ ├── target-description.json │ │ │ └── index.js │ │ ├── target-react-portlet │ │ │ ├── templates │ │ │ │ ├── .babelrc.ejs │ │ │ │ └── src │ │ │ │ │ ├── index.js.ejs │ │ │ │ │ └── AppComponent.js.ejs │ │ │ ├── target-description.json │ │ │ ├── dependencies.json │ │ │ └── index.js │ │ ├── target-metaljs-portlet │ │ │ ├── templates │ │ │ │ ├── .babelrc.ejs │ │ │ │ └── src │ │ │ │ │ └── index.js.ejs │ │ │ ├── target-description.json │ │ │ ├── imports.json │ │ │ ├── dependencies.json │ │ │ └── index.js │ │ ├── target-angular-portlet │ │ │ ├── target-description.json │ │ │ ├── templates │ │ │ │ ├── src │ │ │ │ │ ├── polyfills.ts.ejs │ │ │ │ │ ├── types │ │ │ │ │ │ └── LiferayParams.ts.ejs │ │ │ │ │ └── app │ │ │ │ │ │ ├── app.module.ts.ejs │ │ │ │ │ │ └── app.component.ts.ejs │ │ │ │ ├── tsconfig.json.ejs │ │ │ │ └── assets │ │ │ │ │ └── app │ │ │ │ │ └── app.component.html.ejs │ │ │ └── index.js │ │ └── facet-configuration │ │ │ ├── constants.js │ │ │ └── templates │ │ │ └── features │ │ │ └── configuration.json.ejs │ ├── copyfiles.json │ ├── .babelrc │ ├── tsconfig.json │ ├── README.md │ └── package.json ├── liferay-npm-build-tools-common │ ├── src │ │ ├── __tests__ │ │ │ ├── __fixtures__ │ │ │ │ ├── alias │ │ │ │ │ ├── cache.json │ │ │ │ │ ├── invalid.json │ │ │ │ │ ├── normalize.json │ │ │ │ │ ├── typical.json │ │ │ │ │ └── multiple.json │ │ │ │ ├── packages │ │ │ │ │ └── a-package │ │ │ │ │ │ ├── no-package-json │ │ │ │ │ │ ├── file.js.js │ │ │ │ │ │ └── index.js │ │ │ │ │ │ ├── with-package-json │ │ │ │ │ │ ├── no-dot │ │ │ │ │ │ │ ├── no-extension │ │ │ │ │ │ │ │ ├── file.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ └── with-extension │ │ │ │ │ │ │ │ ├── file.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ └── with-dot │ │ │ │ │ │ │ ├── no-extension │ │ │ │ │ │ │ ├── file.js │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ └── with-extension │ │ │ │ │ │ │ ├── file.js │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ └── package.json │ │ │ │ └── babel-util │ │ │ │ │ ├── .npmbundlerrc │ │ │ │ │ ├── package.json │ │ │ │ │ ├── build │ │ │ │ │ ├── package.json │ │ │ │ │ └── node_modules │ │ │ │ │ │ ├── a-package@1.0.0 │ │ │ │ │ │ └── package.json │ │ │ │ │ │ └── @a-scoped%2Fpackage@1.0.0 │ │ │ │ │ │ └── package.json │ │ │ │ │ └── node_modules │ │ │ │ │ ├── a-package │ │ │ │ │ └── package.json │ │ │ │ │ └── @a-scoped │ │ │ │ │ └── package │ │ │ │ │ └── package.json │ │ │ ├── globs.test.js │ │ │ ├── plugin-logger.test.js │ │ │ └── __snapshots__ │ │ │ │ ├── plugin-logger.test.js.snap │ │ │ │ └── imports.test.js.snap │ │ ├── project │ │ │ ├── __tests__ │ │ │ │ └── __fixtures__ │ │ │ │ │ ├── pkg-manager │ │ │ │ │ ├── both │ │ │ │ │ │ ├── yarn.lock │ │ │ │ │ │ ├── package-lock.json │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── yarn │ │ │ │ │ │ ├── yarn.lock │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── npm │ │ │ │ │ │ ├── package-lock.json │ │ │ │ │ │ └── package.json │ │ │ │ │ └── none │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── project │ │ │ │ │ ├── create-jar │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── .npmbundlerrc │ │ │ │ │ ├── create-jar-empty │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── .npmbundlerrc │ │ │ │ │ ├── bool-create-jar │ │ │ │ │ │ ├── .npmbundlerrc │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── false-create-jar │ │ │ │ │ │ ├── .npmbundlerrc │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── with-preset │ │ │ │ │ │ ├── .npmbundlerrc │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── node_modules │ │ │ │ │ │ │ └── test-preset │ │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ │ └── config.json │ │ │ │ │ ├── standard │ │ │ │ │ │ ├── features │ │ │ │ │ │ │ ├── localization │ │ │ │ │ │ │ │ ├── Language.properties │ │ │ │ │ │ │ │ └── Language_es_ES.properties │ │ │ │ │ │ │ └── manifest.json │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── .npmbundlerrc │ │ │ │ │ ├── empty │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── transform │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ ├── node_modules │ │ │ │ │ │ │ ├── liferay-npm-bundler-plugin-test-0 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ ├── liferay-npm-bundler-plugin-test-1 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ ├── liferay-npm-bundler-plugin-test-2 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ ├── liferay-npm-bundler-plugin-test-3 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ ├── liferay-npm-bundler-plugin-test-4 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ ├── liferay-npm-bundler-plugin-test-5 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ ├── liferay-npm-bundler-plugin-test-6 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ └── liferay-npm-bundler-plugin-test-7 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ └── .npmbundlerrc │ │ │ │ │ ├── versions-info │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ ├── node_modules │ │ │ │ │ │ │ ├── loader-0 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ ├── babel-plugin-test-0 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ ├── babel-plugins │ │ │ │ │ │ │ │ ├── dir │ │ │ │ │ │ │ │ │ ├── plugin-0.js │ │ │ │ │ │ │ │ │ └── plugin-1.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ ├── bundler-plugins │ │ │ │ │ │ │ │ ├── dir │ │ │ │ │ │ │ │ │ ├── loader-0.js │ │ │ │ │ │ │ │ │ ├── loader-1.js │ │ │ │ │ │ │ │ │ ├── plugin-0.js │ │ │ │ │ │ │ │ │ └── plugin-1.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ ├── liferay-npm-bundler-plugin-test-0 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ └── liferay-npm-bundler-plugin-test-1 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ └── .npmbundlerrc │ │ │ │ │ └── with-module-cfg │ │ │ │ │ │ ├── node_modules │ │ │ │ │ │ ├── a-config │ │ │ │ │ │ │ ├── preset.json │ │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ │ ├── my-js-loader.js │ │ │ │ │ │ │ ├── my-babel-plugin.js │ │ │ │ │ │ │ ├── my-copy-plugin.js │ │ │ │ │ │ │ ├── my-pre-plugin.js │ │ │ │ │ │ │ ├── my-post-plugin.js │ │ │ │ │ │ │ └── my-babel-preset.js │ │ │ │ │ │ └── a-package │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── .npmbundlerrc │ │ │ │ │ ├── legacy │ │ │ │ │ ├── packages-cfg │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ ├── node_modules │ │ │ │ │ │ │ ├── liferay-npm-bundler-plugin-test-0 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ ├── liferay-npm-bundler-plugin-test-1 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ ├── liferay-npm-bundler-plugin-test-2 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ │ └── liferay-npm-bundler-plugin-test-4 │ │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ │ └── package.json │ │ │ │ │ │ └── .npmbundlerrc │ │ │ │ │ ├── auto-deploy-portlet │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── .npmbundlerrc │ │ │ │ │ ├── context-path-1 │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── .npmbundlerrc │ │ │ │ │ └── context-path-2 │ │ │ │ │ │ └── package.json │ │ │ │ │ └── default-features │ │ │ │ │ ├── .npmbundlerrc │ │ │ │ │ ├── features │ │ │ │ │ └── localization │ │ │ │ │ │ └── Language.properties │ │ │ │ │ └── package.json │ │ │ └── types.ts │ │ └── globs.ts │ ├── tsconfig.json │ └── package.json ├── liferay-npm-build-support │ ├── bin │ │ ├── lnbs-build.js │ │ ├── lnbs-start.js │ │ ├── lnbs-deploy.js │ │ ├── lnbs-translate.js │ │ ├── lnbs-copy-assets.js │ │ └── lnbs-copy-sources.js │ ├── README.md │ ├── tsconfig.json │ ├── src │ │ ├── resources │ │ │ ├── build │ │ │ │ ├── angular-cli │ │ │ │ │ └── adapt-rt.js.ejs │ │ │ │ ├── vue-cli │ │ │ │ │ ├── adapt-rt.js.ejs │ │ │ │ │ └── index.js.ejs │ │ │ │ └── create-react-app │ │ │ │ │ ├── adapt-rt.js.ejs │ │ │ │ │ └── index.js.ejs │ │ │ └── start │ │ │ │ ├── index.html.ejs │ │ │ │ ├── index.js.ejs │ │ │ │ └── webpack.config.js.ejs │ │ ├── scripts │ │ │ ├── copy-sources.js │ │ │ ├── copy-assets.js │ │ │ └── deploy.js │ │ └── loader │ │ │ ├── __tests__ │ │ │ └── util.test.ts │ │ │ └── remove-webpack-hash.ts │ └── package.json ├── babel-plugin-namespace-modules │ ├── src │ │ └── __tests__ │ │ │ └── __fixtures__ │ │ │ └── a-project │ │ │ ├── .npmbundlerrc │ │ │ ├── package.json │ │ │ └── node_modules │ │ │ ├── a-package │ │ │ └── package.json │ │ │ └── @a-scoped │ │ │ └── package │ │ │ └── package.json │ ├── tsconfig.json │ └── package.json ├── liferay-npm-imports-checker │ ├── src │ │ └── __tests__ │ │ │ └── __fixtures__ │ │ │ ├── .npmimportscheckrc │ │ │ └── modules │ │ │ ├── a-project │ │ │ ├── package.json │ │ │ └── .npmimportscheckrc │ │ │ └── o-project │ │ │ ├── package.json │ │ │ └── .npmimportscheckrc │ ├── bin │ │ └── liferay-npm-imports-checker.js │ ├── tsconfig.json │ ├── README.md │ └── package.json ├── babel-plugin-add-module-metadata │ ├── src │ │ └── __tests__ │ │ │ └── __fixtures__ │ │ │ └── a-project │ │ │ └── package.json │ ├── tsconfig.json │ ├── package.json │ └── README.md ├── babel-plugin-name-amd-modules │ ├── src │ │ └── __tests__ │ │ │ └── __fixtures__ │ │ │ └── a-project │ │ │ └── package.json │ ├── tsconfig.json │ └── package.json ├── liferay-npm-bundler │ ├── src │ │ ├── steps │ │ │ └── __tests__ │ │ │ │ ├── __fixtures__ │ │ │ │ ├── rules-project │ │ │ │ │ ├── .npmbundlerrc │ │ │ │ │ └── package.json │ │ │ │ └── sourcemaps │ │ │ │ │ ├── main.js.map │ │ │ │ │ ├── sourceMapFile1.js.file │ │ │ │ │ └── sourceMapFile2.js.file │ │ │ │ └── transform.test.js │ │ ├── __tests__ │ │ │ └── __fixtures__ │ │ │ │ └── project │ │ │ │ ├── node_modules │ │ │ │ ├── stale-package │ │ │ │ │ └── package.json │ │ │ │ ├── test-project-dep-0 │ │ │ │ │ └── package.json │ │ │ │ └── test-project-dep-1 │ │ │ │ │ ├── node_modules │ │ │ │ │ └── test-project-dep-0 │ │ │ │ │ │ └── package.json │ │ │ │ │ └── package.json │ │ │ │ └── package.json │ │ ├── manifest.js │ │ ├── jar │ │ │ └── __tests__ │ │ │ │ └── __fixtures__ │ │ │ │ ├── metatype.xml │ │ │ │ ├── preferences.l10n.json │ │ │ │ └── preferences.json │ │ └── log.js │ ├── tsconfig.json │ ├── README.md │ ├── bin │ │ └── liferay-npm-bundler.js │ └── package.json ├── liferay-npm-bundler-loader-css-loader │ ├── src │ │ └── __tests__ │ │ │ └── __fixtures__ │ │ │ ├── a-project │ │ │ ├── package.json │ │ │ └── .npmbundlerrc │ │ │ └── java-project │ │ │ ├── package.json │ │ │ └── bnd.bnd │ ├── tsconfig.json │ └── package.json ├── liferay-npm-bundler-loader-sass-loader │ ├── src │ │ └── __tests__ │ │ │ └── __fixtures__ │ │ │ └── project │ │ │ └── package.json │ ├── tsconfig.json │ ├── package.json │ └── README.md ├── liferay-npm-bridge-generator │ ├── bin │ │ └── liferay-npm-bridge-generator.js │ ├── tsconfig.json │ ├── README.md │ └── package.json ├── babel-plugin-alias-modules │ ├── src │ │ └── __tests__ │ │ │ └── __fixtures__ │ │ │ └── path │ │ │ └── to │ │ │ ├── overriden │ │ │ ├── child │ │ │ │ └── package.json │ │ │ └── package.json │ │ │ ├── ignored │ │ │ └── package.json │ │ │ ├── colliding │ │ │ └── package.json │ │ │ └── in │ │ │ ├── folder │ │ │ └── aliased │ │ │ │ └── package.json │ │ │ └── parent │ │ │ └── package.json │ ├── tsconfig.json │ └── package.json ├── liferay-npm-bundler-plugin-inject-peer-dependencies │ ├── src │ │ └── __tests__ │ │ │ └── __fixtures__ │ │ │ └── project │ │ │ ├── node_modules │ │ │ ├── .eslintrc │ │ │ ├── number-is-nan │ │ │ │ └── package.json │ │ │ ├── @scope │ │ │ │ ├── number-is-nan │ │ │ │ │ └── package.json │ │ │ │ ├── is-finite │ │ │ │ │ └── package.json │ │ │ │ └── pkg-with-peer-deps │ │ │ │ │ ├── package.json │ │ │ │ │ └── index.js │ │ │ ├── @project$1.0.0$scope │ │ │ │ ├── number-is-nan │ │ │ │ │ └── package.json │ │ │ │ ├── is-finite │ │ │ │ │ └── package.json │ │ │ │ └── pkg-with-peer-deps │ │ │ │ │ ├── package.json │ │ │ │ │ └── index.js │ │ │ ├── is-finite │ │ │ │ └── package.json │ │ │ ├── pkg-for-logs │ │ │ │ ├── package.json │ │ │ │ └── index.js │ │ │ └── pkg-with-peer-deps │ │ │ │ ├── package.json │ │ │ │ └── index.js │ │ │ └── package.json │ ├── tsconfig.json │ └── package.json ├── babel-plugin-wrap-modules-amd │ ├── tsconfig.json │ ├── package.json │ ├── src │ │ └── __tests__ │ │ │ └── __snapshots__ │ │ │ └── index.test.js.snap │ └── README.md ├── babel-preset-liferay-standard │ ├── tsconfig.json │ └── package.json ├── babel-plugin-namespace-amd-define │ ├── tsconfig.json │ ├── package.json │ └── README.md ├── babel-plugin-normalize-requires │ ├── tsconfig.json │ ├── package.json │ └── README.md ├── liferay-npm-bundler-plugin-namespace-packages │ ├── src │ │ ├── __tests__ │ │ │ ├── __fixtures__ │ │ │ │ └── project │ │ │ │ │ ├── package.json │ │ │ │ │ └── node_modules │ │ │ │ │ └── is-finite │ │ │ │ │ └── package.json │ │ │ └── __snapshots__ │ │ │ │ └── index.test.js.snap │ │ └── index.js │ ├── tsconfig.json │ └── package.json ├── liferay-npm-bundler-loader-babel-loader │ ├── tsconfig.json │ ├── package.json │ └── README.md ├── liferay-npm-bundler-loader-copy-loader │ ├── tsconfig.json │ ├── package.json │ ├── README.md │ └── src │ │ └── index.js ├── liferay-npm-bundler-loader-json-loader │ ├── tsconfig.json │ ├── package.json │ ├── src │ │ ├── __tests__ │ │ │ └── __snapshots__ │ │ │ │ └── index.test.js.snap │ │ └── index.js │ └── README.md ├── liferay-npm-bundler-loader-style-loader │ ├── tsconfig.json │ ├── package.json │ ├── README.md │ └── src │ │ └── index.js ├── liferay-npm-bundler-plugin-exclude-imports │ ├── tsconfig.json │ ├── package.json │ ├── README.md │ └── src │ │ └── index.js ├── liferay-npm-bundler-plugin-inject-imports-dependencies │ ├── tsconfig.json │ ├── package.json │ └── README.md ├── liferay-npm-bundler-plugin-replace-browser-modules │ ├── tsconfig.json │ └── package.json ├── liferay-npm-bundler-plugin-resolve-linked-dependencies │ ├── tsconfig.json │ ├── package.json │ ├── README.md │ └── src │ │ └── index.js ├── liferay-npm-bundler-preset-angular-cli │ ├── package.json │ └── README.md ├── liferay-npm-bundler-preset-vue-cli │ ├── package.json │ └── README.md ├── liferay-npm-bundler-preset-create-react-app │ ├── package.json │ └── README.md └── liferay-npm-bundler-preset-standard │ ├── config.json │ ├── package.json │ └── README.md ├── .eslintignore ├── .gitignore ├── .travis.yml ├── .prettierrc.json ├── copyright.js ├── lerna.json ├── jest.config.js ├── tsconfig.json ├── .eslintrc.js └── scripts ├── watch.js ├── publish.sh ├── copyfiles.js ├── check-deps.js └── util └── get-dep-versions.js /.prettierignore: -------------------------------------------------------------------------------- 1 | /copyright.js 2 | -------------------------------------------------------------------------------- /qa/samples/packages/loaders/assets/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /qa/samples/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | yarn.lock 3 | -------------------------------------------------------------------------------- /qa/samples/packages/loaders/.npmignore: -------------------------------------------------------------------------------- 1 | .npmbuildrc -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # General code owners 2 | * @izaera @jbalsas -------------------------------------------------------------------------------- /resources/devtools/find-generator/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /resources/devtools/link-js-toolkit/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.json] 2 | indent_style = tab 3 | indent_size = 4 -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/adapt/templates/.npmbuildrc.ejs: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /qa/samples/packages/loaders/.npmbuildrc: -------------------------------------------------------------------------------- 1 | { 2 | "liferayDir": "" 3 | } 4 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /copyright.js 2 | __fixtures__ 3 | qa/samples/packages/** 4 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/facet-project/templates/.npmbuildrc.ejs: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/adapt/templates/.npmbundlerrc.ejs: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/facet-portlet/templates/assets/css/styles.css.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/facet-project/templates/.npmignore.ejs: -------------------------------------------------------------------------------- 1 | .npmbuildrc -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/facet-project/templates/assets/.placeholder.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | liferay-npm-bundler-report.html -------------------------------------------------------------------------------- /packages/generator-liferay-js/copyfiles.json: -------------------------------------------------------------------------------- 1 | { 2 | "output": "generators/" 3 | } 4 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/ignore/util.js: -------------------------------------------------------------------------------- 1 | module.exports = 'ignore/util.js'; 2 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/alias/cache.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/ignore/README.md: -------------------------------------------------------------------------------- 1 | Tests ignores for all alias types. 2 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/adapt/templates/features/localization/Language.properties.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/utils/__tests__/__fixtures__/prj-without-l10n/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/pkg-manager/both/yarn.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/pkg-manager/yarn/yarn.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/ignore/model/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'ignore/model/index.js'; 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | lerna-debug.log 2 | node_modules/* 3 | packages/*/node_modules 4 | lib 5 | coverage 6 | generators -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/facet-localization/templates/features/localization/Language.properties.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/utils/__tests__/__fixtures__/prj-with-implicit-l10n/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/alias/invalid.json: -------------------------------------------------------------------------------- 1 | This is not valid JSON! -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/pkg-manager/npm/package-lock.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/create-jar/package.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/external-path-modules/README.md: -------------------------------------------------------------------------------- 1 | Tests external modules with paths. 2 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/facet-project/templates/README.md.ejs: -------------------------------------------------------------------------------- 1 | # <%= name %> 2 | 3 | <%= description %> -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-shared-bundle/templates/.babelrc.ejs: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-vuejs-portlet/templates/.babelrc.ejs: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/packages/a-package/no-package-json/file.js.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/packages/a-package/no-package-json/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/packages-cfg/package.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/pkg-manager/both/package-lock.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /qa/samples/packages/loaders/src/file.json: -------------------------------------------------------------------------------- 1 | { 2 | "this": "is", 3 | "a": { 4 | "json": "file" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-vanilla-portlet/templates/.babelrc.ejs: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/auto-deploy-portlet/package.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-react-portlet/templates/.babelrc.ejs: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env", "react"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/bin/lnbs-build.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../lib/scripts/build').default(); 3 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/bin/lnbs-start.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../lib/scripts/start').default(); 3 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/create-jar-empty/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/ignore/node_modules/fs/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'ignore/node_modules/fs/index.js'; 2 | -------------------------------------------------------------------------------- /packages/babel-plugin-namespace-modules/src/__tests__/__fixtures__/a-project/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "output": "build" 3 | } 4 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-metaljs-portlet/templates/.babelrc.ejs: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env", "metal-jsx"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/utils/__tests__/__fixtures__/prj-with-implicit-l10n/features/localization/Language.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/bin/lnbs-deploy.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../lib/scripts/deploy').default(); 3 | -------------------------------------------------------------------------------- /qa/samples/packages/loaders/src/css/green-border.css: -------------------------------------------------------------------------------- 1 | .green-border { 2 | border: 1px solid green; 3 | margin: 6px 0; 4 | } 5 | -------------------------------------------------------------------------------- /qa/samples/packages/loaders/src/style/red-border.css: -------------------------------------------------------------------------------- 1 | .red-border { 2 | border: 1px solid red; 3 | margin: 6px 0; 4 | } 5 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/utils/__tests__/__fixtures__/prj-without-description/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-name" 3 | } 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/bin/lnbs-translate.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../lib/scripts/translate').default(); 3 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/packages/a-package/with-package-json/no-dot/no-extension/file.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/packages/a-package/with-package-json/no-dot/with-extension/file.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/packages/a-package/with-package-json/with-dot/no-extension/file.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/model.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('cartesian-product/model.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/random.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('cartesian-product/random.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/things.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('cartesian-product/things.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/inner-override/README.md: -------------------------------------------------------------------------------- 1 | Tests inner overrides for external module and local module or file. 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/inner-override/is-object.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('inner-override/is-object.js'); 2 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/bin/lnbs-copy-assets.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../lib/scripts/copy-assets').default(); 3 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/bin/lnbs-copy-sources.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../lib/scripts/copy-sources').default(); 3 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/packages/a-package/with-package-json/with-dot/with-extension/file.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/liferay-npm-imports-checker/src/__tests__/__fixtures__/.npmimportscheckrc: -------------------------------------------------------------------------------- 1 | { 2 | "exclude-folders": ["build", "classes"] 3 | } -------------------------------------------------------------------------------- /qa/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liferay/liferay-js-toolkit/HEAD/qa/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/display.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('cartesian-product/display.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/platform.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('cartesian-product/platform.js'); 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | install: 2 | - yarn install 3 | 4 | language: node_js 5 | 6 | node_js: 7 | - '10' 8 | 9 | script: yarn ci 10 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/default-features/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "create-jar": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/default-features/features/localization/Language.properties: -------------------------------------------------------------------------------- 1 | key=value -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/util/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('cartesian-product/util/index.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/inner-override/inner/replaced.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('inner-override/inner/replaced.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/parent-package/test/is-object.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('parent-package/test/is-object.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/parent-package/test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "is-object": "./browser/is-object.js" 4 | } 5 | } -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/facet-project/templates/.gitignore.ejs: -------------------------------------------------------------------------------- 1 | build/* 2 | dist/* 3 | node_modules/* 4 | liferay-npm-bundler-report.html -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/utils/__tests__/__fixtures__/prj/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-name", 3 | "description": "A description" 4 | } -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/bool-create-jar/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "create-jar": true 3 | } 4 | -------------------------------------------------------------------------------- /qa/build.gradle: -------------------------------------------------------------------------------- 1 | task myTask(type:Exec) { 2 | 3 | workingDir '.' 4 | 5 | commandLine './setup.sh unzip-portal-snapshot-bundle' 6 | 7 | } -------------------------------------------------------------------------------- /qa/samples/lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": ["packages/*"], 3 | "version": "0.0.0", 4 | "npmClient": "yarn", 5 | "useWorkspaces": true 6 | } 7 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/my-is-object.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('cartesian-product/my-is-object.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/my-jss/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('cartesian-product/my-jss/index.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/collision-pkg-file/test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "is-object": "./browser/is-object.js" 4 | } 5 | } -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/inner-override/browser/replaced.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('inner-override/browser/replaced.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/inner-override/inner/is-object.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('inner-override/inner/is-object.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/README.md: -------------------------------------------------------------------------------- 1 | Tests precedence when a colliding file or local module is required from outside. 2 | -------------------------------------------------------------------------------- /qa/samples/packages/loaders/.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | dist/* 3 | node_modules/* 4 | liferay-npm-bundler-report.html 5 | .webpack/* 6 | package-lock.json -------------------------------------------------------------------------------- /qa/samples/packages/loaders/src/blue-border.scss: -------------------------------------------------------------------------------- 1 | $color: blue; 2 | 3 | .blue-border { 4 | border: 1px solid $color; 5 | margin: 6px 0; 6 | } 7 | -------------------------------------------------------------------------------- /packages/babel-plugin-add-module-metadata/src/__tests__/__fixtures__/a-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-project", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-name-amd-modules/src/__tests__/__fixtures__/a-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-project", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/babel-plugin-namespace-modules/src/__tests__/__fixtures__/a-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-project", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/babel-util/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "output": "build", 3 | "sources": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/babel-util/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-util", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/false-create-jar/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "create-jar": false 3 | } 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-preset/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "preset": "test-preset" 3 | } 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/steps/__tests__/__fixtures__/rules-project/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "sources": ["src/main/resources", "assets"] 3 | } 4 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/browser/platform.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('cartesian-product/browser/platform.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/browser/random.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('cartesian-product/browser/random.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/browser/things.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('cartesian-product/browser/things.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/collision-pkg-file/test/is-object.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('collision-pkg-file/test/is-object.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/inner-override/browser/is-object.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('inner-override/browser/is-object.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/inner-vs-outer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "./file.js": "./file-browser.js" 4 | } 5 | } -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "bracketSpacing": false, 4 | "singleQuote": true, 5 | "tabWidth": 4, 6 | "useTabs": true 7 | } 8 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/standard/features/localization/Language.properties: -------------------------------------------------------------------------------- 1 | test-project=Test Project -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-css-loader/src/__tests__/__fixtures__/a-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-project", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-sass-loader/src/__tests__/__fixtures__/project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "project", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/steps/__tests__/__fixtures__/rules-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rules-project", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-imports-checker/src/__tests__/__fixtures__/modules/a-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-project", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-imports-checker/src/__tests__/__fixtures__/modules/o-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "o-project", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/external-path-modules/browser/react.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('external-path-modules/browser/react.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/inner-vs-outer/inner/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "./file.js": "./file-browser.js" 4 | } 5 | } -------------------------------------------------------------------------------- /packages/liferay-npm-bridge-generator/bin/liferay-npm-bridge-generator.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../lib/liferay-npm-bridge-generator').default(); 3 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/alias/normalize.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "/random.js": "./random-shim.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/babel-util/build/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-util", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/packages/a-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-package", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/pkg-manager/both/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "both", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/pkg-manager/none/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "none", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/pkg-manager/npm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "npm", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/pkg-manager/yarn/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yarn", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/empty/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "empty", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/browser/model/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('cartesian-product/browser/model/index.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/node_modules/jss/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('cartesian-product/node_modules/jss.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/collision-pkg-file/README.md: -------------------------------------------------------------------------------- 1 | Tests a collision between an aliased exteral package and a local file with the 2 | same name. 3 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/ignore/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "fs": false, 4 | "./util": false, 5 | "./model/index.js": false 6 | } 7 | } -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/inner-override/inner/browser/is-object.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('inner-override/inner/browser/is-object.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/inner-override/inner/browser/replaced.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('inner-override/inner/browser/replaced.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/file-vs-module/file.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('outside-precedence/file-vs-module/file.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/inner-vs-outer/file.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('outside-precedence/inner-vs-outer/file.js'); 2 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/parent-package/test/browser/is-object.js: -------------------------------------------------------------------------------- 1 | module.exports = () => console.log('parent-package/test/browser/is-object.js'); 2 | -------------------------------------------------------------------------------- /copyright.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © <%= YEAR %> Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/packages/a-package/with-package-json/no-dot/no-extension/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "file" 3 | } 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/standard/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "standard", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "transform", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-css-loader/src/__tests__/__fixtures__/java-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "java-project", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-imports-checker/src/__tests__/__fixtures__/modules/o-project/.npmimportscheckrc: -------------------------------------------------------------------------------- 1 | { 2 | "ignore": { 3 | "o-provider": ["o-package"] 4 | } 5 | } -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/node_modules/fs/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('cartesian-product/node_modules/fs/index.js'); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-alias-modules/src/__tests__/__fixtures__/path/to/overriden/child/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "./module": "./child-shim.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/babel-plugin-alias-modules/src/__tests__/__fixtures__/path/to/overriden/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "./child/module": "./parent-shim.js" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/packages/a-package/with-package-json/no-dot/with-extension/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "file.js" 3 | } 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/packages/a-package/with-package-json/with-dot/no-extension/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "./file" 3 | } 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/default-features/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "default-features", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/standard/features/localization/Language_es_ES.properties: -------------------------------------------------------------------------------- 1 | test-project=Proyecto de prueba -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-preset/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "with-preset", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/__tests__/__fixtures__/project/node_modules/stale-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stale-package", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /qa/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/ 2 | build/ 3 | liferay-portal-master/ 4 | logs/ 5 | test-results/ 6 | config/ 7 | poshi/dependencies/ 8 | poshi/standalone/ 9 | liferay-portal-master -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/collision-pkg-file/test/browser/is-object.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('collision-pkg-file/test/browser/is-object.js'); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-namespace-modules/src/__tests__/__fixtures__/a-project/node_modules/a-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-package", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-react-portlet/target-description.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "React Widget", 3 | "category": "Widget projects", 4 | "priority": 30 5 | } 6 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-shared-bundle/target-description.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Shared Bundle", 3 | "category": "Other projects", 4 | "priority": 10 5 | } 6 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-vuejs-portlet/target-description.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Vue.js Widget", 3 | "category": "Widget projects", 4 | "priority": 40 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/babel-util/node_modules/a-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-package", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/packages/a-package/with-package-json/with-dot/with-extension/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "./file.js" 3 | } 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/context-path-1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "context-path-1", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/create-jar-empty/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "create-jar": { 3 | "features": {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "versions-info", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-module-cfg/node_modules/a-config/preset.json: -------------------------------------------------------------------------------- 1 | { 2 | "output": "preset-output" 3 | } 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-imports-checker/bin/liferay-npm-imports-checker.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../lib/liferay-npm-imports-checker').default(process.argv.slice(2)); 3 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/node_modules/react/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('cartesian-product/node_modules/react/index.js'); 3 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/external-path-modules/browser/react-module.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('external-path-modules/browser/react-module.js'); 3 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/inner-override/node_modules/is-object/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('inner-override/node_modules/is-object/index.js'); 3 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/inner-vs-outer/inner/file.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('outside-precedence/inner-vs-outer/inner/file.js'); 3 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/parent-package/node_modules/is-object/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('parent-package/node_modules/is-object/index.js'); 3 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-angular-portlet/target-description.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Angular Widget", 3 | "category": "Widget projects", 4 | "priority": 20 5 | } 6 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-metaljs-portlet/target-description.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Metal.js Widget", 3 | "category": "Widget projects", 4 | "priority": 50 5 | } 6 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-vanilla-portlet/target-description.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "JavaScript Widget", 3 | "category": "Widget projects", 4 | "priority": 10 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/bool-create-jar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bool-create-jar", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/false-create-jar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "false-create-jar", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/loader-0/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 1; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-module-cfg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "with-module-cfg", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/__tests__/__fixtures__/project/node_modules/test-project-dep-0/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-project-dep-0", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/README.md: -------------------------------------------------------------------------------- 1 | Tests the cartesian product of all alias types: 2 | 3 | - External module 4 | - Local module 5 | - Local file 6 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/node_modules/is-object/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('cartesian-product/node_modules/is-object/index.js'); 3 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/external-path-modules/node_modules/react/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('external-path-modules/node_modules/react/index.js'); 3 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/inner-vs-outer/file-browser.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('outside-precedence/inner-vs-outer/file-browser.js'); 3 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-build-support 2 | 3 | A library of scripts and loaders used by Liferay JS Toolkit projects in their 4 | build processes. 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/babel-util/build/node_modules/a-package@1.0.0/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-package", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "globals": { 3 | "Liferay": "readonly" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/node_modules/fancy-util/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('cartesian-product/node_modules/fancy-util/index.js'); 3 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/node_modules/fs-browser/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('cartesian-product/node_modules/fs-browser/index.js'); 3 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/parent-package/README.md: -------------------------------------------------------------------------------- 1 | Tests if an overriden external package also appears as a virtual local module 2 | in the folder when required from outside. 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-namespace-modules/src/__tests__/__fixtures__/a-project/node_modules/@a-scoped/package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@a-scoped/package", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/babel-util/node_modules/@a-scoped/package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@a-scoped/package", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/auto-deploy-portlet/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "create-jar": { 3 | "auto-deploy-portlet": false 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/context-path-1/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "create-jar": { 3 | "web-context-path": "/my-portlet" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/inner-override/inner/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "is-object": "./browser/is-object.js", 4 | "./replaced.js": "./browser/replaced.js" 5 | } 6 | } -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/inner-override/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "is-object": "./browser/is-object.js", 4 | "./inner/replaced.js": "./browser/replaced.js" 5 | } 6 | } -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/file-vs-module/file-browser-file.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('outside-precedence/file-vs-module/file-browser-file.js'); 3 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/babel-plugin-test-0/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 2; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/babel-plugins/dir/plugin-0.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 4; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/babel-plugins/dir/plugin-1.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 4; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/bundler-plugins/dir/loader-0.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 3; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/bundler-plugins/dir/loader-1.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 3; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/bundler-plugins/dir/plugin-0.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 3; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/bundler-plugins/dir/plugin-1.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 3; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-module-cfg/node_modules/a-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-config", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-module-cfg/node_modules/a-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a-package", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/external-path-modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "react": "./browser/react.js", 4 | "react/path/to/module": "./browser/react-module.js" 5 | } 6 | } -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/file-vs-module/file-browser-module.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('outside-precedence/file-vs-module/file-browser-module.js'); 3 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/inner-vs-outer/inner/file-browser.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log('outside-precedence/inner-vs-outer/inner/file-browser.js'); 3 | -------------------------------------------------------------------------------- /packages/babel-plugin-alias-modules/src/__tests__/__fixtures__/path/to/ignored/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "external": false, 4 | "./module": false, 5 | "./file.js": false 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/create-jar/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "create-jar": { 3 | "features": { 4 | "js-extender": false 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/babel-plugins/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-plugins", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/number-is-nan/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "number-is-nan", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/file-vs-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "./file.js": "./file-browser-file.js", 4 | "./file": "./file-browser-module.js" 5 | } 6 | } -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-angular-portlet/templates/src/polyfills.ts.ejs: -------------------------------------------------------------------------------- 1 | // Import needed polyfills for the application 2 | import 'core-js/es7/reflect'; 3 | import 'zone.js/dist/zone'; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/babel-util/build/node_modules/@a-scoped%2Fpackage@1.0.0/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@a-scoped/package", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/packages-cfg/node_modules/liferay-npm-bundler-plugin-test-0/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 0; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/packages-cfg/node_modules/liferay-npm-bundler-plugin-test-1/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 1; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/packages-cfg/node_modules/liferay-npm-bundler-plugin-test-2/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 2; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/packages-cfg/node_modules/liferay-npm-bundler-plugin-test-4/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 4; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-0/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 0; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-1/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 1; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-2/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 2; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-3/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 3; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-4/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 4; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-5/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 5; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-6/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 6; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-7/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 7; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/bundler-plugins/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bundler-plugins", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/liferay-npm-bundler-plugin-test-0/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 0; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/liferay-npm-bundler-plugin-test-1/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 1; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-module-cfg/node_modules/a-config/my-js-loader.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return 'Hi from loader!'; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/liferay-npm-imports-checker/src/__tests__/__fixtures__/modules/a-project/.npmimportscheckrc: -------------------------------------------------------------------------------- 1 | { 2 | "ignore": { 3 | "a-provider": ["a-package", "b-package"], 4 | "b-provider": ["*"] 5 | } 6 | } -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/__tests__/__fixtures__/project/node_modules/test-project-dep-1/node_modules/test-project-dep-0/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-project-dep-0", 3 | "version": "0.1.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/loader-0/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "loader-0", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/@scope/number-is-nan/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@scope/number-is-nan", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/scripts/clean.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var rimraf = require('rimraf'); 3 | 4 | rimraf.sync(path.join(__dirname, '../build')); 5 | rimraf.sync(path.join(__dirname, '../dist')); 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-preset/node_modules/test-preset/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-preset", 3 | "version": "1.0.0", 4 | "main": "config.json" 5 | } 6 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/external-path-modules/node_modules/react/path/to/module/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => 2 | console.log( 3 | 'external-path-modules/node_modules/react/path/to/module/index.js' 4 | ); 5 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "env", 5 | { 6 | "targets": { 7 | "node": true 8 | } 9 | } 10 | ] 11 | ], 12 | "plugins": ["add-module-exports"] 13 | } 14 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/utils/__tests__/__fixtures__/prj-with-explicit-l10n/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "create-jar": { 3 | "features": { 4 | "localization": "features/localization/MyKeys" 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/inner-vs-outer/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => { 2 | console.log(` 3 | require('./file');`); 4 | console.group(); 5 | require('./file')(); 6 | console.groupEnd(); 7 | }; 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-alias-modules/src/__tests__/__fixtures__/path/to/colliding/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "module": "package-shim", 4 | "./module": "./module-shim.js", 5 | "./module.js": "./file-shim.js" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/context-path-2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "context-path-2", 3 | "version": "1.0.0", 4 | "osgi": { 5 | "Web-ContextPath": "/my-portlet" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-preset/node_modules/test-preset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "create-jar": { 3 | "output-dir": "preset-dist" 4 | }, 5 | "output": "preset-build" 6 | } 7 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/parent-package/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => { 2 | console.log(` 3 | require('./test/inner/deep');`); 4 | console.group(); 5 | require('./test/inner/deep')(); 6 | console.groupEnd(); 7 | }; 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-alias-modules/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-name-amd-modules/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-wrap-modules-amd/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/babel-preset-liferay-standard/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-vuejs-portlet/dependencies.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "babel-cli": "6.26.0", 4 | "babel-preset-env": "1.7.0" 5 | }, 6 | "dependencies": { 7 | "vue": "2.6.7" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/liferay-npm-bridge-generator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/babel-plugin-test-0/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-plugin-test-0", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/@project$1.0.0$scope/number-is-nan/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@project$1.0.0$scope/number-is-nan", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /packages/liferay-npm-imports-checker/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => { 2 | console.log(` 3 | require('./outside/index.js');`); 4 | console.group(); 5 | require('./outside/index.js')(); 6 | console.groupEnd(); 7 | }; 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-add-module-metadata/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-namespace-amd-define/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-namespace-modules/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/babel-plugin-normalize-requires/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-namespace-packages/src/__tests__/__fixtures__/project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "project2", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "is-finite": "1.0.0", 6 | "isobject": "1.0.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/__tests__/__fixtures__/project/node_modules/test-project-dep-1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-project-dep-1", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "test-project-dep-0": "0.1.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/__tests__/__fixtures__/project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-project", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "test-project-dep-0": "1.0.0", 6 | "test-project-dep-1": "1.0.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-babel-loader/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-copy-loader/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-css-loader/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-json-loader/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-sass-loader/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-style-loader/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-namespace-packages/src/__tests__/__fixtures__/project/node_modules/is-finite/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "is-finite", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "number-is-nan": "1.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /qa/samples/packages/loaders/assets/css/styles.css: -------------------------------------------------------------------------------- 1 | .tag { 2 | font-weight: bold; margin-right: 1em; 3 | } 4 | 5 | .value { 6 | font-family: monospace; 7 | } 8 | 9 | .pre { 10 | font-family: monospace; white-space: pre; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /packages/babel-plugin-alias-modules/src/__tests__/__fixtures__/path/to/in/folder/aliased/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "external/module": "a-shim-package", 4 | "./module": "./module-shim.js", 5 | "./file.js": "./file-shim.js" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-exclude-imports/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/is-finite/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "is-finite", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "number-is-nan": "1.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/babel-plugin-alias-modules/src/__tests__/__fixtures__/path/to/in/parent/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "external/module": "a-shim-package", 4 | "./aliased/module": "./module-shim.js", 5 | "./aliased/file.js": "./file-shim.js" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-0/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-0", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-1", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-2", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-3", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-4/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-4", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-5/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-5", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-6/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-6", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/node_modules/liferay-npm-bundler-plugin-test-7/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-7", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/pkg-for-logs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pkg-for-logs", 3 | "version": "1.0.0", 4 | "peerDependencies": { 5 | "is-finite": "1.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "project", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "is-finite": "1.0.0", 6 | "pkg-with-peer-deps": "1.0.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-namespace-packages/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "2.0.0-rc.5", 3 | "command": { 4 | "publish": { 5 | "exact": true 6 | } 7 | }, 8 | "npmClient": "yarn", 9 | "packages": [ 10 | "packages/*" 11 | ], 12 | "useWorkspaces": true, 13 | "version": "2.19.3" 14 | } 15 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./generators" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "src/*/templates/**/*", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/packages-cfg/node_modules/liferay-npm-bundler-plugin-test-0/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-0", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/packages-cfg/node_modules/liferay-npm-bundler-plugin-test-1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-1", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/packages-cfg/node_modules/liferay-npm-bundler-plugin-test-2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-2", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/packages-cfg/node_modules/liferay-npm-bundler-plugin-test-4/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-4", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/liferay-npm-bundler-plugin-test-0/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-0", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/node_modules/liferay-npm-bundler-plugin-test-1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-test-1", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-imports-dependencies/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-replace-browser-modules/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-resolve-linked-dependencies/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib" 5 | }, 6 | "include": ["src/**/*"], 7 | "exclude": ["node_modules", "**/__tests__/**"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/facet-project/templates/.npmbundlerrc.ejs: -------------------------------------------------------------------------------- 1 | { 2 | "create-jar": { 3 | "output-dir": "dist", 4 | "features": { 5 | "js-extender": false, 6 | "web-context": "/<%= name %>" 7 | } 8 | }, 9 | "dump-report": true 10 | } -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/alias/typical.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "fs": "./fs-shim.js", 4 | "./random.js": "./random-shim.js", 5 | "./log": "./log-shim.js", 6 | "./utils/printer.js": "./printer-shim.js" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/pkg-with-peer-deps/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pkg-with-peer-deps", 3 | "version": "1.0.0", 4 | "peerDependencies": { 5 | "is-finite": "1.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/@scope/is-finite/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@scope/is-finite", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "@scope/number-is-nan": "1.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/facet-configuration/constants.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | export const DEFAULT_CONFIGURATION = 'features/configuration.json'; 7 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/standard/features/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "Project-Name": "Test Project", 3 | "Project-Web": "https://somewhere.net/test-project", 4 | "Project-UUID": "ED7BA470-8E54-465E-825C-99712043E01C" 5 | } 6 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/facet-localization/constants.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | export const DEFAULT_LOCALIZATION = 'features/localization/Language'; 7 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__fixtures__/alias/multiple.json: -------------------------------------------------------------------------------- 1 | { 2 | "unpkg": { 3 | "fs": "./fs-shim2.js", 4 | "./log": "./log-shim.js" 5 | }, 6 | "browser": { 7 | "fs": "./fs-shim.js", 8 | "./random.js": "./random-shim.js" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-css-loader/src/__tests__/__fixtures__/a-project/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "sources": ["src"], 3 | "create-jar": { 4 | "output-dir": "dist", 5 | "features": { 6 | "js-extender": true, 7 | "web-context": "/a-project" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-css-loader/src/__tests__/__fixtures__/java-project/bnd.bnd: -------------------------------------------------------------------------------- 1 | Bundle-Name: Java Project 2 | Bundle-SymbolicName: com.java.project 3 | Bundle-Version: 1.0.0 4 | Export-Package:\ 5 | com.java.project,\ 6 | com.java.project.api 7 | Web-ContextPath: /java-project -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/@scope/pkg-with-peer-deps/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@scope/pkg-with-peer-deps", 3 | "version": "1.0.0", 4 | "peerDependencies": { 5 | "@scope/is-finite": "1.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/README.md: -------------------------------------------------------------------------------- 1 | # generator-liferay-js 2 | 3 | Yeoman generators for Liferay DXP and Portal CE projects. 4 | 5 | Please refer to the 6 | [wiki](https://github.com/liferay/liferay-js-toolkit/wiki/How-to-use-generator-liferay-js) 7 | for information on how to use this tool. 8 | -------------------------------------------------------------------------------- /qa/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Nov 20 16:50:24 PST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-bin.zip 7 | -------------------------------------------------------------------------------- /resources/devtools/find-generator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "find-generator", 3 | "version": "1.0.0", 4 | "description": "", 5 | "bin": { 6 | "find-generator": "find-generator.js" 7 | }, 8 | "dependencies": { 9 | "yeoman-environment": "^2.4.0" 10 | }, 11 | "private": true 12 | } 13 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib", 5 | 6 | "allowJs": false, 7 | "declaration": true 8 | }, 9 | "include": ["src/**/*"], 10 | "exclude": ["node_modules", "**/__tests__/**"] 11 | } 12 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-react-portlet/dependencies.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "babel-cli": "6.26.0", 4 | "babel-preset-env": "1.7.0", 5 | "babel-preset-react": "6.24.1" 6 | }, 7 | "dependencies": { 8 | "react": "16.8.6", 9 | "react-dom": "16.8.6" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/@project$1.0.0$scope/is-finite/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@project$1.0.0$scope/is-finite", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "@project$1.0.0$scope/number-is-nan": "1.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | modulePathIgnorePatterns: [ 3 | 'lib/.*', 4 | 'generators/.*', 5 | 'qa/.*', 6 | '__fixtures__/.*', 7 | ], 8 | testPathIgnorePatterns: ['/node_modules/', '/__fixtures__/'], 9 | transform: { 10 | "\\.js$": "ts-jest", 11 | "\\.ts$": "ts-jest" 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /qa/samples/packages/.gitignore: -------------------------------------------------------------------------------- 1 | angular-portlet-l10n-cfg-sample 2 | metaljs-portlet-l10n-cfg-sample 3 | react-portlet-l10n-cfg-sample 4 | shared-bundle 5 | vanilla-portlet-es5-l10n-cfg-sample 6 | vanilla-portlet-es6-l10n-cfg-sample 7 | vuejs-portlet-l10n-cfg-sample 8 | create-react-app 9 | angular-cli 10 | vue-cli -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "compilerOptions": { 4 | "target": "esnext", 5 | "module": "CommonJS", 6 | "moduleResolution": "node", 7 | "esModuleInterop": true, 8 | 9 | "allowJs": true, 10 | "checkJs": false, 11 | "lib": ["es2015"], 12 | 13 | "sourceMap": false 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/@project$1.0.0$scope/pkg-with-peer-deps/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@project$1.0.0$scope/pkg-with-peer-deps", 3 | "version": "1.0.0", 4 | "peerDependencies": { 5 | "@project$1.0.0$scope/is-finite": "1.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-metaljs-portlet/imports.json: -------------------------------------------------------------------------------- 1 | { 2 | "frontend-js-metal-web": { 3 | "metal": "^2.0.0", 4 | "metal-component": "^2.0.0", 5 | "metal-dom": "^2.0.0", 6 | "metal-events": "^2.0.0", 7 | "metal-incremental-dom": "^2.0.0", 8 | "metal-jsx": "^2.0.0", 9 | "metal-state": "^2.0.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/src/resources/build/angular-cli/adapt-rt.js.ejs: -------------------------------------------------------------------------------- 1 | var PATH_CONTEXT = Liferay.ThemeDisplay.getPathContext(); 2 | 3 | function adaptStaticURL(url) { 4 | return PATH_CONTEXT + "/o<%= project.jar.webContextPath %>/<%= project.dir.basename() %>/" + url; 5 | } 6 | 7 | module.exports = { 8 | adaptStaticURL: adaptStaticURL 9 | }; -------------------------------------------------------------------------------- /packages/liferay-npm-imports-checker/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-imports-checker 2 | 3 | A tool to check `imports` sections of `.npmbundlerrc` files in a multiproject 4 | source tree. 5 | 6 | Please refer to the 7 | [wiki](https://github.com/liferay/liferay-js-toolkit/wiki/How-to-use-liferay-npm-imports-checker) 8 | for information on how to use this tool. 9 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/ignore/index.js: -------------------------------------------------------------------------------- 1 | // "fs": false, 2 | // "./util": false, 3 | // "./model/index.js": false 4 | 5 | module.exports = () => { 6 | console.log(`require('fs')`, require('fs')); 7 | console.log(`require('./util')`, require('./util')); 8 | console.log(`require('./model/index.js')`, require('./model/index.js')); 9 | }; 10 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | node: true, 4 | jest: true, 5 | }, 6 | extends: 'liferay', 7 | root: true, 8 | rules: { 9 | 'liferay/no-dynamic-require': 'off', 10 | 'no-console': 'off', 11 | 'no-for-of-loops/no-for-of-loops': 'off', 12 | 'no-return-assign': ['error', 'except-parens'], 13 | 'sort-keys': 'off', 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /packages/liferay-npm-bridge-generator/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bridge-generator 2 | 3 | A tool to generate bridge modules (npm modules that re-export another module in 4 | the same package) inside a project. 5 | 6 | Please refer to the 7 | [wiki](https://github.com/liferay/liferay-js-toolkit/wiki/How-to-use-liferay-npm-bridge-generator) 8 | for information on how to use this tool. 9 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/external-path-modules/inner/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => { 2 | console.log(` 3 | require('react')`); 4 | console.group(); 5 | require('react')(); 6 | console.groupEnd(); 7 | 8 | console.log(` 9 | require('react/path/to/module')`); 10 | console.group(); 11 | require('react/path/to/module')(); 12 | console.groupEnd(); 13 | }; 14 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/parent-package/test/inner/deep/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => { 2 | console.log(` 3 | require('is-object')`); 4 | console.group(); 5 | require('is-object')(); 6 | console.groupEnd(); 7 | 8 | console.log(` 9 | require('../../is-object')`); 10 | console.group(); 11 | require('../../is-object')(); 12 | console.groupEnd(); 13 | }; 14 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/collision-pkg-file/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => { 2 | console.log(` 3 | require('./test/is-object');`); 4 | console.group(); 5 | require('./test/is-object')(); 6 | console.groupEnd(); 7 | 8 | console.log(` 9 | require('./test/is-object.js');`); 10 | console.group(); 11 | require('./test/is-object.js')(); 12 | console.groupEnd(); 13 | }; 14 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-module-cfg/node_modules/a-config/my-babel-plugin.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | // Standard babel plugins don't return values, but because we are calling 3 | // it from a test, we just return a string to make sure that we are really 4 | // calling what we want. 5 | return 'Hi from babel plugin!'; 6 | }; 7 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bundler 2 | 3 | A tool to process a Liferay widget project to produce an OSGi bundle containing 4 | the needed npm dependencies so that it can be run when deployed to the Portal. 5 | 6 | Please refer to the 7 | [wiki](https://github.com/liferay/liferay-js-toolkit/wiki/How-to-use-liferay-npm-bundler) 8 | for documentation on how to use this tool. 9 | -------------------------------------------------------------------------------- /qa/poshi/master/tests/HelloPoshi.testcase: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-module-cfg/node_modules/a-config/my-copy-plugin.js: -------------------------------------------------------------------------------- 1 | module.exports = function(params, state) { 2 | // Standard bundler plugins don't return values, but because we are calling 3 | // it from a test, we just return a string to make sure that we are really 4 | // calling what we want. 5 | return 'Hi from plugin!'; 6 | }; 7 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-module-cfg/node_modules/a-config/my-pre-plugin.js: -------------------------------------------------------------------------------- 1 | module.exports = function(params, state) { 2 | // Standard bundler plugins don't return values, but because we are calling 3 | // it from a test, we just return a string to make sure that we are really 4 | // calling what we want. 5 | return 'Hi from pre plugin!'; 6 | }; 7 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | { 3 | devtool: 'source-map', 4 | mode: 'development', 5 | entry: './src/index.js', 6 | output: { 7 | filename: 'webpack.js', 8 | }, 9 | }, 10 | { 11 | devtool: 'source-map', 12 | mode: 'development', 13 | entry: './build/index.js', 14 | output: { 15 | filename: 'bundler.js', 16 | }, 17 | }, 18 | ]; 19 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-module-cfg/node_modules/a-config/my-post-plugin.js: -------------------------------------------------------------------------------- 1 | module.exports = function(params, state) { 2 | // Standard bundler plugins don't return values, but because we are calling 3 | // it from a test, we just return a string to make sure that we are really 4 | // calling what we want. 5 | return 'Hi from post plugin!'; 6 | }; 7 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/cartesian-product/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browser": { 3 | "fs": "fs-browser", 4 | "jss": "./my-jss", 5 | "is-object": "./my-is-object.js", 6 | "./util": "fancy-util", 7 | "./model": "./browser/model", 8 | "./things": "./browser/things.js", 9 | "./display.js": "react", 10 | "./platform.js": "./browser/platform", 11 | "./random.js": "./browser/random.js" 12 | } 13 | } -------------------------------------------------------------------------------- /resources/devtools/link-js-toolkit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "link-js-toolkit", 3 | "version": "1.0.0", 4 | "description": "", 5 | "bin": { 6 | "link-js-toolkit": "link-js-toolkit.js" 7 | }, 8 | "dependencies": { 9 | "clone": "^2.1.2", 10 | "cross-spawn": "^6.0.5", 11 | "read-json-sync": "^2.0.1" 12 | }, 13 | "private": true, 14 | "devDependencies": { 15 | "yargs": "^14.0.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/facet-configuration/templates/features/configuration.json.ejs: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/liferay/liferay-js-toolkit/master/resources/schemas/configuration.schema.json", 3 | "system": { 4 | "category": "<%- name %>", 5 | "name": "<%- description %>", 6 | "fields": { 7 | } 8 | }, 9 | "portletInstance": { 10 | "fields": { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-shared-bundle/templates/src/index.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * Place any initialization of this shared bundle in this function. That way, 3 | * you can run: 4 | * 5 | * require('<%- pkgJson.name %>'); 6 | * 7 | * in your dependent projects, before using this shared bundle and you will make 8 | * sure that this code is executed once. 9 | */ 10 | export default function init() { 11 | } -------------------------------------------------------------------------------- /qa/samples/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "root", 3 | "private": true, 4 | "devDependencies": { 5 | "lerna": "^3.16.4" 6 | }, 7 | "workspaces": { 8 | "packages": [ 9 | "packages/*" 10 | ], 11 | "nohoist": [ 12 | "**/babel-loader", 13 | "**/babel-loader/**", 14 | "**/webpack", 15 | "**/webpack/**", 16 | "**/eslint", 17 | "**/eslint/**", 18 | "**/@vue/**" 19 | ] 20 | }, 21 | "dependencies": {} 22 | } 23 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/legacy/packages-cfg/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "preset": false, 3 | "*" : { 4 | "plugins": ["test-0"] 5 | }, 6 | "package@1.0.0" : { 7 | "plugins": ["test-1"] 8 | }, 9 | "package2" : { 10 | "plugins": ["test-2"] 11 | }, 12 | "package3" : { 13 | "plugins": ["test-3"] 14 | }, 15 | "packages": { 16 | "package3" : { 17 | "plugins": ["test-4"] 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/manifest.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import Manifest from 'liferay-npm-build-tools-common/lib/manifest'; 7 | import project from 'liferay-npm-build-tools-common/lib/project'; 8 | 9 | const manifest = new Manifest(project.buildDir.join('manifest.json').asNative); 10 | 11 | export default manifest; 12 | -------------------------------------------------------------------------------- /packages/babel-plugin-alias-modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-plugin-alias-modules", 3 | "version": "2.19.3", 4 | "description": "A Babel plugin to rewrite aliased require() calls.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "liferay-npm-build-tools-common": "2.19.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-metaljs-portlet/dependencies.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "babel-cli": "6.26.0", 4 | "babel-preset-env": "1.7.0", 5 | "babel-preset-metal-jsx": "0.1.1" 6 | }, 7 | "dependencies": { 8 | "metal": "2.16.7", 9 | "metal-component": "2.16.7", 10 | "metal-dom": "2.16.7", 11 | "metal-events": "2.16.7", 12 | "metal-incremental-dom": "2.16.7", 13 | "metal-jsx": "2.16.7", 14 | "metal-state": "2.16.7" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/src/resources/start/index.html.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= pkgName %> - <%= pkgVersion %> 6 | 7 | <% if (cssPath) { %> 8 | 9 | 10 | <% } %> 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/babel-plugin-namespace-amd-define/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-plugin-namespace-amd-define", 3 | "version": "2.19.3", 4 | "description": "A Babel plugin to namespace (prefix) AMD define() calls.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "liferay-npm-build-tools-common": "2.19.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/src/resources/build/vue-cli/adapt-rt.js.ejs: -------------------------------------------------------------------------------- 1 | var PATH_CONTEXT = Liferay.ThemeDisplay.getPathContext(); 2 | 3 | if(PATH_CONTEXT.indexOf("/") === 0) { 4 | PATH_CONTEXT = PATH_CONTEXT.substr(1); 5 | } 6 | if(PATH_CONTEXT !== "") { 7 | PATH_CONTEXT += "/"; 8 | } 9 | 10 | function adaptStaticURL(url) { 11 | return PATH_CONTEXT + "o<%= project.jar.webContextPath %>/" + url; 12 | } 13 | 14 | module.exports = { 15 | adaptStaticURL: adaptStaticURL 16 | }; -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-copy-loader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-loader-copy-loader", 3 | "version": "2.19.3", 4 | "description": "A liferay-npm-bundler loader that copies files.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "liferay-npm-build-tools-common": "2.19.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/src/resources/build/create-react-app/adapt-rt.js.ejs: -------------------------------------------------------------------------------- 1 | var PATH_CONTEXT = Liferay.ThemeDisplay.getPathContext(); 2 | 3 | if(PATH_CONTEXT.indexOf("/") === 0) { 4 | PATH_CONTEXT = PATH_CONTEXT.substr(1); 5 | } 6 | if(PATH_CONTEXT !== "") { 7 | PATH_CONTEXT += "/"; 8 | } 9 | 10 | function adaptStaticURL(url) { 11 | return PATH_CONTEXT + "o<%= project.jar.webContextPath %>/" + url; 12 | } 13 | 14 | module.exports = { 15 | adaptStaticURL: adaptStaticURL 16 | }; -------------------------------------------------------------------------------- /packages/babel-plugin-name-amd-modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-plugin-name-amd-modules", 3 | "version": "2.19.3", 4 | "description": "A Babel plugin to give name to AMD modules based on their path and package.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "liferay-npm-build-tools-common": "2.19.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/babel-plugin-namespace-modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-plugin-namespace-modules", 3 | "version": "2.19.3", 4 | "description": "A Babel plugin to namespace AMD module names based on root's project name.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "liferay-npm-build-tools-common": "2.19.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-module-cfg/node_modules/a-config/my-babel-preset.js: -------------------------------------------------------------------------------- 1 | module.exports = function() { 2 | return { 3 | plugins: [ 4 | function() { 5 | // Standard babel plugins don't return values, but because we 6 | // are calling it from a test, we just return a string to make 7 | // sure that we are really calling what we want. 8 | return "Hi from preset's babel plugin!"; 9 | }, 10 | ], 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-exclude-imports/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-exclude-imports", 3 | "version": "2.19.3", 4 | "description": "A liferay-npm-bundler plugin to exclude imported dependencies.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "liferay-npm-build-tools-common": "2.19.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "preset": false, 3 | "output": "build", 4 | "sources": ["src"], 5 | "rules": [ 6 | { 7 | "test": ".*", 8 | "exclude.XXX": "node_modules", 9 | "use": ["copy-loader"] 10 | } 11 | ], 12 | "packages": { 13 | "/": { 14 | "plugins": ["replace-browser-modules"], 15 | ".babelrc": { 16 | "sourceMaps": false, 17 | "plugins": ["alias-modules"] 18 | }, 19 | "post-plugins": [] 20 | } 21 | }, 22 | "dump-report": true 23 | } 24 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-sass-loader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-loader-sass-loader", 3 | "version": "2.19.3", 4 | "description": "A liferay-npm-bundler loader that runs `sass` or `node-sass` on source files.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "resolve": "^1.8.1", 13 | "sass": "^1.22.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/facet-project/templates/package.json.ejs: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= name %>", 3 | "version": "1.0.0", 4 | "description": "<%= description %>", 5 | "devDependencies": { 6 | "liferay-npm-bundler": "<%= liferayNpmBundlerVersion %>", 7 | "liferay-npm-build-support": "<%= liferayNpmBuildSupportVersion %>" 8 | }, 9 | "dependencies": {}, 10 | "scripts": { 11 | "build": "npm run copy-assets && liferay-npm-bundler", 12 | "copy-assets": "lnbs-copy-assets" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/src/resources/start/index.js.ejs: -------------------------------------------------------------------------------- 1 | var main = require('<%= mainModule %>'); 2 | 3 | var params = { 4 | portletElementId: 'the-portlet', 5 | contextPath: '/', 6 | portletNamespace: '_the-portlet_', 7 | configuration: { 8 | portletPreferences: {}, 9 | system: {} 10 | } 11 | }; 12 | 13 | window.Liferay = { 14 | Language: { 15 | get: function(key) { 16 | return key; 17 | } 18 | } 19 | }; 20 | 21 | if (main.default) { 22 | main = main.default; 23 | } 24 | 25 | main(params); -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-preset-angular-cli/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-preset-angular-cli", 3 | "version": "2.19.3", 4 | "description": "Configuration for liferay-npm-bundler to integrate with Angular CLI projects", 5 | "main": "config.json", 6 | "dependencies": { 7 | "babel-preset-liferay-standard": "2.19.3", 8 | "liferay-npm-build-support": "2.19.3", 9 | "liferay-npm-bundler-loader-babel-loader": "2.19.3", 10 | "liferay-npm-bundler-loader-copy-loader": "2.19.3" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-preset-vue-cli/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-preset-vue-cli", 3 | "version": "2.19.3", 4 | "description": "Configuration for liferay-npm-bundler to integrate with Vue CLI projects", 5 | "main": "config.json", 6 | "dependencies": { 7 | "babel-preset-liferay-standard": "2.19.3", 8 | "liferay-npm-build-support": "2.19.3", 9 | "liferay-npm-bundler-loader-babel-loader": "2.19.3", 10 | "liferay-npm-bundler-loader-copy-loader": "2.19.3" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/babel-plugin-add-module-metadata/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-plugin-add-module-metadata", 3 | "version": "2.19.3", 4 | "description": "A Babel plugin to add AMD modules' metadata to the manifest.json file.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "liferay-npm-build-tools-common": "2.19.3", 13 | "read-json-sync": "^2.0.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /resources/devtools/link-js-toolkit/setup-project.js: -------------------------------------------------------------------------------- 1 | /** 2 | * © 2017 Liferay, Inc. 3 | * 4 | * SPDX-License-Identifier: LGPL-3.0-or-later 5 | */ 6 | 7 | const path = require('path'); 8 | 9 | const {toolkitProjectNames, yarn} = require('./util'); 10 | 11 | const prjsDir = path.join(__dirname, '..', '..', '..', 'packages'); 12 | 13 | module.exports = function() { 14 | toolkitProjectNames.forEach(projectName => { 15 | process.chdir(path.join(prjsDir, projectName)); 16 | yarn('link'); 17 | }); 18 | }; 19 | -------------------------------------------------------------------------------- /packages/babel-plugin-normalize-requires/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-plugin-normalize-requires", 3 | "version": "2.19.3", 4 | "description": "A Babel plugin that rewrites require() calls to normalize them (removing extensions and trailing slashes, for example).", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "liferay-npm-build-tools-common": "2.19.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-json-loader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-loader-json-loader", 3 | "version": "2.19.3", 4 | "description": "A liferay-npm-bundler loader that turns JSON files into JavaScript modules that export the parsed JSON object.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "liferay-npm-build-tools-common": "2.19.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-angular-portlet/templates/src/types/LiferayParams.ts.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the structure of the parameters passed by Liferay to the JS module. 3 | * 4 | * See https://tinyurl.com/js-ext-portlet-entry-point for the most recent 5 | * information on the structure of this type. 6 | */ 7 | export default interface LiferayParams { 8 | portletElementId: string; 9 | contextPath: string; 10 | portletNamespace: string; 11 | configuration: { 12 | system: any, 13 | portletInstance: any 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /packages/babel-plugin-wrap-modules-amd/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-plugin-wrap-modules-amd", 3 | "version": "2.19.3", 4 | "description": "A Babel plugin to wrap package modules inside AMD define() calls.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "babel-template": "^6.26.0", 13 | "liferay-npm-build-tools-common": "2.19.3", 14 | "read-json-sync": "^2.0.1" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-imports-dependencies/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-inject-imports-dependencies", 3 | "version": "2.19.3", 4 | "description": "A liferay-npm-bundler plugin to force injection of declared imports as dependencies.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "liferay-npm-build-tools-common": "2.19.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/steps/__tests__/__fixtures__/sourcemaps/main.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../../../src/main/resources/META-INF/resources/js/main.ts"],"names":[],"mappings":";;AAAA,8EAA2E;AAC3E,+CAA6C;AAE7C;IACC,iDAAsB,EAAE,CAAC,eAAe,CAAC,sBAAS,CAAC,CAAC;AACrD,CAAC;AAFD,4BAEC","sourcesContent":["import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\nimport { AppModule } from './app/app.module';\n\nexport default function() {\n\tplatformBrowserDynamic().bootstrapModule(AppModule);\n}"]} -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-preset-create-react-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-preset-create-react-app", 3 | "version": "2.19.3", 4 | "description": "Configuration for liferay-npm-bundler to integrate with create-react-app projects", 5 | "main": "config.json", 6 | "dependencies": { 7 | "babel-preset-liferay-standard": "2.19.3", 8 | "liferay-npm-bundler-loader-babel-loader": "2.19.3", 9 | "liferay-npm-bundler-loader-copy-loader": "2.19.3", 10 | "liferay-npm-bundler-plugin-resolve-linked-dependencies": "2.19.3" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/steps/__tests__/__fixtures__/sourcemaps/sourceMapFile1.js.file: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var define = undefined; 4 | Object.defineProperty(exports, "__esModule", { value: true }); 5 | var platform_browser_dynamic_1 = require("@npm-angular5-provider$angular/platform-browser-dynamic"); 6 | var app_module_1 = require("./app/app.module"); 7 | function default_1() { 8 | platform_browser_dynamic_1.platformBrowserDynamic().bootstrapModule(app_module_1.AppModule); 9 | } 10 | exports.default = default_1; 11 | //# sourceMappingURL=main.js.map -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/steps/__tests__/__fixtures__/sourcemaps/sourceMapFile2.js.file: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var define = undefined; 4 | Object.defineProperty(exports, "__esModule", { value: true }); 5 | var platform_browser_dynamic_1 = require("@npm-angular5-provider$angular/platform-browser-dynamic"); 6 | var app_module_1 = require("./app/app.module"); 7 | function default_1() { 8 | platform_browser_dynamic_1.platformBrowserDynamic().bootstrapModule(app_module_1.AppModule); 9 | } 10 | exports.default = default_1; 11 | /*# sourceMappingURL=main.js.map */ -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-style-loader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-loader-style-loader", 3 | "version": "2.19.3", 4 | "description": "A liferay-npm-bundler loader that turns CSS files into JavaScript modules that inject the CSS into the HTML when they are required.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "liferay-npm-build-tools-common": "2.19.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/globs.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import {negate, prefix} from '../globs'; 7 | 8 | it('negate works', () => { 9 | const globs = ['**/*', '!index.js']; 10 | 11 | expect(negate(globs)).toEqual(['!**/*', 'index.js']); 12 | }); 13 | 14 | it('prefix works', () => { 15 | const globs = ['**/*', '!index.js']; 16 | 17 | expect(prefix('dir/', globs)).toEqual(['dir/**/*', '!dir/index.js']); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/pkg-with-peer-deps/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * © 2017 Liferay, Inc. 3 | * 4 | * SPDX-License-Identifier: LGPL-3.0-or-later 5 | */ 6 | 7 | Liferay.Loader.define('pkg-with-peer-deps@1.0.0/index', ['module', 'exports', 'require', 'number-is-nan'], function(module, exports, require, numberIsNan) { 8 | // we know numberIsNan is provided because it is installed by our is-finite 9 | // peer dependency 10 | console.log('numberIsNan', numberIsNan); 11 | }); 12 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/scripts/remove-aliases.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const globby = require('globby'); 3 | const path = require('path'); 4 | const readJsonSync = require('read-json-sync'); 5 | 6 | const buildDirPath = path.join(__dirname, '..', 'build'); 7 | 8 | globby 9 | .sync('**/package.json', { 10 | absolute: true, 11 | cwd: buildDirPath, 12 | }) 13 | .forEach(pkgJsonPath => { 14 | const pkgJson = readJsonSync(pkgJsonPath); 15 | 16 | delete pkgJson.browser; 17 | 18 | fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, '\t')); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/src/scripts/copy-sources.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import cpr from 'cpr'; 7 | import fs from 'fs-extra'; 8 | 9 | /** 10 | * 11 | */ 12 | export default function() { 13 | fs.mkdirpSync('build'); 14 | 15 | cpr('src', 'build', {confirm: true, overwrite: true}, err => { 16 | if (err) { 17 | console.error(err); 18 | process.exit(1); 19 | } else { 20 | console.log('JavaScript files copied.'); 21 | } 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-angular-portlet/templates/tsconfig.json.ejs: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "emitDecoratorMetadata": true, 4 | "experimentalDecorators": true, 5 | "inlineSources": true, 6 | "lib": ["es2015", "dom"], 7 | "module": "commonjs", 8 | "moduleResolution": "node", 9 | "noImplicitAny": true, 10 | "noStrictGenericChecks": true, 11 | "outDir": "build", 12 | "sourceMap": true, 13 | "suppressImplicitAnyIndexErrors": true, 14 | "target": "es5", 15 | "typeRoots": ["./node_modules/@types/"] 16 | }, 17 | "include": ["./src/**/*.ts"] 18 | } 19 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-preset-standard/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "/": { 3 | "plugins": ["resolve-linked-dependencies"], 4 | ".babelrc": { 5 | "presets": ["liferay-standard"] 6 | }, 7 | "post-plugins": ["namespace-packages", "inject-imports-dependencies"] 8 | }, 9 | "*": { 10 | "copy-plugins": ["exclude-imports"], 11 | "plugins": ["replace-browser-modules"], 12 | ".babelrc": { 13 | "presets": ["liferay-standard"] 14 | }, 15 | "post-plugins": [ 16 | "namespace-packages", 17 | "inject-imports-dependencies", 18 | "inject-peer-dependencies" 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/inner-override/inner/index.js: -------------------------------------------------------------------------------- 1 | // "is-object": "./my-is-object.js", 2 | // "./replaced.js": "./browser/replaced.js" 3 | 4 | module.exports = () => { 5 | console.log(` 6 | require('is-object')`); 7 | console.group(); 8 | require('is-object')(); 9 | console.groupEnd(); 10 | 11 | console.log(` 12 | require('./replaced.js')`); 13 | console.group(); 14 | require('./replaced.js')(); 15 | console.groupEnd(); 16 | 17 | console.log(` 18 | require('../is-object')`); 19 | console.group(); 20 | require('../is-object')(); 21 | console.groupEnd(); 22 | }; 23 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-css-loader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-loader-css-loader", 3 | "version": "2.19.3", 4 | "description": "A liferay-npm-bundler loader that turns CSS files into JavaScript modules that inject a into the HTML when they are required.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "liferay-npm-build-tools-common": "2.19.3", 13 | "read-json-sync": "^2.0.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/external-path-modules/index.js: -------------------------------------------------------------------------------- 1 | // "react": "./browser/react.js", 2 | // "react/path/to/module": "./browser/react-module.js" 3 | 4 | module.exports = () => { 5 | console.log(` 6 | require('react')`); 7 | console.group(); 8 | require('react')(); 9 | console.groupEnd(); 10 | 11 | console.log(` 12 | require('react/path/to/module')`); 13 | console.group(); 14 | require('react/path/to/module')(); 15 | console.groupEnd(); 16 | 17 | console.log(` 18 | require('./inner')`); 19 | console.group(); 20 | require('./inner')(); 21 | console.groupEnd(); 22 | }; 23 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-namespace-packages/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-namespace-packages", 3 | "version": "2.19.3", 4 | "description": "A liferay-npm-bundler plugin to namespace package names based on root project's name.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "devDependencies": { 12 | "read-json-sync": "^2.0.1" 13 | }, 14 | "dependencies": { 15 | "liferay-npm-build-tools-common": "2.19.3" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /resources/devtools/link-js-toolkit/link-js-toolkit.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 5 | * SPDX-License-Identifier: LGPL-3.0-or-later 6 | */ 7 | 8 | const linkDependencies = require('./link-dependencies'); 9 | const setupProject = require('./setup-project'); 10 | const setupYarnWorkspace = require('./setup-yarn-workspace'); 11 | 12 | if (process.argv[2] == '-w') { 13 | setupYarnWorkspace(); 14 | } else if (process.argv[2] == '-p') { 15 | setupProject(); 16 | } else { 17 | linkDependencies(process.argv.slice(2)); 18 | } 19 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/@scope/pkg-with-peer-deps/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * © 2017 Liferay, Inc. 3 | * 4 | * SPDX-License-Identifier: LGPL-3.0-or-later 5 | */ 6 | 7 | Liferay.Loader.define('@scope/pkg-with-peer-deps@1.0.0/index', ['module', 'exports', 'require', '@scope/number-is-nan'], function(module, exports, require, numberIsNan) { 8 | // we know numberIsNan is provided because it is installed by our @scope/is-finite 9 | // peer dependency 10 | console.log('numberIsNan', numberIsNan); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-resolve-linked-dependencies/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-resolve-linked-dependencies", 3 | "version": "2.19.3", 4 | "description": "A liferay-npm-bundler plugin to replace linked dependencies versions by their real values..", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "liferay-npm-build-tools-common": "2.19.3", 13 | "read-json-sync": "^2.0.1", 14 | "semver": "^6.3.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-replace-browser-modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-replace-browser-modules", 3 | "version": "2.19.3", 4 | "description": "A liferay-npm-bundler plugin to replace files listed under the browser/module entry of package.json files.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "dot-prop": "^5.0.1", 13 | "fs-extra": "^8.1.0", 14 | "liferay-npm-build-tools-common": "2.19.3" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/versions-info/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "preset": false, 3 | "*": { 4 | "plugins": ["test-0", "bundler-plugins/dir/plugin-0"], 5 | "post-plugins": ["test-1", "bundler-plugins/dir/plugin-1"], 6 | ".babelrc": { 7 | "plugins": [ 8 | "test-0", 9 | "babel-plugins/dir/plugin-0", 10 | "babel-plugins/dir/plugin-1" 11 | ] 12 | } 13 | }, 14 | "rules": [ 15 | { 16 | "test": "", 17 | "use": [ 18 | "loader-0", 19 | "bundler-plugins/dir/loader-0", 20 | "bundler-plugins/dir/loader-1" 21 | ] 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/jar/__tests__/__fixtures__/metatype.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /packages/liferay-npm-bridge-generator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bridge-generator", 3 | "version": "2.19.3", 4 | "description": "A CLI utility to generate module bridges (modules that re-export other modules).", 5 | "bin": { 6 | "liferay-npm-bridge-generator": "bin/liferay-npm-bridge-generator.js" 7 | }, 8 | "scripts": { 9 | "copyfiles": "node ../../scripts/copyfiles.js", 10 | "build": "tsc && yarn copyfiles", 11 | "prepublish": "yarn build" 12 | }, 13 | "dependencies": { 14 | "fs-extra": "^8.1.0", 15 | "globby": "^10.0.1", 16 | "read-json-sync": "^2.0.1", 17 | "yargs": "^14.0.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-exclude-imports/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bundler-plugin-exclude-imports 2 | 3 | > Exclude declared imports dependencies. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install --save-dev liferay-npm-bundler-plugin-exclude-imports 9 | ``` 10 | 11 | ## Usage 12 | 13 | Add the following to your `.npmbundlerrc` file: 14 | 15 | **Without options:** 16 | 17 | ```json 18 | { 19 | "*": { 20 | "plugins": ["exclude-imports"] 21 | } 22 | } 23 | ``` 24 | 25 | ## Technical Details 26 | 27 | This plugin excludes dependencies declared as imports inside the `.npmbundlerrc` 28 | from the final bundle. 29 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/pkg-for-logs/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * © 2017 Liferay, Inc. 3 | * 4 | * SPDX-License-Identifier: LGPL-3.0-or-later 5 | */ 6 | 7 | Liferay.Loader.define('pkg-for-logs@1.0.0/index', ['module', 'exports', 'require', 'number-is-nan', 'missing-dep'], function(module, exports, require, numberIsNan, missingDep) { 8 | // we know numberIsNan is provided because it is installed by our is-finite 9 | // peer dependency 10 | console.log('numberIsNan', numberIsNan); 11 | console.log('missingDep', missingDep); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-build-tools-common", 3 | "version": "2.19.3", 4 | "description": "Utility library for Liferay NPM Build Tools.", 5 | "scripts": { 6 | "copyfiles": "node ../../scripts/copyfiles.js", 7 | "build": "tsc && yarn copyfiles", 8 | "prepublish": "yarn build" 9 | }, 10 | "dependencies": { 11 | "chalk": "^2.4.2", 12 | "dot-prop": "^5.0.1", 13 | "escape-string-regexp": "^2.0.0", 14 | "liferay-npm-bundler-preset-standard": "2.19.3", 15 | "merge": "^1.2.1", 16 | "properties": "^1.2.1", 17 | "read-json-sync": "^2.0.1", 18 | "resolve": "^1.8.1" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-plugin-inject-peer-dependencies", 3 | "version": "2.19.3", 4 | "description": "A liferay-npm-bundler plugin to force injection of dependencies in packages declaring peer dependencies.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "globby": "^10.0.1", 13 | "liferay-npm-build-tools-common": "2.19.3", 14 | "read-json-sync": "^2.0.1", 15 | "resolve": "^1.8.1" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "alias-test", 3 | "version": "1.0.0", 4 | "scripts": { 5 | "clean": "node scripts/clean.js", 6 | "build": "yarn clean && liferay-npm-bundler && node scripts/remove-aliases.js && webpack-cli -C webpack.bundler.config.js && echo 'Build completed.'", 7 | "run-webpack": "node dist/webpack.js", 8 | "run-bundler": "node dist/bundler.js", 9 | "test": "yarn build && node scripts/test.js" 10 | }, 11 | "dependencies": {}, 12 | "devDependencies": { 13 | "colors": "^1.4.0", 14 | "diff": "^4.0.1", 15 | "rimraf": "^3.0.0", 16 | "webpack": "^4.41.2", 17 | "webpack-cli": "^3.3.9" 18 | } 19 | } -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-babel-loader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-loader-babel-loader", 3 | "version": "2.19.3", 4 | "description": "A liferay-npm-bundler loader that runs Babel on source files.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "babel-core": "^6.26.3", 13 | "data-urls": "^1.1.0", 14 | "liferay-npm-build-tools-common": "2.19.3", 15 | "read-json-sync": "^2.0.1" 16 | }, 17 | "devDependencies": { 18 | "babel-preset-es2015": "^6.24.1" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-peer-dependencies/src/__tests__/__fixtures__/project/node_modules/@project$1.0.0$scope/pkg-with-peer-deps/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * © 2017 Liferay, Inc. 3 | * 4 | * SPDX-License-Identifier: LGPL-3.0-or-later 5 | */ 6 | 7 | Liferay.Loader.define( 8 | '@project$1.0.0$scope/pkg-with-peer-deps@1.0.0/index', 9 | ['module', 'exports', 'require', '@project$scope/number-is-nan'], 10 | function(module, exports, require, numberIsNan) { 11 | // we know numberIsNan is provided because it is installed by our @scope/is-finite 12 | // peer dependency 13 | console.log('numberIsNan', numberIsNan); 14 | } 15 | ); 16 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/jar/__tests__/__fixtures__/preferences.l10n.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "a-number": { 4 | "type": "number", 5 | "name": "a-number", 6 | "description": "a-number-help", 7 | "default": "43" 8 | }, 9 | "a-string": { 10 | "type": "string", 11 | "name": "a-string", 12 | "required": true, 13 | "description": "a-string-help", 14 | "default": "a-string-value" 15 | }, 16 | "fruit": { 17 | "name": "a-fruit", 18 | "description": "a-fruit-help", 19 | "default": "orange", 20 | "options": { 21 | "orange": "an-orange", 22 | "pear": "a-pear", 23 | "apple": "an-apple" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/with-module-cfg/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "preset": "a-config/preset.json", 3 | "rules": [ 4 | { 5 | "test": "\\.js$", 6 | "exclude": "node_modules", 7 | "use": [ 8 | { 9 | "loader": "a-config/my-js-loader" 10 | } 11 | ] 12 | } 13 | ], 14 | "packages": { 15 | "a-package": { 16 | "copy-plugins": ["a-config/my-copy-plugin"], 17 | "plugins": ["a-config/my-pre-plugin"], 18 | ".babelrc": { 19 | "presets": ["a-config/my-babel-preset"], 20 | "plugins": ["a-config/my-babel-plugin"] 21 | }, 22 | "post-plugins": ["a-config/my-post-plugin"] 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-inject-imports-dependencies/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bundler-plugin-inject-imports-dependencies 2 | 3 | > Inject declared imports dependencies. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install --save-dev liferay-npm-bundler-plugin-inject-imports-dependencies 9 | ``` 10 | 11 | ## Usage 12 | 13 | Add the following to your `.npmbundlerrc` file: 14 | 15 | **Without options:** 16 | 17 | ```json 18 | { 19 | "*": { 20 | "plugins": ["inject-imports-dependencies"] 21 | } 22 | } 23 | ``` 24 | 25 | ## Technical Details 26 | 27 | This plugin injects dependencies declared as imports inside the `.npmbundlerrc` 28 | file in the `package.json` file. 29 | -------------------------------------------------------------------------------- /resources/devtools/find-generator/find-generator.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 5 | * SPDX-License-Identifier: LGPL-3.0-or-later 6 | */ 7 | 8 | const fs = require('fs'); 9 | const yeoman = require('yeoman-environment'); 10 | 11 | const env = yeoman.createEnv(); 12 | const paths = env.getNpmPaths(); 13 | 14 | paths.forEach(path => { 15 | if (!fs.existsSync(path)) { 16 | return; 17 | } 18 | 19 | const items = fs.readdirSync(path); 20 | 21 | items.forEach(item => { 22 | if (item === 'generator-liferay-js') { 23 | console.log('found generator-liferay-js in', path); 24 | } 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-copy-loader/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bundler-loader-copy-loader 2 | 3 | > A liferay-npm-bundler loader that copies files. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install --save-dev liferay-npm-bundler-loader-copy-loader 9 | ``` 10 | 11 | ## Usage 12 | 13 | In order to use this loader you must declare a rule in your module's `.npmbundlerrc` file: 14 | 15 | ```json 16 | { 17 | "rules": [ 18 | { 19 | "test": "^assets/", 20 | "use": ["copy-loader"] 21 | } 22 | ] 23 | } 24 | ``` 25 | 26 | See the project's wiki for more information on 27 | [how to use build rules](https://github.com/liferay/liferay-js-toolkit/wiki/How-to-use-build-rules). 28 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-copy-loader/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | /** 7 | * Tell the bundler we want the file as a raw Buffer so that we can copy 8 | * binaries too. 9 | */ 10 | export const metadata = { 11 | encoding: null, 12 | }; 13 | 14 | /** 15 | * @param {object} context loader's context 16 | */ 17 | export default function(context) { 18 | const {log} = context; 19 | 20 | // No need to do anything as the bundler will write the file in the build 21 | // directory. 22 | 23 | log.info('copy-loader', 'Copied file to build directory'); 24 | } 25 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-json-loader/src/__tests__/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`correctly generates JS module 1`] = ` 4 | Object { 5 | "dependencies": Object { 6 | "is-array": "1.0.0", 7 | }, 8 | "description": " 9 | A module that inserts \\\\ characters in files. 10 | ", 11 | "devDependencies": Object { 12 | "babel-cli": "^6.24.1", 13 | "babel-preset-es2015": "^6.24.1", 14 | }, 15 | "main": "index.js", 16 | "name": "backslash-inserter", 17 | "version": "1.0.0", 18 | } 19 | `; 20 | 21 | exports[`fails define when JSON is invalid 1`] = `"SyntaxError: Unexpected token h in JSON at position 1"`; 22 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-preset-vue-cli/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bundler-preset-vue-cli 2 | 3 | > Liferay NPM Bundler preset for [Vue CLI](https://cli.vuejs.org/) adapted 4 | > projects. 5 | 6 | ## Install 7 | 8 | ```sh 9 | npm install --save-dev liferay-npm-bundler-preset-vue-cli 10 | ``` 11 | 12 | ## Usage 13 | 14 | Add the following to your `.npmbundlerrc` file: 15 | 16 | ```json 17 | { 18 | "preset": "liferay-npm-bundler-preset-vue-cli" 19 | } 20 | ``` 21 | 22 | ## Technical Details 23 | 24 | This preset takes care of projects created with the 25 | [Vue CLI](https://cli.vuejs.org/) tool so that they can be correctly 26 | bundled and deployed to Liferay DXP or Liferay Portal CE. 27 | -------------------------------------------------------------------------------- /scripts/watch.js: -------------------------------------------------------------------------------- 1 | /** 2 | * © 2017 Liferay, Inc. 3 | * 4 | * SPDX-License-Identifier: LGPL-3.0-or-later 5 | */ 6 | 7 | const childProcess = require('child_process'); 8 | const globby = require('globby'); 9 | const path = require('path'); 10 | 11 | const tscFile = path.join(__dirname, '..', 'node_modules', '.bin', 'tsc'); 12 | 13 | globby.sync(['packages/*/tsconfig.json']).forEach(tsconfigPath => { 14 | const prjDir = path.dirname(tsconfigPath); 15 | 16 | childProcess.spawn('node', [tscFile, '-w'], { 17 | stdio: 'inherit', 18 | cwd: prjDir, 19 | shell: true, 20 | }); 21 | }); 22 | 23 | // Loop forever (use Ctrl+C to exit) 24 | setInterval(() => {}, 60000); 25 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-metaljs-portlet/templates/src/index.js.ejs: -------------------------------------------------------------------------------- 1 | <% if (sampleWanted) { %> 2 | import AppComponent from './AppComponent'; 3 | <% } %> 4 | 5 | /** 6 | * This is the main entry point of the portlet. 7 | * 8 | * See https://tinyurl.com/js-ext-portlet-entry-point for the most recent 9 | * information on the signature of this function. 10 | * 11 | * @param {Object} params a hash with values of interest to the portlet 12 | * @return {void} 13 | */ 14 | export default function main({<%- signature %>}) { 15 | <% if (sampleWanted) { %> 16 | const node = document.getElementById(portletElementId); 17 | 18 | new AppComponent({<%- signature %>}, node); 19 | <% } %> 20 | }; -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/src/resources/start/webpack.config.js.ejs: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | 3 | module.exports = { 4 | mode: 'development', 5 | devtool: 'source-map', 6 | entry: './index.js', 7 | output: { 8 | path: path.resolve(path.join(__dirname, 'build')), 9 | filename: 'webpack.bundle.js', 10 | }, 11 | devServer: { 12 | open: true, 13 | openPage: '', 14 | <% if (port) { %>port: <%= port %>,<% } %> 15 | <% if (proxy) { %>proxy: <%= proxy %>,<% } %> 16 | publicPath: '/o/<%= pkgName %>/', 17 | }, 18 | plugins: [new require('copy-webpack-plugin')(['../assets'])], 19 | module: { 20 | rules: <%= rules %>, 21 | }, 22 | resolve: { 23 | extensions: <%= extensions %> 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /packages/babel-plugin-add-module-metadata/README.md: -------------------------------------------------------------------------------- 1 | # babel-plugin-add-module-metadata 2 | 3 | > Add AMD modules' metadata to the manifest.json file. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install --save-dev babel-plugin-add-module-metadata 9 | ``` 10 | 11 | ## Usage 12 | 13 | Add the following to your `.babelrc` file: 14 | 15 | **Without options:** 16 | 17 | ```json 18 | { 19 | "plugins": ["add-module-metadata"] 20 | } 21 | ``` 22 | 23 | ## Technical Details and Options 24 | 25 | This plugin scans JS modules for certain patterns of code and adds metadata to 26 | the `manifest.json` file generated by the `liferay-npm-bundler`. 27 | 28 | Such metadata may be used to describe the module prior to its load or parse. 29 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-angular-portlet/templates/assets/app/app.component.html.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 | {{labels.portletNamespace}}: 4 | {{params.portletNamespace}} 5 |
6 |
7 | {{labels.contextPath}}: 8 | {{params.contextPath}} 9 |
10 |
11 | {{labels.portletElementId}}: 12 | {{params.portletElementId}} 13 |
14 | <% if (hasConfiguration) { %> 15 |
16 | {{labels.configuration}}: 17 | {{configurationJSON}} 18 |
19 | <% } %> 20 |
21 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-resolve-linked-dependencies/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bundler-plugin-resolve-linked-dependencies 2 | 3 | > Replace linked dependencies versions by their real values. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install --save-dev liferay-npm-bundler-plugin-resolve-linked-dependencies 9 | ``` 10 | 11 | ## Usage 12 | 13 | Add the following to your `.npmbundlerrc` file: 14 | 15 | **Without options:** 16 | 17 | ```json 18 | { 19 | "*": { 20 | "plugins": ["resolve-linked-dependencies"] 21 | } 22 | } 23 | ``` 24 | 25 | ## Technical Details 26 | 27 | This plugin replaces links to `file://` dependencies by their real version 28 | number, taken from the resolved package looking up in `node_modules`. 29 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/inner-override/index.js: -------------------------------------------------------------------------------- 1 | // "is-object": "./my-is-object.js", 2 | // "./inner/replaced.js": "./browser/replaced.js" 3 | 4 | module.exports = () => { 5 | console.log(` 6 | require('is-object')`); 7 | console.group(); 8 | require('is-object')(); 9 | console.groupEnd(); 10 | 11 | console.log(` 12 | require('./inner/is-object')`); 13 | console.group(); 14 | require('./inner/is-object')(); 15 | console.groupEnd(); 16 | 17 | console.log(` 18 | require('./inner/replaced.js')`); 19 | console.group(); 20 | require('./inner/replaced.js')(); 21 | console.groupEnd(); 22 | 23 | console.log(` 24 | require('./inner')`); 25 | console.group(); 26 | require('./inner')(); 27 | console.groupEnd(); 28 | }; 29 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/outside-precedence/outside/index.js: -------------------------------------------------------------------------------- 1 | module.exports = () => { 2 | console.log(` 3 | require('../file-vs-module/file');`); 4 | console.group(); 5 | require('../file-vs-module/file')(); 6 | console.groupEnd(); 7 | 8 | console.log(` 9 | require('../file-vs-module/file.js');`); 10 | console.group(); 11 | require('../file-vs-module/file.js')(); 12 | console.groupEnd(); 13 | 14 | console.log(` 15 | require('../inner-vs-outer/inner/file.js');`); 16 | console.group(); 17 | require('../inner-vs-outer/inner/file.js')(); 18 | console.groupEnd(); 19 | 20 | console.log(` 21 | require('../inner-vs-outer');`); 22 | console.group(); 23 | require('../inner-vs-outer')(); 24 | console.groupEnd(); 25 | }; 26 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/src/scripts/copy-assets.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import cpr from 'cpr'; 7 | import fs from 'fs-extra'; 8 | 9 | /** 10 | * 11 | */ 12 | export default function() { 13 | fs.mkdirpSync('build'); 14 | 15 | cpr( 16 | 'assets', 17 | 'build', 18 | { 19 | confirm: true, 20 | filter: path => !/\/\.placeholder$/.test(path), 21 | overwrite: true, 22 | }, 23 | err => { 24 | if (err && err.message !== 'No files to copy') { 25 | console.error(err); 26 | process.exit(1); 27 | } else { 28 | console.log('Project assets copied.'); 29 | } 30 | } 31 | ); 32 | } 33 | -------------------------------------------------------------------------------- /packages/liferay-npm-imports-checker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-imports-checker", 3 | "version": "2.19.3", 4 | "description": "A CLI utility to check `imports` sections of `.npmbundlerrc` files in a multiproject source tree.", 5 | "bin": { 6 | "liferay-npm-imports-checker": "bin/liferay-npm-imports-checker.js" 7 | }, 8 | "scripts": { 9 | "copyfiles": "node ../../scripts/copyfiles.js", 10 | "build": "tsc && yarn copyfiles", 11 | "prepublish": "yarn build" 12 | }, 13 | "dependencies": { 14 | "chalk": "^2.4.2", 15 | "fs-extra": "^8.1.0", 16 | "globby": "^10.0.1", 17 | "liferay-npm-build-tools-common": "2.19.3", 18 | "read-json-sync": "^2.0.1", 19 | "resolve": "^1.8.1", 20 | "semver": "^6.3.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /qa/samples/packages/loaders/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "sources": ["src"], 3 | "rules": [ 4 | { 5 | "test": "\\.json$", 6 | "exclude": "node_modules", 7 | "use": ["json-loader"] 8 | }, 9 | { 10 | "test": "src/css/.*\\.css$", 11 | "exclude": "node_modules", 12 | "use": ["css-loader"] 13 | }, 14 | { 15 | "test": "src/style/.*\\.css$", 16 | "exclude": "node_modules", 17 | "use": ["style-loader"] 18 | }, 19 | { 20 | "test": "\\.scss$", 21 | "exclude": "node_modules", 22 | "use": ["sass-loader", "css-loader"] 23 | } 24 | ], 25 | "create-jar": { 26 | "output-dir": "dist", 27 | "features": { 28 | "js-extender": true, 29 | "web-context": "/loaders" 30 | } 31 | }, 32 | "dump-report": false 33 | } 34 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-exclude-imports/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import {unrollImportsConfig} from 'liferay-npm-build-tools-common/lib/imports'; 7 | 8 | /** 9 | * @return {void} 10 | */ 11 | export default function({config, globalConfig, log, pkg}, {files}) { 12 | let imports = config.imports || globalConfig.imports || {}; 13 | 14 | imports = unrollImportsConfig(imports); 15 | 16 | if (imports[pkg.name]) { 17 | files.length = 0; 18 | 19 | log.info( 20 | 'exclude-imports', 21 | 'Excluding package', 22 | pkg.id, 23 | 'from output as it is configured as an import.' 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-preset-standard/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler-preset-standard", 3 | "version": "2.19.3", 4 | "description": "Standard configuration for liferay-npm-bundler.", 5 | "main": "config.json", 6 | "dependencies": { 7 | "babel-preset-liferay-standard": "2.19.3", 8 | "liferay-npm-bundler-plugin-exclude-imports": "2.19.3", 9 | "liferay-npm-bundler-plugin-inject-imports-dependencies": "2.19.3", 10 | "liferay-npm-bundler-plugin-inject-peer-dependencies": "2.19.3", 11 | "liferay-npm-bundler-plugin-namespace-packages": "2.19.3", 12 | "liferay-npm-bundler-plugin-replace-browser-modules": "2.19.3", 13 | "liferay-npm-bundler-plugin-resolve-linked-dependencies": "2.19.3" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/types.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * © 2017 Liferay, Inc. 3 | * 4 | * SPDX-License-Identifier: LGPL-3.0-or-later 5 | */ 6 | 7 | import {BundlerPluginEntryPoint} from '../api/plugins'; 8 | 9 | /** 10 | * An bundler plugin description. 11 | * 12 | * @remarks 13 | * Note that `run` field has a different signature for each plugin type (see 14 | * {@link BundlerPluginEntryPoint}). 15 | * 16 | * @see BundlerPluginEntryPoint 17 | */ 18 | export interface BundlerPluginDescriptor { 19 | name: string; 20 | config: object; 21 | run: BundlerPluginEntryPoint; 22 | } 23 | 24 | /** Plugin version information */ 25 | export interface VersionInfo { 26 | version: string; 27 | path: string; 28 | } 29 | -------------------------------------------------------------------------------- /packages/babel-plugin-wrap-modules-amd/src/__tests__/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`correctly wraps modules 1`] = ` 4 | "define(['module', 'exports', 'require'], function (module, exports, require) { 5 | var define = undefined; 6 | var global = window; 7 | { 8 | console.log('Say something'); 9 | if (1 == 0) { 10 | console.log('Something broke in the Matrix'); 11 | } 12 | module.exports = 'All OK'; 13 | } 14 | });" 15 | `; 16 | 17 | exports[`logs results correctly 1`] = ` 18 | Array [ 19 | Object { 20 | "level": "info", 21 | "source": "wrap-modules-amd", 22 | "things": Array [ 23 | "Detected dependencies: 'a-module', 'b-module'", 24 | ], 25 | }, 26 | ] 27 | `; 28 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-json-loader/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bundler-loader-json-loader 2 | 3 | > A liferay-npm-bundler loader that turns JSON files into JavaScript modules 4 | > that export the parsed JSON object. 5 | 6 | ## Installation 7 | 8 | ```sh 9 | npm install --save-dev liferay-npm-bundler-loader-json-loader 10 | ``` 11 | 12 | ## Usage 13 | 14 | In order to use this loader you must declare a rule in your module's `.npmbundlerrc` file: 15 | 16 | ```json 17 | { 18 | "rules": [ 19 | { 20 | "test": "\\.json$", 21 | "use": ["json-loader"] 22 | } 23 | ] 24 | } 25 | ``` 26 | 27 | See the project's wiki for more information on 28 | [how to use build rules](https://github.com/liferay/liferay-js-toolkit/wiki/How-to-use-build-rules). 29 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/log.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import project from 'liferay-npm-build-tools-common/lib/project'; 7 | 8 | /** 9 | * Log errors 10 | * @return {void} 11 | */ 12 | export function error(...args) { 13 | console.log(...args); 14 | } 15 | 16 | /** 17 | * Log message as console.log does 18 | * @return {void} 19 | */ 20 | export function info(...args) { 21 | console.log(...args); 22 | } 23 | 24 | /** 25 | * Log message as console.log does but only if verbose is on 26 | * @return {void} 27 | */ 28 | export function debug(...args) { 29 | if (project.misc.verbose) { 30 | console.log(...args); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /scripts/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # © 2017 Liferay, Inc. 4 | # 5 | # SPDX-License-Identifier: LGPL-3.0-or-later 6 | 7 | ## 8 | # Wrapper for `lerna publish` that attempts to detect the appropriate remote to 9 | # use and passes `--git-remote` accordingly. 10 | # 11 | 12 | REMOTE=$(git remote -v | grep 'github.com[:/]liferay/' | grep '(push)' | sort -k2 | head -1 | cut -f1) 13 | 14 | if [ -n "$REMOTE" ]; then 15 | yarn run lerna publish "$@" --git-remote="$REMOTE" 16 | else 17 | echo 'warning: could not locate a "liferay" remote' 18 | 19 | read -p 'Proceed using "origin" remote? ' -n 1 -r 20 | echo 21 | 22 | if [[ $REPLY =~ ^[Yy]$ ]]; then 23 | yarn run lerna publish "$@" 24 | else 25 | echo Aborted. 26 | exit 1 27 | fi 28 | fi 29 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/src/scripts/deploy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import fs from 'fs'; 7 | import project from 'liferay-npm-build-tools-common/lib/project'; 8 | import path from 'path'; 9 | 10 | import * as cfg from '../config'; 11 | 12 | /** 13 | * 14 | */ 15 | export default function() { 16 | const liferayDirPath = cfg.getLiferayDir(); 17 | 18 | const outputDir = project.jar.outputDir; 19 | const jarName = project.jar.outputFilename; 20 | 21 | fs.copyFileSync( 22 | outputDir.join(jarName).asNative, 23 | path.join(liferayDirPath, 'osgi', 'modules', jarName) 24 | ); 25 | 26 | console.log(`Deployed ${jarName} to ${liferayDirPath}`); 27 | } 28 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-style-loader/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bundler-loader-style-loader 2 | 3 | > A liferay-npm-bundler loader that turns CSS files into JavaScript modules that 4 | > inject the CSS into the HTML when they are required. 5 | 6 | ## Installation 7 | 8 | ```sh 9 | npm install --save-dev liferay-npm-bundler-loader-style-loader 10 | ``` 11 | 12 | ## Usage 13 | 14 | In order to use this loader you must declare a rule in your module's `.npmbundlerrc` file: 15 | 16 | ```json 17 | { 18 | "rules": [ 19 | { 20 | "test": "\\.css$", 21 | "use": ["style-loader"] 22 | } 23 | ] 24 | } 25 | ``` 26 | 27 | See the project's wiki for more information on 28 | [how to use build rules](https://github.com/liferay/liferay-js-toolkit/wiki/How-to-use-build-rules). 29 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-angular-portlet/templates/src/app/app.module.ts.ejs: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | 4 | import { AppComponent } from './app.component'; 5 | 6 | @NgModule({ 7 | imports: [BrowserModule], 8 | declarations: [AppComponent], 9 | entryComponents: [AppComponent], 10 | bootstrap: [], // Don't bootstrap any component statically (see ngDoBootstrap() below) 11 | providers: [], 12 | }) 13 | export class AppModule { 14 | // Avoid bootstraping any component statically because we need to attach to 15 | // the portlet's DOM, which is different for each portlet instance and, 16 | // thus, cannot be determined until the page is rendered (during runtime). 17 | ngDoBootstrap() {} 18 | } 19 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-preset-create-react-app/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bundler-preset-create-react-app 2 | 3 | > Liferay NPM Bundler preset for 4 | > [create-react-app](https://github.com/facebook/create-react-app) adapted 5 | > projects. 6 | 7 | ## Install 8 | 9 | ```sh 10 | npm install --save-dev liferay-npm-bundler-preset-create-react-app 11 | ``` 12 | 13 | ## Usage 14 | 15 | Add the following to your `.npmbundlerrc` file: 16 | 17 | ```json 18 | { 19 | "preset": "liferay-npm-bundler-preset-create-react-app" 20 | } 21 | ``` 22 | 23 | ## Technical Details 24 | 25 | This preset takes care of projects created with the 26 | [create-react-app](https://github.com/facebook/create-react-app) tool so that 27 | they can be correctly bundled and deployed to Liferay DXP or Liferay Portal CE. 28 | -------------------------------------------------------------------------------- /qa/samples/packages/loaders/src/index.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | const fileJson = require('./file.json'); 4 | require('./style/red-border.css'); 5 | require('./css/green-border.css'); 6 | require('./blue-border.css'); 7 | 8 | function main(params) { 9 | var node = document.getElementById(params.portletElementId); 10 | 11 | node.innerHTML = 12 | '
' + 13 | '' + 14 | 'JSON file:' + 15 | '' + 16 | '
' +
17 | 		JSON.stringify(fileJson, null, 2) +
18 | 		'
' + 19 | '
' + 20 | '
A red border div (from style-loader)
' + 21 | '
A green border div (from css-loader)
' + 22 | '
A blue border div (from sass-loader)
'; 23 | } 24 | 25 | module.exports = main; 26 | -------------------------------------------------------------------------------- /qa/poshi/portal-ext.properties: -------------------------------------------------------------------------------- 1 | # this will turn off an annoying message; you'll want this line 2 | plugins.notification.enabled=false 3 | 4 | # these next lines will configure the MySQL connections 5 | jdbc.default.jndi.name= 6 | 7 | # jdbc.default.driverClassName=com.mysql.jdbc.Driver 8 | # jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false 9 | # jdbc.default.username=root 10 | # jdbc.default.password= 11 | 12 | browser.launcher.url= 13 | 14 | # this will allow Liferay to reindex stuff when starting up 15 | index.on.startup=true 16 | 17 | mail.session.jndi.name= 18 | 19 | axis.servlet.hosts.allowed= 20 | 21 | tunnel.servlet.hosts.allowed= 22 | 23 | terms.of.use.required=false 24 | 25 | setup.wizard.enabled=false 26 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-react-portlet/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import Generator from 'yeoman-generator'; 7 | 8 | import * as standardTarget from '../utils/target/standard'; 9 | 10 | /** 11 | * Generator for React portlets. 12 | */ 13 | export default class extends Generator { 14 | /** 15 | * Standard Yeoman initialization function 16 | */ 17 | initializing() { 18 | standardTarget.initializing(this); 19 | 20 | this.composeWith(require.resolve('./react-portlet')); 21 | } 22 | 23 | /** 24 | * Standard Yeoman install function 25 | */ 26 | install() { 27 | standardTarget.install(this); 28 | } 29 | } 30 | 31 | module.exports = exports['default']; 32 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-vuejs-portlet/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import Generator from 'yeoman-generator'; 7 | 8 | import * as standardTarget from '../utils/target/standard'; 9 | 10 | /** 11 | * Generator for Vue.js portlets. 12 | */ 13 | export default class extends Generator { 14 | /** 15 | * Standard Yeoman initialization function 16 | */ 17 | initializing() { 18 | standardTarget.initializing(this); 19 | 20 | this.composeWith(require.resolve('./vuejs-portlet')); 21 | } 22 | 23 | /** 24 | * Standard Yeoman install function 25 | */ 26 | install() { 27 | standardTarget.install(this); 28 | } 29 | } 30 | 31 | module.exports = exports['default']; 32 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-angular-portlet/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import Generator from 'yeoman-generator'; 7 | 8 | import * as standardTarget from '../utils/target/standard'; 9 | 10 | /** 11 | * Generator for Angular portlets. 12 | */ 13 | export default class extends Generator { 14 | /** 15 | * Standard Yeoman initialization function 16 | */ 17 | initializing() { 18 | standardTarget.initializing(this); 19 | 20 | this.composeWith(require.resolve('./angular-portlet')); 21 | } 22 | 23 | /** 24 | * Standard Yeoman install function 25 | */ 26 | install() { 27 | standardTarget.install(this); 28 | } 29 | } 30 | 31 | module.exports = exports['default']; 32 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-metaljs-portlet/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import Generator from 'yeoman-generator'; 7 | 8 | import * as standardTarget from '../utils/target/standard'; 9 | 10 | /** 11 | * Generator for Metal.js portlets. 12 | */ 13 | export default class extends Generator { 14 | /** 15 | * Standard Yeoman initialization function 16 | */ 17 | initializing() { 18 | standardTarget.initializing(this); 19 | 20 | this.composeWith(require.resolve('./metaljs-portlet')); 21 | } 22 | 23 | /** 24 | * Standard Yeoman install function 25 | */ 26 | install() { 27 | standardTarget.install(this); 28 | } 29 | } 30 | 31 | module.exports = exports['default']; 32 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-vanilla-portlet/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import Generator from 'yeoman-generator'; 7 | 8 | import * as standardTarget from '../utils/target/standard'; 9 | 10 | /** 11 | * Generator for vanilla JS portlets. 12 | */ 13 | export default class extends Generator { 14 | /** 15 | * Standard Yeoman initialization function 16 | */ 17 | initializing() { 18 | standardTarget.initializing(this); 19 | 20 | this.composeWith(require.resolve('./vanilla-portlet')); 21 | } 22 | 23 | /** 24 | * Standard Yeoman install function 25 | */ 26 | install() { 27 | standardTarget.install(this); 28 | } 29 | } 30 | 31 | module.exports = exports['default']; 32 | -------------------------------------------------------------------------------- /packages/babel-plugin-normalize-requires/README.md: -------------------------------------------------------------------------------- 1 | # babel-plugin-normalize-requires 2 | 3 | > Normalize AMD `require()` calls. 4 | 5 | ## Example 6 | 7 | **In** 8 | 9 | ```javascript 10 | require('./a-module.js'); 11 | ``` 12 | 13 | **Out** 14 | 15 | ```javascript 16 | require('./a-module'); 17 | ``` 18 | 19 | ## Installation 20 | 21 | ```sh 22 | npm install --save-dev babel-plugin-normalize-requires 23 | ``` 24 | 25 | ## Usage 26 | 27 | Add the following to your `.babelrc` file: 28 | 29 | ```json 30 | { 31 | "plugins": ["normalize-requires"] 32 | } 33 | ``` 34 | 35 | ## Technical Details 36 | 37 | This plugin removes `.js` and `/` suffixes from module names used in AMD 38 | `require()` calls. 39 | 40 | However, the plugin is smart enough to not remove `.js` suffixes when they are 41 | part of the npm package name (as opposed to module name). 42 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-liferay-js", 3 | "version": "2.19.3", 4 | "description": "Yeoman generators for Liferay DXP and Portal CE JavaScript projects.", 5 | "main": "generators/app/index.js", 6 | "files": [ 7 | "generators" 8 | ], 9 | "keywords": [ 10 | "yeoman-generator", 11 | "liferay", 12 | "liferay-js" 13 | ], 14 | "scripts": { 15 | "copyfiles": "node ../../scripts/copyfiles.js", 16 | "build": "tsc && yarn copyfiles", 17 | "prepublish": "yarn build" 18 | }, 19 | "devDependencies": { 20 | "mem-fs": "^1.1.3", 21 | "mem-fs-editor": "^6.0.0", 22 | "rimraf": "^3.0.0" 23 | }, 24 | "dependencies": { 25 | "dot-prop": "^5.0.1", 26 | "liferay-npm-build-tools-common": "2.19.3", 27 | "read-json-sync": "^2.0.1", 28 | "yargs": "^14.0.0", 29 | "yeoman-generator": "^3.2.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/plugin-logger.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import PluginLogger from '../plugin-logger'; 7 | 8 | describe('when working with messages', () => { 9 | let log; 10 | 11 | beforeEach(() => { 12 | log = new PluginLogger(); 13 | 14 | log.info('info-source', 'info-thing-1', 'info-thing-2'); 15 | log.error('error-source', 'error-thing-1'); 16 | }); 17 | 18 | it('stores them correctly', () => { 19 | expect(log.messages).toMatchSnapshot(); 20 | }); 21 | 22 | it('dumps them as HTML correctly', () => { 23 | expect(log.toHtml()).toMatchSnapshot(); 24 | }); 25 | 26 | it('dumps them as text correctly', () => { 27 | expect(log.toString()).toMatchSnapshot(); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /qa/README.md: -------------------------------------------------------------------------------- 1 | # qa 2 | 3 | This folder contains predefined configurations to automatically generate project 4 | instances that can be used to do QA testing in the project. 5 | 6 | ## Auto-generate samples 7 | 8 | ### Prerequisistes 9 | 10 | - Create a file called .generator-liferay-js.json in your \$HOME directory with these contents: 11 | 12 | ``` 13 | { 14 | "sdkVersion": "directory/of/your/local/liferay-js-toolkit", 15 | "answers": { 16 | "facet-deploy": { 17 | "liferayPresent": true, 18 | "liferayDir": "directory/of/your/local/liferay/bundle" 19 | } 20 | } 21 | } 22 | 23 | ``` 24 | 25 | ### generate-samples.js script 26 | 27 | You can run the script `generate-samples.js` to generate all existing 28 | predefined project instances. 29 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-babel-loader/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bundler-loader-babel-loader 2 | 3 | > A liferay-npm-bundler loader that runs Babel on source files. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install --save-dev liferay-npm-bundler-loader-babel-loader 9 | ``` 10 | 11 | ## Usage 12 | 13 | In order to use this loader you must declare a rule in your module's `.npmbundlerrc` file: 14 | 15 | ```json 16 | { 17 | "rules": [ 18 | { 19 | "test": "\\.js$", 20 | "exclude": "node_modules", 21 | "use": [ 22 | { 23 | "loader": "babel-loader", 24 | "options": { 25 | "presets": ["env", "react"] 26 | } 27 | } 28 | ] 29 | } 30 | ] 31 | } 32 | ``` 33 | 34 | See the project's wiki for more information on 35 | [how to use build rules](https://github.com/liferay/liferay-js-toolkit/wiki/How-to-use-build-rules). 36 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/utils/modifier/gitignore.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | /** 7 | * A class to help modifying the .gitignore file. 8 | */ 9 | export default class { 10 | /** 11 | * @param {Generator} generator a Yeoman generator 12 | */ 13 | constructor(generator) { 14 | this._generator = generator; 15 | this._path = '.gitignore'; 16 | } 17 | 18 | /** 19 | * Add a line to .gitignore 20 | * @param {string} line 21 | */ 22 | add(line) { 23 | const gen = this._generator; 24 | 25 | let content = gen.fs.read(this._path).toString(); 26 | 27 | if (content.charAt(content.length - 1) !== '\n') { 28 | content += '\n'; 29 | } 30 | 31 | content += line; 32 | 33 | gen.fs.write(this._path, content); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-json-loader/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | /** 7 | * @param {object} context loader's context 8 | * @return {string} the processed file content 9 | */ 10 | export default function(context) { 11 | const {filePath, log} = context; 12 | let {content} = context; 13 | 14 | try { 15 | content = JSON.stringify(JSON.parse(content)); 16 | 17 | // content = content.replace(//g, '\n'); 18 | 19 | context.extraArtifacts[`${filePath}.js`] = ` 20 | module.exports = JSON.parse(${JSON.stringify(content)}); 21 | `; 22 | } catch (err) { 23 | context.extraArtifacts[`${filePath}.js`] = ` 24 | throw new Error('${err.toString()}') 25 | `; 26 | } 27 | 28 | log.info('json-loader', `Generated JavaScript JSON module`); 29 | } 30 | -------------------------------------------------------------------------------- /packages/babel-preset-liferay-standard/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-preset-liferay-standard", 3 | "version": "2.19.3", 4 | "description": "Babel preset for bundling standard Liferay projects.", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "copyfiles": "node ../../scripts/copyfiles.js", 8 | "build": "tsc && yarn copyfiles", 9 | "prepublish": "yarn build" 10 | }, 11 | "dependencies": { 12 | "babel-plugin-add-module-metadata": "2.19.3", 13 | "babel-plugin-alias-modules": "2.19.3", 14 | "babel-plugin-minify-dead-code-elimination": "0.5.1", 15 | "babel-plugin-name-amd-modules": "2.19.3", 16 | "babel-plugin-namespace-amd-define": "2.19.3", 17 | "babel-plugin-namespace-modules": "2.19.3", 18 | "babel-plugin-normalize-requires": "2.19.3", 19 | "babel-plugin-transform-node-env-inline": "0.4.3", 20 | "babel-plugin-wrap-modules-amd": "2.19.3" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /scripts/copyfiles.js: -------------------------------------------------------------------------------- 1 | /** 2 | * © 2017 Liferay, Inc. 3 | * 4 | * SPDX-License-Identifier: LGPL-3.0-or-later 5 | */ 6 | 7 | const copyfiles = require('copyfiles'); 8 | const fs = require('fs'); 9 | 10 | let inputs = ['src/**/*']; 11 | let output = 'lib/'; 12 | let options = { 13 | all: true, 14 | exclude: ['**/*.js', '**/*.ts', '**/__tests__/**/*'], 15 | up: 1, 16 | }; 17 | 18 | if (fs.existsSync('copyfiles.json')) { 19 | const cfg = JSON.parse(fs.readFileSync('copyfiles.json').toString()); 20 | 21 | if (cfg.inputs) { 22 | inputs = cfg.inputs; 23 | } 24 | 25 | if (cfg.output) { 26 | output = cfg.output; 27 | } 28 | 29 | if (cfg.options) { 30 | options = Object.assign(options, cfg.options); 31 | } 32 | } 33 | 34 | copyfiles([...inputs, output], options, err => { 35 | if (err) { 36 | console.error(err); 37 | process.exit(1); 38 | } 39 | }); 40 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-preset-standard/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bundler-preset-standard 2 | 3 | > Liferay NPM Bundler preset for regular npm modules. 4 | 5 | ## Install 6 | 7 | ```sh 8 | npm install --save-dev liferay-npm-bundler-preset-standard 9 | ``` 10 | 11 | ## Usage 12 | 13 | Add the following to your `.npmbundlerrc` file: 14 | 15 | ```json 16 | { 17 | "preset": "liferay-npm-bundler-preset-standard" 18 | } 19 | ``` 20 | 21 | ## Technical Details 22 | 23 | This preset includes the following Babel presets: 24 | 25 | 1. [babel-preset-liferay-standard](https://github.com/izaera/liferay-js-toolkit/tree/master/packages/babel-preset-liferay-standard) 26 | 27 | And the following Liferay NPM Bundler plugins: 28 | 29 | 1. [liferay-npm-bundler-plugin-replace-browser-modules](https://github.com/izaera/liferay-js-toolkit/tree/master/packages/liferay-npm-bundler-plugin-replace-browser-modules) 30 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/steps/__tests__/transform.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import path from 'path'; 7 | 8 | import {loadSourceMap} from '../transform'; 9 | 10 | describe('loadSourceMap()', () => { 11 | it('works with //# annotation', () => { 12 | const sourceMap = loadSourceMap( 13 | path.join( 14 | __dirname, 15 | '__fixtures__', 16 | 'sourcemaps', 17 | 'sourceMapFile1.js.file' 18 | ) 19 | ); 20 | 21 | expect(sourceMap).toMatchSnapshot(); 22 | }); 23 | 24 | it('works with /*# annotation', () => { 25 | const sourceMap = loadSourceMap( 26 | path.join( 27 | __dirname, 28 | '__fixtures__', 29 | 'sourcemaps', 30 | 'sourceMapFile2.js.file' 31 | ) 32 | ); 33 | 34 | expect(sourceMap).toMatchSnapshot(); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__snapshots__/plugin-logger.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`when working with messages dumps them as HTML correctly 1`] = `"info-source:info: info-thing-1 info-thing-2
error-source:error: error-thing-1
"`; 4 | 5 | exports[`when working with messages dumps them as text correctly 1`] = ` 6 | "info-source:info: info-thing-1 info-thing-2 7 | error-source:error: error-thing-1 8 | " 9 | `; 10 | 11 | exports[`when working with messages stores them correctly 1`] = ` 12 | Array [ 13 | Object { 14 | "level": "info", 15 | "source": "info-source", 16 | "things": Array [ 17 | "info-thing-1", 18 | "info-thing-2", 19 | ], 20 | }, 21 | Object { 22 | "level": "error", 23 | "source": "error-source", 24 | "things": Array [ 25 | "error-thing-1", 26 | ], 27 | }, 28 | ] 29 | `; 30 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-angular-portlet/templates/src/app/app.component.ts.ejs: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import LiferayParams from '../types/LiferayParams' 4 | 5 | declare const Liferay: any; 6 | 7 | @Component({ 8 | templateUrl: 9 | Liferay.ThemeDisplay.getPathContext() + 10 | '/o/<%= pkgJson.name %>/app/app.component.html' 11 | }) 12 | export class AppComponent { 13 | params: LiferayParams; 14 | labels: any; 15 | 16 | constructor() { 17 | this.labels = { 18 | <% if (hasConfiguration) { %> 19 | configuration: <%- labels.configuration %>, 20 | <% } %> 21 | portletNamespace: <%- labels.portletNamespace %>, 22 | contextPath: <%- labels.contextPath %>, 23 | portletElementId: <%- labels.portletElementId %>, 24 | } 25 | } 26 | 27 | get configurationJSON() { 28 | return JSON.stringify(this.params.configuration, null, 2); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/transform/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "preset": false, 3 | "output": "output-dir", 4 | "exclude": { 5 | "*": ["test/**/*"], 6 | "package-a": ["*"], 7 | "package-b@1.0.0": ["**/*.js", "**/*.css"] 8 | }, 9 | "*": { 10 | "plugins": ["test-0", ["test-1", "config-1"]], 11 | "post-plugins": ["test-2", ["test-3", "config-3"]], 12 | ".babelrc": { 13 | "config": "config-*" 14 | } 15 | }, 16 | "packages": { 17 | "package@1.0.0": { 18 | "plugins": ["test-4", ["test-5", "config-5"]], 19 | "post-plugins": ["test-6", ["test-7", "config-7"]], 20 | ".babelrc": { 21 | "config": "config-package@1.0.0" 22 | } 23 | }, 24 | "package2": { 25 | ".babelrc": { 26 | "config": "config-package2" 27 | } 28 | }, 29 | "package3": { 30 | ".babelrc": { 31 | "plugins": ["raw", ["configured", {"the": "config"}]] 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /scripts/check-deps.js: -------------------------------------------------------------------------------- 1 | /** 2 | * © 2017 Liferay, Inc. 3 | * 4 | * SPDX-License-Identifier: LGPL-3.0-or-later 5 | */ 6 | 7 | const getDepVersions = require('./util/get-dep-versions'); 8 | 9 | const depVersions = getDepVersions(); 10 | let mismatchsFound = false; 11 | 12 | Object.entries(depVersions).forEach(([pkg, versions]) => { 13 | if (Object.keys(versions).length > 1) { 14 | mismatchsFound = true; 15 | 16 | console.log(pkg, ':'); 17 | 18 | console.group(); 19 | Object.keys(versions).forEach(version => { 20 | console.log(version, ':'); 21 | 22 | console.group(); 23 | versions[version].forEach(prj => console.log(prj)); 24 | console.groupEnd(); 25 | }); 26 | console.groupEnd(); 27 | } 28 | }); 29 | 30 | if (mismatchsFound) { 31 | console.log(` 32 | 33 | Unleveled package versions exist in the project (see report above). 34 | 35 | Please correct them! 36 | `); 37 | process.exit(1); 38 | } 39 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/utils/modifier/assets/css/styles.css.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | /** 7 | * A class to help modifying the styles.css file. 8 | */ 9 | export default class { 10 | /** 11 | * @param {Generator} generator a Yeoman generator 12 | */ 13 | constructor(generator) { 14 | this._generator = generator; 15 | this._path = 'assets/css/styles.css'; 16 | } 17 | 18 | /** 19 | * Add a CSS rule to styles.css file. 20 | * @param {String} selector CSS selector 21 | * @param {Array} values string list of CSS attributes 22 | */ 23 | addRule(selector, ...values) { 24 | const gen = this._generator; 25 | 26 | let css = gen.fs.read(this._path); 27 | 28 | css += `${selector} { 29 | ${values.map(value => ` ${value}`).join('\n')} 30 | }\n\n`; 31 | 32 | gen.fs.write(this._path, css); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /qa/samples/packages/loaders/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "loaders", 3 | "version": "1.0.0", 4 | "description": "Loaders", 5 | "devDependencies": { 6 | "copy-webpack-plugin": "4.6.0", 7 | "webpack": "4.29.6", 8 | "webpack-cli": "3.3.0", 9 | "webpack-dev-server": "3.2.1" 10 | }, 11 | "dependencies": {}, 12 | "scripts": { 13 | "build": "npm run copy-sources && npm run copy-assets && liferay-npm-bundler", 14 | "copy-assets": "lnbs-copy-assets", 15 | "deploy": "npm run build && lnbs-deploy", 16 | "start": "lnbs-start", 17 | "copy-sources": "lnbs-copy-sources" 18 | }, 19 | "portlet": { 20 | "com.liferay.portlet.display-category": "JS Toolkit QA", 21 | "com.liferay.portlet.header-portlet-css": "/css/styles.css", 22 | "com.liferay.portlet.instanceable": true, 23 | "javax.portlet.name": "loaders", 24 | "javax.portlet.security-role-ref": "power-user,user", 25 | "javax.portlet.display-name": "Loaders" 26 | }, 27 | "main": "index.js" 28 | } -------------------------------------------------------------------------------- /scripts/util/get-dep-versions.js: -------------------------------------------------------------------------------- 1 | /** 2 | * © 2017 Liferay, Inc. 3 | * 4 | * SPDX-License-Identifier: LGPL-3.0-or-later 5 | */ 6 | 7 | const fs = require('fs'); 8 | const globby = require('globby'); 9 | 10 | function getDepVersions() { 11 | const filePaths = globby.sync(['packages/*/package.json']); 12 | 13 | const pkgJsons = filePaths.map(filePath => 14 | JSON.parse(fs.readFileSync(filePath)) 15 | ); 16 | 17 | const depVersions = {}; 18 | 19 | pkgJsons.forEach(pkgJson => { 20 | ['dependencies', 'devDependencies'].forEach(scope => { 21 | Object.entries(pkgJson[scope] || {}).forEach(([dep, version]) => { 22 | const versions = depVersions[dep] || {}; 23 | 24 | versions[version] = versions[version] || []; 25 | 26 | versions[version].push(pkgJson.name); 27 | 28 | depVersions[dep] = versions; 29 | }); 30 | }); 31 | }); 32 | 33 | return depVersions; 34 | } 35 | 36 | module.exports = getDepVersions; 37 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-style-loader/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | /** 7 | * @param {object} context loader's context 8 | * @return {string} the processed file content 9 | */ 10 | export default function(context) { 11 | const {filePath, log} = context; 12 | let {content} = context; 13 | 14 | content = content.replace(/\\/g, '\\\\'); 15 | content = content.replace(/\r/g, '\\n'); 16 | content = content.replace(/\n/g, '\\n'); 17 | content = content.replace(/"/g, '\\"'); 18 | 19 | context.extraArtifacts[`${filePath}.js`] = ` 20 | var css = "${content}"; 21 | var style = document.createElement("style"); 22 | style.setAttribute("type", "text/css"); 23 | style.appendChild(document.createTextNode(css)); 24 | document.querySelector("head").appendChild(style); 25 | `; 26 | 27 | log.info('style-loader', `Generated JavaScript CSS module`); 28 | } 29 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-preset-angular-cli/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bundler-preset-angular-cli 2 | 3 | > Liferay NPM Bundler preset for [Angular CLI](https://cli.angular.io/) adapted 4 | > projects. 5 | 6 | ## Install 7 | 8 | ```sh 9 | npm install --save-dev liferay-npm-bundler-preset-angular-cli 10 | ``` 11 | 12 | ## Usage 13 | 14 | Add the following to your `.npmbundlerrc` file: 15 | 16 | ```json 17 | { 18 | "preset": "liferay-npm-bundler-preset-angular-cli" 19 | } 20 | ``` 21 | 22 | ## Technical Details 23 | 24 | This preset takes care of projects created with the 25 | [Angular CLI](https://cli.angular.io/) tool so that they can be correctly 26 | bundled and deployed to Liferay DXP or Liferay Portal CE. 27 | 28 | > 👀 Note that portlets processed by this preset MUST NOT be instanceable 29 | > because of the way Angular bootstraps its applications. Also note that you 30 | > MUST NOT place more than one Angular CLI adapted portlet into the same page 31 | > for the very same reason. 32 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/src/jar/__tests__/__fixtures__/preferences.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "a-number": { 4 | "type": "number", 5 | "name": "A number", 6 | "description": "A regular number", 7 | "default": "43" 8 | }, 9 | "a-float": { 10 | "type": "float", 11 | "name": "A float", 12 | "required": true, 13 | "description": "A floating point number", 14 | "default": "1.2" 15 | }, 16 | "a-string": { 17 | "type": "string", 18 | "name": "A string", 19 | "description": "A regular string", 20 | "default": "To be or not to be..." 21 | }, 22 | "a-boolean": { 23 | "type": "boolean", 24 | "name": "A boolean", 25 | "description": "A true|false value" 26 | }, 27 | "fruit": { 28 | "name": "Favorite fruit", 29 | "description": "Choose the fruit you like the most", 30 | "default": "orange", 31 | "options": { 32 | "orange": "An orange", 33 | "pear": "A pear", 34 | "apple": "An apple" 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/__tests__/__snapshots__/imports.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`normalizeImportsConfig() works for empty string format normalization 1`] = ` 4 | Object { 5 | "": Object { 6 | "depA": "3.0.0", 7 | "depB": "4.0.0", 8 | }, 9 | "depB": Object { 10 | "depC": "5.0.0", 11 | }, 12 | "provider1": Object { 13 | "dep1": "^1.0.0", 14 | "dep2": "^2.0.0", 15 | }, 16 | "provider2": Object { 17 | "dep8": "^8.0.0", 18 | "dep9": "^9.0.0", 19 | }, 20 | } 21 | `; 22 | 23 | exports[`normalizeImportsConfig() works for slash format normalization 1`] = ` 24 | Object { 25 | "depA": Object { 26 | "/": "3.0.0", 27 | }, 28 | "depB": Object { 29 | "/": "4.0.0", 30 | "depC": "5.0.0", 31 | }, 32 | "provider1": Object { 33 | "dep1": "^1.0.0", 34 | "dep2": "^2.0.0", 35 | }, 36 | "provider2": Object { 37 | "dep8": "^8.0.0", 38 | "dep9": "^9.0.0", 39 | }, 40 | } 41 | `; 42 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-shared-bundle/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import Generator from 'yeoman-generator'; 7 | 8 | /** 9 | * Generator for shared bundles. 10 | */ 11 | export default class extends Generator { 12 | /** 13 | * Standard Yeoman initialization function 14 | */ 15 | initializing() { 16 | this.composeWith(require.resolve('../facet-project')); 17 | this.composeWith(require.resolve('../facet-localization')); 18 | this.composeWith(require.resolve('../facet-deploy')); 19 | this.composeWith(require.resolve('./shared-bundle')); 20 | } 21 | 22 | /** 23 | * Standard Yeoman dependencies installation function 24 | */ 25 | install() { 26 | this.installDependencies({ 27 | bower: false, 28 | skipMessage: this.options['skip-install-message'], 29 | skipInstall: this.options['skip-install'], 30 | }); 31 | } 32 | } 33 | 34 | module.exports = exports['default']; 35 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/src/loader/__tests__/util.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * © 2017 Liferay, Inc. 3 | * 4 | * SPDX-License-Identifier: LGPL-3.0-or-later 5 | */ 6 | 7 | import {removeWebpackHash} from '../util'; 8 | 9 | describe('removeWebpackHash', () => { 10 | it('works when hash is the first part', () => { 11 | expect(removeWebpackHash('4d4306b3.file.js')).toBe('file.js'); 12 | }); 13 | 14 | it('works when hash is a middle part', () => { 15 | expect(removeWebpackHash('this.is.a.4d4306b3.file.js')).toBe( 16 | 'this.is.a.file.js' 17 | ); 18 | }); 19 | 20 | it('works when hash is the last part before the extension', () => { 21 | expect(removeWebpackHash('a.file.4d4306b3.js')).toBe('a.file.js'); 22 | }); 23 | 24 | it('works when hash is the very last part', () => { 25 | expect(removeWebpackHash('a.file.4d4306b3')).toBe('a.file'); 26 | }); 27 | 28 | it('removes just the last hash', () => { 29 | expect(removeWebpackHash('a.fabada.4d4306b3.js')).toBe('a.fabada.js'); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/bin/liferay-npm-bundler.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | const {argv} = require('yargs') 3 | .option('config', { 4 | alias: 'c', 5 | type: 'string', 6 | description: 7 | 'Specify path to config file to use (instead of .npmbundlerrc)', 8 | }) 9 | .option('create-jar', { 10 | alias: 'j', 11 | type: 'boolean', 12 | description: 13 | 'Create a JAR file as output (as opposed to an exploded directory)', 14 | }) 15 | .option('dump-report', { 16 | alias: 'r', 17 | type: 'boolean', 18 | description: 19 | 'Dump report HTML file with detailed information about the bundling process', 20 | }) 21 | .option('version', { 22 | alias: 'v', 23 | type: 'boolean', 24 | description: 'Show version number and exit', 25 | }) 26 | .help(); 27 | 28 | // This assignment must be done before any other project module loads, otherwise 29 | // it may get an incorrect project object. 30 | require('liferay-npm-build-tools-common/lib/project').default.argv = argv; 31 | 32 | require('../lib/index').default(argv); 33 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/src/resources/build/vue-cli/index.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has been generated by the liferay-js:adapt Yeoman generator. It is 3 | * the main entry point of the adapted portlet and its responsibility is to load 4 | * and bootstrap the Vue application in a way that fits Liferay portlet 5 | * architecture. 6 | * 7 | * This file should be deleted after each `npm run build:liferay` but it isn't 8 | * you may delete it safely as it will be recreated and deleted on the next 9 | * build. 10 | */ 11 | 12 | // Require webpack bundles generated by Vue CLI build 13 | var chunkVendors = require("./js/chunk-vendors.js"); 14 | var app = require("./js/app.js"); 15 | 16 | // Require our adapt runtime support module 17 | var _ADAPT_RT_ = require("./adapt-rt"); 18 | 19 | // Invoke main module passing Liferay's standard entry point arguments 20 | module.exports = function(_LIFERAY_PARAMS_) { 21 | // Load one time resources 22 | chunkVendors(); 23 | 24 | // Call main 25 | app(_LIFERAY_PARAMS_, _ADAPT_RT_); 26 | }; -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-resolve-linked-dependencies/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import path from 'path'; 7 | import readJsonSync from 'read-json-sync'; 8 | import semver from 'semver'; 9 | 10 | /** 11 | * @return {void} 12 | */ 13 | export default function({log}, {pkgJson}) { 14 | if (pkgJson.dependencies != null) { 15 | Object.keys(pkgJson.dependencies).forEach(name => { 16 | const link = pkgJson.dependencies[name]; 17 | 18 | if (semver.validRange(link) == null) { 19 | const depPkgJsonPath = path.join( 20 | 'node_modules', 21 | name, 22 | 'package.json' 23 | ); 24 | 25 | const depPkgJson = readJsonSync(depPkgJsonPath); 26 | 27 | pkgJson.dependencies[name] = depPkgJson.version; 28 | 29 | log.info( 30 | 'resolve-linked-dependencies', 31 | 'Resolved link', 32 | link, 33 | 'to', 34 | depPkgJson.version 35 | ); 36 | } 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-react-portlet/templates/src/index.js.ejs: -------------------------------------------------------------------------------- 1 | <% if (sampleWanted) { %> 2 | import React from 'react'; 3 | import ReactDOM from 'react-dom'; 4 | 5 | import AppComponent from './AppComponent'; 6 | <% } %> 7 | 8 | /** 9 | * This is the main entry point of the portlet. 10 | * 11 | * See https://tinyurl.com/js-ext-portlet-entry-point for the most recent 12 | * information on the signature of this function. 13 | * 14 | * @param {Object} params a hash with values of interest to the portlet 15 | * @return {void} 16 | */ 17 | export default function main({<%- signature %>}) { 18 | <% if (sampleWanted) { %> 19 | ReactDOM.render( 20 | 25 | configuration={configuration} 26 | <% } %> 27 | />, 28 | document.getElementById(portletElementId) 29 | ); 30 | <% } %> 31 | } -------------------------------------------------------------------------------- /packages/generator-liferay-js/src/target-react-portlet/templates/src/AppComponent.js.ejs: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | 4 | export default class extends React.Component { 5 | render() { 6 | return ( 7 |
8 |
9 | <%- labels.portletNamespace %>: 10 | {this.props.portletNamespace} 11 |
12 |
13 | <%- labels.contextPath %>: 14 | {this.props.contextPath} 15 |
16 |
17 | <%- labels.portletElementId %>: 18 | {this.props.portletElementId} 19 |
20 | <% if (hasConfiguration) { %> 21 |
22 | <%- labels.configuration %>: 23 | {JSON.stringify(this.props.configuration, null, 2)} 24 |
25 | <% } %> 26 |
27 | ); 28 | } 29 | } -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-namespace-packages/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: © 2017 Liferay, Inc. 3 | * SPDX-License-Identifier: LGPL-3.0-or-later 4 | */ 5 | 6 | import * as ns from 'liferay-npm-build-tools-common/lib/namespace'; 7 | 8 | /** 9 | * @return {void} 10 | */ 11 | export default function({log, pkg, rootPkgJson}, {pkgJson}) { 12 | if (!pkg.isRoot) { 13 | pkgJson.name = ns.addNamespace(pkgJson.name, rootPkgJson); 14 | 15 | log.info('namespace-packages', 'Namespaced package'); 16 | } 17 | 18 | pkgJson.dependencies = pkgJson.dependencies || {}; 19 | 20 | Object.keys(pkgJson.dependencies).forEach(pkgName => { 21 | const namespacedPkgName = ns.addNamespace(pkgName, rootPkgJson); 22 | const version = pkgJson.dependencies[pkgName]; 23 | 24 | pkgJson.dependencies[namespacedPkgName] = version; 25 | 26 | delete pkgJson.dependencies[pkgName]; 27 | }); 28 | 29 | log.info( 30 | 'namespace-packages', 31 | 'Namespaced', 32 | Object.keys(pkgJson.dependencies).length, 33 | 'dependencies' 34 | ); 35 | } 36 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/project/__tests__/__fixtures__/project/standard/.npmbundlerrc: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "imports": { 4 | "an-osgi-module": { 5 | "d3": ">=3.0.0", 6 | "react": ">=16.8.5" 7 | }, 8 | "frontend-js-node-shims": { 9 | "assert": ">=1.2.0", 10 | "punycode": ">=1.3.1", 11 | "setimmediate": ">=1.0.0" 12 | }, 13 | "frontend-js-web": { 14 | "/": ">=8.0.0" 15 | } 16 | } 17 | }, 18 | "create-jar": { 19 | "output-dir": "dist", 20 | "output-filename": "output.jar", 21 | "customManifestHeaders": { 22 | "Project-Name": "Overriden in manifest.json", 23 | "Responsible": "john.doe@somewhere.net" 24 | }, 25 | "features": { 26 | "localization": "features/localization/Language", 27 | "manifest": "features/manifest.json", 28 | "web-context": "/standard" 29 | } 30 | }, 31 | "exclude": { 32 | "*": ["__tests__/**/*"], 33 | "is-object": ["test/**/*"], 34 | "is-array@1.0.1": ["test/**/*", "Makefile"], 35 | "is-false": false, 36 | "is-true": true 37 | }, 38 | "max-parallel-files": 32 39 | } 40 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-plugin-namespace-packages/src/__tests__/__snapshots__/index.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`logs results correctly 1`] = ` 4 | Array [ 5 | Object { 6 | "level": "info", 7 | "source": "namespace-packages", 8 | "things": Array [ 9 | "Namespaced package", 10 | ], 11 | }, 12 | Object { 13 | "level": "info", 14 | "source": "namespace-packages", 15 | "things": Array [ 16 | "Namespaced", 17 | 1, 18 | "dependencies", 19 | ], 20 | }, 21 | ] 22 | `; 23 | 24 | exports[`namespaces packages correctly for non-root package 1`] = ` 25 | Object { 26 | "dependencies": Object { 27 | "project2$number-is-nan": "1.0.0", 28 | }, 29 | "name": "project2$is-finite", 30 | "version": "1.0.0", 31 | } 32 | `; 33 | 34 | exports[`namespaces packages correctly for the root package 1`] = ` 35 | Object { 36 | "dependencies": Object { 37 | "project2$is-finite": "1.0.0", 38 | "project2$isobject": "1.0.0", 39 | }, 40 | "name": "project2", 41 | "version": "1.0.0", 42 | } 43 | `; 44 | -------------------------------------------------------------------------------- /packages/babel-plugin-wrap-modules-amd/README.md: -------------------------------------------------------------------------------- 1 | # babel-plugin-wrap-modules-amd 2 | 3 | > Wrap modules inside an AMD `define()` module. 4 | 5 | ## Example 6 | 7 | **In** 8 | 9 | ```javascript 10 | var console = require('console'); 11 | console.info('Say something'); 12 | ``` 13 | 14 | **Out** 15 | 16 | ```javascript 17 | define(['module', 'exports', 'require', 'console'], function( 18 | module, 19 | exports, 20 | require 21 | ) { 22 | var console = require('console'); 23 | console.log('Say something'); 24 | }); 25 | ``` 26 | 27 | ## Installation 28 | 29 | ```sh 30 | npm install --save-dev babel-plugin-wrap-modules-amd 31 | ``` 32 | 33 | ## Usage 34 | 35 | Add the following to your `.babelrc` file: 36 | 37 | ```json 38 | { 39 | "plugins": ["wrap-modules-amd"] 40 | } 41 | ``` 42 | 43 | ## Technical Details 44 | 45 | This plugin wraps the code inside the module with an AMD `define()` call. The 46 | module is not given any name and any dependencies detected by inspecting 47 | `require()` calls are appended to the `define()` dependencies array so that they 48 | can be found when `require()` is called. 49 | -------------------------------------------------------------------------------- /qa/samples/packages/alias-test/src/index.js: -------------------------------------------------------------------------------- 1 | console.log(`8< --------`); 2 | 3 | console.log(` 4 | require('./cartesian-product');`); 5 | console.group(); 6 | require('./cartesian-product')(); 7 | console.groupEnd(); 8 | 9 | console.log(` 10 | require('./collision-pkg-file');`); 11 | console.group(); 12 | require('./collision-pkg-file')(); 13 | console.groupEnd(); 14 | 15 | console.log(` 16 | require('./external-path-modules');`); 17 | console.group(); 18 | require('./external-path-modules')(); 19 | console.groupEnd(); 20 | 21 | console.log(` 22 | require('./ignore');`); 23 | console.group(); 24 | require('./ignore')(); 25 | console.groupEnd(); 26 | 27 | console.log(` 28 | require('./inner-override');`); 29 | console.group(); 30 | require('./inner-override')(); 31 | console.groupEnd(); 32 | 33 | console.log(` 34 | require('./outside-precedence');`); 35 | console.group(); 36 | require('./outside-precedence')(); 37 | console.groupEnd(); 38 | 39 | console.log(` 40 | require('./parent-package');`); 41 | console.group(); 42 | require('./parent-package')(); 43 | console.groupEnd(); 44 | 45 | console.log(`-------- >8`); 46 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-tools-common/src/globs.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * © 2017 Liferay, Inc. 3 | * 4 | * SPDX-License-Identifier: LGPL-3.0-or-later 5 | */ 6 | 7 | /** 8 | * Return negated glob or list of glob expressions. 9 | * @param globs list of globs or single glob expression 10 | * @return negated list of globs or single glob expression 11 | */ 12 | export function negate(globs: T): T { 13 | const negate = (glob: string) => 14 | glob[0] === '!' ? glob.substring(1) : `!${glob}`; 15 | 16 | if (Array.isArray(globs)) { 17 | return globs.map(negate) as T; 18 | } else { 19 | return negate(globs as string) as T; 20 | } 21 | } 22 | 23 | /** 24 | * Return a list of globs prefixed with a token. 25 | * @param prefix the prefix to add 26 | * @param globs list of globs 27 | * @return the list of prefixed globs 28 | */ 29 | export function prefix(prefix: string, globs: string[]): string[] { 30 | return globs.map(glob => { 31 | if (glob[0] === '!') { 32 | return `!${prefix}${glob.substring(1)}`; 33 | } else { 34 | return `${prefix}${glob}`; 35 | } 36 | }); 37 | } 38 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-bundler", 3 | "version": "2.19.3", 4 | "description": "A CLI utility to bundle NPM dependencies of a Liferay OSGi bundle.", 5 | "main": "lib/index.js", 6 | "bin": { 7 | "liferay-npm-bundler": "bin/liferay-npm-bundler.js" 8 | }, 9 | "scripts": { 10 | "copyfiles": "node ../../scripts/copyfiles.js", 11 | "build": "tsc && yarn copyfiles", 12 | "prepublish": "yarn build" 13 | }, 14 | "devDependencies": { 15 | "liferay-npm-bundler-preset-liferay-dev": "1.12.0" 16 | }, 17 | "dependencies": { 18 | "babel-core": "^6.26.3", 19 | "clone": "^2.1.2", 20 | "data-urls": "^1.1.0", 21 | "dot-prop": "^5.0.1", 22 | "fs-extra": "^8.1.0", 23 | "globby": "^10.0.1", 24 | "insight": "0.10.3", 25 | "jszip": "^3.1.5", 26 | "liferay-npm-build-tools-common": "2.19.3", 27 | "liferay-npm-bundler-preset-standard": "2.19.3", 28 | "merge": "^1.2.1", 29 | "pretty-time": "^1.1.0", 30 | "read-json-sync": "^2.0.1", 31 | "resolve": "^1.8.1", 32 | "rimraf": "^3.0.0", 33 | "semver": "^6.3.0", 34 | "xml-js": "^1.6.8", 35 | "yargs": "^14.0.0" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "liferay-npm-build-support", 3 | "version": "2.19.3", 4 | "description": "A library of scripts and helpers used by generated projects in their build processes.", 5 | "bin": { 6 | "lnbs-build": "bin/lnbs-build.js", 7 | "lnbs-copy-assets": "bin/lnbs-copy-assets.js", 8 | "lnbs-copy-sources": "bin/lnbs-copy-sources.js", 9 | "lnbs-deploy": "bin/lnbs-deploy.js", 10 | "lnbs-start": "bin/lnbs-start.js", 11 | "lnbs-translate": "bin/lnbs-translate.js" 12 | }, 13 | "scripts": { 14 | "copyfiles": "node ../../scripts/copyfiles.js", 15 | "build": "tsc && yarn copyfiles", 16 | "prepublish": "yarn build" 17 | }, 18 | "dependencies": { 19 | "@babel/core": "^7.0.0", 20 | "babel-template": "^6.26.0", 21 | "cpr": "^3.0.1", 22 | "cross-spawn": "^7.0.0", 23 | "dot-prop": "^5.0.1", 24 | "ejs": "^2.6.1", 25 | "fs-extra": "^8.1.0", 26 | "globby": "^10.0.1", 27 | "liferay-npm-build-tools-common": "2.19.3", 28 | "properties": "^1.2.1", 29 | "read-json-sync": "^2.0.1", 30 | "request": "^2.88.0", 31 | "resolve": "^1.8.1", 32 | "uuid": "^3.3.2" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/src/resources/build/create-react-app/index.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has been generated by the liferay-js:adapt Yeoman generator. It is 3 | * the main entry point of the adapted portlet and its responsibility is to load 4 | * and bootstrap the React application in a way that fits Liferay portlet 5 | * architecture. 6 | * 7 | * This file should be deleted after each `npm run build:liferay` but it isn't 8 | * you may delete it safely as it will be recreated and deleted on the next 9 | * build. 10 | */ 11 | 12 | // Require webpack bundles generated by create-react-app build. 13 | var runtime = require("./static/js/runtime-main.js"); 14 | var two = require("./static/js/2.chunk.js"); 15 | var main = require("./static/js/main.chunk.js"); 16 | 17 | // Require our adapt runtime support module 18 | var _ADAPT_RT_ = require("./adapt-rt"); 19 | 20 | // Invoke main module passing Liferay's standard entry point arguments. 21 | module.exports = function(_LIFERAY_PARAMS_) { 22 | // Load React and runtime engine modules. 23 | runtime(); 24 | two(); 25 | 26 | // Call main 27 | main(_LIFERAY_PARAMS_, _ADAPT_RT_); 28 | }; -------------------------------------------------------------------------------- /packages/babel-plugin-namespace-amd-define/README.md: -------------------------------------------------------------------------------- 1 | # babel-plugin-namespace-amd-define 2 | 3 | > Add a prefix to AMD `define()` calls. 4 | 5 | ## Example 6 | 7 | **In** 8 | 9 | ```javascript 10 | define([], function() {}); 11 | ``` 12 | 13 | **Out** 14 | 15 | ```javascript 16 | Liferay.Loader.define([], function() {}); 17 | ``` 18 | 19 | ## Installation 20 | 21 | ```sh 22 | npm install --save-dev babel-plugin-namespace-amd-define 23 | ``` 24 | 25 | ## Usage 26 | 27 | Add the following to your `.babelrc` file: 28 | 29 | **Without options:** 30 | 31 | ```json 32 | { 33 | "plugins": ["namespace-amd-define"] 34 | } 35 | ``` 36 | 37 | **With options:** 38 | 39 | ```json 40 | { 41 | "plugins": [ 42 | [ 43 | "namespace-amd-define", 44 | { 45 | "namespace": "window.MyProject.Loader" 46 | } 47 | ] 48 | ] 49 | } 50 | ``` 51 | 52 | ## Technical Details and Options 53 | 54 | This module adds a prefix to any AMD `define()` call that it finds. The prefix 55 | is specified with the `namespace` option and a period is inserted between the 56 | namespace string and the `define()` call. 57 | 58 | By default, the `namespace` option is set to `Liferay.Loader`. 59 | -------------------------------------------------------------------------------- /packages/liferay-npm-build-support/src/loader/remove-webpack-hash.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * © 2017 Liferay, Inc. 3 | * 4 | * SPDX-License-Identifier: LGPL-3.0-or-later 5 | */ 6 | 7 | import { 8 | BundlerLoaderContext, 9 | BundlerLoaderReturn, 10 | } from 'liferay-npm-build-tools-common/lib/api/loaders'; 11 | 12 | import {removeWebpackHash} from './util'; 13 | 14 | /** 15 | * A loader that removes webpack hashes from filenames. 16 | * 17 | * @remarks 18 | * A webpack hash is defined as the rightmost hex number surrounded by dots in a 19 | * file name. 20 | */ 21 | export default function(context: BundlerLoaderContext): BundlerLoaderReturn { 22 | const {content, filePath, extraArtifacts, log} = context; 23 | 24 | const newFilePath = removeWebpackHash(filePath); 25 | 26 | if (newFilePath === filePath) { 27 | log.info( 28 | 'remove-webpack-hash', 29 | `No webpack hash in filename; nothing to be done` 30 | ); 31 | 32 | return; 33 | } 34 | 35 | extraArtifacts[newFilePath] = content; 36 | context.content = undefined; 37 | 38 | log.info('remove-webpack-hash', `Diverting file output to ${newFilePath}`); 39 | 40 | return undefined; 41 | } 42 | -------------------------------------------------------------------------------- /packages/liferay-npm-bundler-loader-sass-loader/README.md: -------------------------------------------------------------------------------- 1 | # liferay-npm-bundler-loader-sass-loader 2 | 3 | > A liferay-npm-bundler loader that runs `sass` or `node-sass` on source files. 4 | > This loader changes the file extension from anything used in source (for 5 | > example `.scss` or `.sass`) to `.css` in the output folder, so that it can be 6 | > served correctly to browsers. 7 | 8 | ## Installation 9 | 10 | ```sh 11 | npm install --save-dev liferay-npm-bundler-loader-sass-loader 12 | ``` 13 | 14 | ## Usage 15 | 16 | In order to use this loader you must declare a rule in your module's `.npmbundlerrc` file: 17 | 18 | ```json 19 | { 20 | "rules": [ 21 | { 22 | "test": "\\.scss$", 23 | "exclude": "node_modules", 24 | "use": ["sass-loader"] 25 | } 26 | ] 27 | } 28 | ``` 29 | 30 | This loader tries to find `node-sass` in your project by default. If it is not 31 | there, it then looks for `sass` (in your project, too) and, if that fails again, 32 | it will use a bundled copy of `sass` that is provided with the loader. 33 | 34 | See the project's wiki for more information on 35 | [how to use build rules](https://github.com/liferay/liferay-js-toolkit/wiki/How-to-use-build-rules). 36 | --------------------------------------------------------------------------------