diff --git a/apps/files_sharing/.babelrc.js b/apps/files_sharing/.babelrc.js new file mode 100644 index 0000000000..137b266162 --- /dev/null +++ b/apps/files_sharing/.babelrc.js @@ -0,0 +1,13 @@ +module.exports = { + presets: [ + [ + '@babel/preset-env', + { + targets: { + browsers: ['last 2 versions', 'ie >= 11'] + } + } + ] + ], + plugins: ['@babel/plugin-syntax-dynamic-import'] +} diff --git a/apps/files_sharing/list.php b/apps/files_sharing/list.php index 9eed10f8d2..1866c73b68 100644 --- a/apps/files_sharing/list.php +++ b/apps/files_sharing/list.php @@ -32,7 +32,6 @@ $tmpl = new OCP\Template('files_sharing', 'list', ''); // gridview not available for ie $tmpl->assign('showgridview', $showgridview && !$isIE); -OCP\Util::addScript('files_sharing', 'app'); -OCP\Util::addScript('files_sharing', 'sharedfilelist'); +OCP\Util::addScript('files_sharing', 'dist/files_sharing'); $tmpl->printPage(); diff --git a/apps/files_sharing/package.json b/apps/files_sharing/package.json new file mode 100644 index 0000000000..9aa194cbae --- /dev/null +++ b/apps/files_sharing/package.json @@ -0,0 +1,35 @@ +{ + "name": "files_sharing", + "version": "1.0.0", + "description": "File sharing in Nextcloud", + "main": "files_sharing.js", + "directories": { + "lib": "lib", + "test": "tests" + }, + "scripts": { + "build": "webpack --progress --hide-modules --config webpack.prod.js", + "dev": "webpack --progress --watch --config webpack.dev.js", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "AGPL-3.0-or-later", + "dependencies": { + "nextcloud-axios": "^0.1.3", + "nextcloud-vue": "^0.5.0", + "vue": "^2.5.17" + }, + "devDependencies": { + "@babel/core": "^7.1.0", + "@babel/plugin-syntax-dynamic-import": "^7.2.0", + "babel-loader": "^8.0.2", + "css-loader": "^2.1.0", + "node-sass": "^4.11.0", + "sass-loader": "^7.1.0", + "vue-loader": "^15.4.2", + "vue-template-compiler": "^2.5.17", + "webpack": "^4.20.0", + "webpack-cli": "^3.1.1", + "webpack-merge": "^4.1.4" + } +} diff --git a/apps/files_sharing/src/files_sharing.js b/apps/files_sharing/src/files_sharing.js new file mode 100644 index 0000000000..c31c8c6e20 --- /dev/null +++ b/apps/files_sharing/src/files_sharing.js @@ -0,0 +1,16 @@ +// CSP config for webpack dynamic chunk loading +// eslint-disable-next-line +__webpack_nonce__ = btoa(OC.requestToken) + +// Correct the root of the app for chunk loading +// OC.linkTo matches the apps folders +// eslint-disable-next-line +__webpack_public_path__ = OC.linkTo('files_sharing', 'js/dist/') + +import '../js/app' +import '../js/sharedfilelist' +import '../js/sharetabview' +import '../js/share' +import '../js/sharebreadcrumbview' + +window.OCA.Sharing = OCA.Sharing diff --git a/apps/files_sharing/src/sharetabview.js b/apps/files_sharing/src/sharetabview.js index 9b1176dbb9..4ac09ff9f7 100644 --- a/apps/files_sharing/src/sharetabview.js +++ b/apps/files_sharing/src/sharetabview.js @@ -14,6 +14,7 @@ var TEMPLATE = '