@clickview/online 0.81.0 → 0.82.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickview/online",
3
- "version": "0.81.0",
3
+ "version": "0.82.0-rc.0",
4
4
  "description": "Online",
5
5
  "main": "dist/online-app.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,8 +8,8 @@
8
8
  "scripts": {
9
9
  "start": "npm run build",
10
10
  "type-check": "tsc --noEmit",
11
- "build-app": "vite build --config vite.config.app.ts",
12
- "build-styles": "vite build --config vite.config.styles.ts",
11
+ "build-app": "node ../../../node_modules/vite-classic/bin/vite.js build --config vite.config.app.ts",
12
+ "build-styles": "node ../../../node_modules/vite/bin/vite.js build --config vite.config.styles.ts",
13
13
  "build": "npm run type-check && npm run build-app && npm run build-styles"
14
14
  },
15
15
  "repository": {
@@ -21,7 +21,8 @@
21
21
  "devDependencies": {
22
22
  "@types/linkifyjs": "2.1.3",
23
23
  "@types/react-transition-group": "4.2.3",
24
- "@types/yup": "0.26.24"
24
+ "@types/yup": "0.26.24",
25
+ "vite-classic": "npm:vite@7.3.3"
25
26
  },
26
27
  "dependencies": {
27
28
  "intersection-observer": "0.11.0",
@@ -1,6 +1,28 @@
1
- import config from '../../libs/tooling/vite/vite.base.config';
1
+ // IMPORTANT: This build deliberately uses classic Rollup-based Vite 7
2
+ // (aliased as `vite-classic` in package.json), not Vite 8 (Rolldown).
3
+ //
4
+ // Why: Rolldown's UMD output leaves bare `require("<external>")` calls inside
5
+ // its prebundled CommonJS module shims (`__commonJSMin`) instead of rewriting
6
+ // them to use the wrapper's factory parameters. The `online` bundle is loaded
7
+ // via a <script> tag in the legacy host, which doesn't provide a working
8
+ // `require`, so those bare calls blow up at runtime. Rollup handles UMD
9
+ // externals correctly — verified empirically. See the migration history if
10
+ // Rolldown ever gains proper UMD external rewriting; we can rejoin then.
11
+ //
12
+ // This config is intentionally self-contained (not extending the shared
13
+ // `vite.base.config.ts`) because the shared base imports from `vite` (=v8/
14
+ // Rolldown). Plugins are version-agnostic Rollup plugins and work fine on v7.
15
+ import inject from '@rollup/plugin-inject';
16
+ import react from '@vitejs/plugin-react';
17
+ import handlebarsPlugin from '@yoichiro/vite-plugin-handlebars';
18
+ import * as fs from 'fs';
19
+ import * as path from 'path';
20
+ import { defineConfig } from 'vite-classic';
21
+ import tsconfigPaths from 'vite-tsconfig-paths';
2
22
 
3
- const externalGlobals = {
23
+ import i18n from '../../libs/tooling/vite/vite-i18n-plugin';
24
+
25
+ const externalGlobals: Record<string, string> = {
4
26
  // Cropper
5
27
  'cropperjs': 'Cropper',
6
28
  'cropper': 'Cropper',
@@ -45,24 +67,81 @@ const externalGlobals = {
45
67
  'gapi': 'gapi'
46
68
  };
47
69
 
48
- export default config({
70
+ const sourcePaths = [
71
+ path.resolve(__dirname, '../../libs/common/src'),
72
+ path.resolve(__dirname, '../../libs/shared/src'),
73
+ path.resolve(__dirname, '../../projects/player/src'),
74
+ path.resolve(__dirname, './src')
75
+ ].map(p => p.replace(/\\/g, '/'));
76
+
77
+ export default defineConfig({
49
78
  root: __dirname,
50
- // Use a function for externals to ensure proper matching
51
- externals: id => Object.keys(externalGlobals).includes(id),
52
- globals: externalGlobals,
79
+ plugins: [
80
+ inject({ $: 'jquery' }) as any,
81
+ handlebarsPlugin() as any,
82
+ i18n(sourcePaths.map(p => `${p}/**/*.lang.json`)) as any,
83
+ react(),
84
+ tsconfigPaths(),
85
+ // The legacy host reads bundles.json to discover the entry filenames.
86
+ // In lib mode Vite's native manifest is disabled, so we emit it ourselves.
87
+ {
88
+ name: 'write-bundles-json',
89
+ apply: 'build' as const,
90
+ closeBundle() {
91
+ fs.writeFileSync(
92
+ path.resolve(__dirname, 'dist/online/bundles.json'),
93
+ JSON.stringify({ appBundle: 'online-app.js', cssBundle: 'online-app.css' }, null, '\t')
94
+ );
95
+ }
96
+ }
97
+ ],
53
98
 
54
- lib: {
55
- entry: './src/index.ts',
56
- name: '@clickview/online',
57
- formats: ['umd']
99
+ build: {
100
+ outDir: 'dist/online',
101
+ cssCodeSplit: false,
102
+ lib: {
103
+ entry: './src/index.ts',
104
+ name: '@clickview/online',
105
+ formats: ['umd']
106
+ },
107
+ rollupOptions: {
108
+ external: (id: string) => Object.keys(externalGlobals).includes(id),
109
+ output: {
110
+ entryFileNames: 'online-app.js',
111
+ chunkFileNames: 'scripts/[hash].chunk.js',
112
+ assetFileNames: assetInfo => {
113
+ if (assetInfo.name && assetInfo.name.endsWith('.css')) return 'online-app.css';
114
+ return 'assets/[name]-[hash].[ext]';
115
+ },
116
+ globals: externalGlobals
117
+ }
118
+ },
119
+ sourcemap: true,
120
+ chunkSizeWarningLimit: 1000
58
121
  },
59
122
 
60
- outDir: 'dist/online',
61
- outputScriptName: 'online-app.js',
62
- outputCssName: 'online-app.css',
123
+ css: {
124
+ preprocessorOptions: {
125
+ scss: {
126
+ additionalData: `@import "${path.resolve(__dirname, 'src/styles/theme/_variables.scss').replace(/\\/g, '/')}";`,
127
+ silenceDeprecations: [ 'import', 'global-builtin', 'color-functions', 'if-function' ]
128
+ }
129
+ }
130
+ },
63
131
 
64
132
  define: {
133
+ '__ENVIRONMENT__': JSON.stringify(process.env.NODE_ENV),
65
134
  'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV ?? 'development'),
66
- 'process.env': {}
135
+ 'global': 'globalThis'
136
+ },
137
+
138
+ resolve: {
139
+ extensions: [ '.ts', '.tsx', '.js' ],
140
+ alias: {
141
+ '~styles/globals': path.resolve(__dirname, '../../libs/styles/src/globals.scss'),
142
+ '~styles/core': path.resolve(__dirname, '../../libs/styles/src/core.scss'),
143
+ '~styles/utils': path.resolve(__dirname, '../../libs/styles/src/utils'),
144
+ '~styles/player': path.resolve(__dirname, '../../projects/player')
145
+ }
67
146
  }
68
147
  });
package/.eslintrc.cjs DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- 'rulesdir/require-view-title': 'off'
4
- }
5
- };
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=core-DfLwBfdK.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core-DfLwBfdK.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}