代码拉取完成,页面将自动刷新
同步操作将从 Gitee 极速下载/Photo Sphere Viewer 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import alias from '@rollup/plugin-alias';
import inject from '@rollup/plugin-inject';
import replace from '@rollup/plugin-replace';
import fs from 'fs';
import path from 'path';
import babel from 'rollup-plugin-babel';
import localResolve from 'rollup-plugin-local-resolve';
import postcss from 'rollup-plugin-postcss'
import { string } from 'rollup-plugin-string';
import pkg from './package.json';
const plugins = fs.readdirSync(path.join(__dirname, 'src/plugins'))
.filter(p => p !== 'AbstractPlugin.js');
const banner = `/*!
* Photo Sphere Viewer ${pkg.version}
* @copyright 2014-2015 Jérémy Heleine
* @copyright 2015-${new Date().getFullYear()} Damien "Mistic" Sorel
* @licence MIT (https://opensource.org/licenses/MIT)
*/`;
const cssBanner = `Photo Sphere Viewer ${pkg.version}
@copyright 2014-2015 Jérémy Heleine
@copyright 2015-${new Date().getFullYear()} Damien "Mistic" Sorel
@licence MIT (https://opensource.org/licenses/MIT)`;
function camelize(str) {
return str
.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, m => m.toUpperCase())
.replace(/(?:\W|_)/g, '');
}
const baseConfig = {
output : {
format : 'umd',
sourcemap: true,
banner : banner,
globals : {
'three' : 'THREE',
'uevent': 'uEvent',
},
},
external: [
'three',
'uevent',
],
// wrapped in a function to ensure unique plugin instances for each entry-point
// https://github.com/egoist/rollup-plugin-postcss/issues/158
plugins : () => [
localResolve(),
babel({
exclude: 'node_modules/**',
}),
postcss({
extract : true,
sourceMap: true,
plugins : [
require('@csstools/postcss-sass')({}),
require('autoprefixer')({}),
require('postcss-banner')({
banner : cssBanner,
important: true,
}),
],
}),
string({
include: [
'src/**/*.svg',
],
}),
],
};
const secondaryConfig = {
...baseConfig,
output : {
...baseConfig.output,
globals: {
...baseConfig.output.globals,
'photo-sphere-viewer': 'PhotoSphereViewer',
...plugins.reduce((globals, p) => {
globals[`photo-sphere-viewer/dist/plugins/${p}`] = `PhotoSphereViewer.${camelize(p)}Plugin`;
return globals;
}, {}),
},
},
external: [
...baseConfig.external,
'photo-sphere-viewer',
...plugins.map(p => `photo-sphere-viewer/dist/plugins/${p}`),
],
plugins: () => [
...baseConfig.plugins(),
alias({
'photo-sphere-viewer': './src',
...plugins.reduce((alias, p) => {
alias[`photo-sphere-viewer/dist/plugins/${p}`] = `./src/plugins/${p}`;
return alias;
}, {}),
}),
inject({
include: 'three-examples/**',
modules: {
THREE: 'three',
},
}),
replace({
// configuration to embed the examples files in PSV source
delimiters : ['', ''],
[`from 'three/examples/jsm`] : `from '../../../three-examples`,
[`from "../../../build/three.module.js"`]: `from "three"`,
}),
],
};
export default [
{
...baseConfig,
input : 'src/index.js',
output : {
...baseConfig.output,
file: 'dist/photo-sphere-viewer.js',
name: 'PhotoSphereViewer',
},
plugins: baseConfig.plugins(),
},
{
...secondaryConfig,
input : 'src/ViewerCompat',
output : {
...secondaryConfig.output,
file: 'dist/viewer-compat.js',
name: 'PhotoSphereViewer.ViewerCompat',
},
plugins: secondaryConfig.plugins(),
},
].concat(
plugins.map(p => ({
...secondaryConfig,
input : `src/plugins/${p}/index.js`,
output : {
...secondaryConfig.output,
file: `dist/plugins/${p}.js`,
name: `PhotoSphereViewer.${camelize(p)}Plugin`,
},
plugins: secondaryConfig.plugins(),
}))
);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。