mirror of
https://github.com/pretix/pretix.git
synced 2026-08-09 10:37:50 +00:00
commit2177bebf6aMerge:ea613bf271d08216d8c5Author: Mira Weller <weller@rami.io> Date: Fri Aug 7 21:22:31 2026 +0200 Merge branch 'master' into questions-vue3 commitea613bf271Author: Mira Weller <weller@rami.io> Date: Fri Aug 7 21:21:35 2026 +0200 wip commitc8bed5e3b9Author: Mira Weller <weller@rami.io> Date: Fri Aug 7 10:15:00 2026 +0200 rename get_cart to get_cart_positions (keep old name alive) commit1ec27fff05Author: Mira Weller <weller@rami.io> Date: Fri Aug 7 10:01:38 2026 +0200 filter questionnaires by sales channel commit0294f205d0Author: Mira Weller <weller@rami.io> Date: Thu Aug 6 20:06:05 2026 +0200 refactor: extract build_requested_valid_from_field method commit3424aacdc3Author: Mira Weller <weller@rami.io> Date: Thu Aug 6 20:05:44 2026 +0200 rename presale question forms and mixins commit4012889076Author: Mira Weller <weller@rami.io> Date: Thu Aug 6 19:42:29 2026 +0200 rebase migration commitfe15d71cd2Merge:3ea7ea31b64d9dfa88feAuthor: Mira Weller <weller@rami.io> Date: Thu Aug 6 19:25:44 2026 +0200 Merge branch 'master' into questions-vue3 # Conflicts: # src/pretix/base/forms/questions.py # src/pretix/base/middleware.py # src/pretix/base/templates/pretixbase/redirect.html commit3ea7ea31b6Author: Mira Weller <weller@rami.io> Date: Fri Jul 24 17:37:46 2026 +0200 wip commit5b34a25fb5Author: Mira Weller <weller@rami.io> Date: Wed Jun 17 16:21:11 2026 +0200 use questionnaire data for rendering checkout questions step commit9467f1d08dAuthor: Mira Weller <weller@rami.io> Date: Wed Jun 17 15:54:14 2026 +0200 refactor: extract build_system_question_field method commit85344a7690Author: Mira Weller <weller@rami.io> Date: Wed Jun 17 15:50:41 2026 +0200 refactor: extract build_user_question_field method commit3b47f4aaa7Author: Mira Weller <weller@rami.io> Date: Wed Jun 17 15:49:34 2026 +0200 refactor: cartpos / orderpos commit0309b05121Author: Mira Weller <weller@rami.io> Date: Thu Mar 19 13:52:18 2026 +0100 vite config: allow cors access from pretix.work subdomains commitad092ae0d1Author: Mira Weller <weller@rami.io> Date: Wed Jun 17 12:35:33 2026 +0200 re-add vue-slicksort dep commit9f42d679ccAuthor: Mira Weller <weller@rami.io> Date: Wed Jun 17 12:28:53 2026 +0200 rebase migration commit9eae9c6de7Merge:84c51e031e694b915d89Author: Mira Weller <weller@rami.io> Date: Wed Jun 17 12:24:49 2026 +0200 Merge branch 'master' into questions-vue3 # Conflicts: # .github/workflows/tests.yml # .gitignore # Dockerfile # package-lock.json # package.json # src/pretix/base/management/commands/runserver.py # src/pretix/base/middleware.py # src/pretix/base/templatetags/vite.py # src/pretix/control/forms/global_settings.py # src/pretix/control/templates/pretixcontrol/checkin/list_edit.html # src/pretix/control/views/item.py # src/pretix/presale/views/widget.py # src/pretix/settings.py # src/pretix/static/pretixcontrol/js/ui/checkinrules/App.vue # src/pretix/static/pretixcontrol/js/ui/checkinrules/constants.ts # src/pretix/static/pretixcontrol/js/ui/checkinrules/django-interop.ts # src/pretix/static/pretixcontrol/js/ui/checkinrules/lookup-select2.vue # src/pretix/static/pretixcontrol/js/ui/checkinrules/timefield.vue # src/pretix/static/pretixcontrol/js/ui/checkinrules/viz-node.vue # src/pretix/static/pretixpresale/widget/index.html # src/pretix/static/pretixpresale/widget/src/api.ts # src/pretix/static/pretixpresale/widget/src/button.ts # src/pretix/static/pretixpresale/widget/src/components/PriceBox.vue # src/pretix/static/pretixpresale/widget/src/main.ts # src/pretix/static/pretixpresale/widget/src/sharedStore.ts # src/pretix/static/pretixpresale/widget/src/utils.ts # src/pretix/static/pretixpresale/widget/src/widget.ts # src/tests/e2e/conftest.py # vite.config.ts commit84c51e031eMerge:902ee9242e222b453b43Author: Mira Weller <weller@rami.io> Date: Wed Jun 17 12:20:05 2026 +0200 Merge branch 'master' into questions-vue3 commit902ee9242eAuthor: Mira Weller <weller@rami.io> Date: Wed Jun 17 12:19:26 2026 +0200 css comment commitb758efd4a9Author: Mira Weller <weller@rami.io> Date: Wed Jun 17 12:19:19 2026 +0200 question dependencies commitc68fe00502Author: Mira Weller <weller@rami.io> Date: Wed Jun 17 12:18:00 2026 +0200 add data field edit link commitb7da9bb6c1Author: Mira Weller <weller@rami.io> Date: Wed Jun 17 12:16:20 2026 +0200 handle hidden questions commit897120d3daAuthor: Mira Weller <weller@rami.io> Date: Tue May 12 13:04:08 2026 +0200 add ts model definitions commit09abc5725eAuthor: Mira Weller <weller@rami.io> Date: Tue May 12 11:30:12 2026 +0200 reorder and save commit9a7d5abb1fAuthor: Mira Weller <weller@rami.io> Date: Tue May 12 11:29:37 2026 +0200 fix unhandled exception in taxrules API commit3cee5f524bAuthor: Mira Weller <weller@rami.io> Date: Tue May 5 18:12:21 2026 +0200 use slicksort for reordering questionnaires and questions commit3a1a6b988eAuthor: Mira Weller <weller@rami.io> Date: Tue Apr 28 19:23:35 2026 +0200 improve i18n, implement "add text block" dialog commitbdc720f5a2Author: Mira Weller <weller@rami.io> Date: Fri Mar 27 18:57:22 2026 +0100 wip commit583184af38Author: Mira Weller <weller@rami.io> Date: Thu Mar 19 21:45:32 2026 +0100 change existing views commit63d9f7cea8Author: Mira Weller <weller@rami.io> Date: Thu Mar 19 21:45:32 2026 +0100 adapt vue app to new data model (wip) commitc3d6fb1bd6Author: Mira Weller <weller@rami.io> Date: Thu Mar 19 21:44:47 2026 +0100 add Questionnaire and QuestionnaireChild models and their API; migrate existing data commitbb43acd257Author: Mira Weller <weller@rami.io> Date: Thu Mar 19 13:52:28 2026 +0100 vite config: add questionnaires app commite0744951e8Author: Mira Weller <weller@rami.io> Date: Thu Mar 19 13:52:18 2026 +0100 vite config: allow cors access from pretix.work subdomains commitfef1e356f7Author: Mira Weller <weller@rami.io> Date: Thu Mar 19 13:33:24 2026 +0100 fix out-of-the-box experience commit81775f5d2dAuthor: Mira Weller <weller@rami.io> Date: Thu Mar 19 13:33:24 2026 +0100 setup questionnaires vue app, add code from question editor proof of concept commit4bbcc398ccMerge:a924d0a26658840a5fd6Author: Mira Weller <weller@rami.io> Date: Thu Mar 19 13:13:32 2026 +0100 Merge remote-tracking branch 'refs/remotes/origin/master' into questions-vue3
152 lines
5.1 KiB
TypeScript
152 lines
5.1 KiB
TypeScript
// vite build config for control UI
|
|
// widget has its own config, see src/pretix/static/pretixpresale/widget/vite.config.ts
|
|
import { defineConfig, type Plugin } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import path from 'path'
|
|
import { execSync } from 'child_process'
|
|
import { readFileSync } from 'fs'
|
|
import { parse as parseToml } from 'smol-toml'
|
|
|
|
// Shared dependencies exposed to plugins via import map.
|
|
// Adding a dep here auto-generates a _vendor/{name} entry and
|
|
// makes it available in the import map.
|
|
const SHARED_DEPS = ['vue']
|
|
|
|
const { entries: pretixPluginEntries } = discoverPretixPlugins()
|
|
const pluginDirs = [...new Set(Object.values(pretixPluginEntries).map(p => path.dirname(p)))]
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
sharedDepsPlugin(),
|
|
pretixPluginDevEntries(),
|
|
],
|
|
resolve: {
|
|
// Pin shared deps to pretix's node_modules to prevent duplicate instances
|
|
// across plugins whose node_modules live in sibling directories
|
|
dedupe: [...SHARED_DEPS, '@vue/runtime-core', '@vue/reactivity', '@vue/shared'],
|
|
},
|
|
server: {
|
|
fs: {
|
|
// Allow serving source files from sibling plugin directories
|
|
allow: ['src', ...pluginDirs],
|
|
},
|
|
cors: { origin: /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\]|[^:]+\.pretix\.work)(?::\d+)?$/ },
|
|
},
|
|
build: {
|
|
manifest: true,
|
|
outDir: path.resolve(__dirname, 'src/pretix/static.dist/vite/control'),
|
|
rollupOptions: {
|
|
preserveEntrySignatures: 'exports-only',
|
|
input: {
|
|
'webcheckin/main': path.resolve(__dirname, 'src/pretix/plugins/webcheckin/static/pretixplugins/webcheckin/main.ts'),
|
|
'checkinrules/main': path.resolve(__dirname, 'src/pretix/static/pretixcontrol/js/ui/checkinrules/index.ts'),
|
|
...Object.fromEntries(SHARED_DEPS.map(dep => [`_vendor/${dep}`, `virtual:vendor/${dep}`])),
|
|
...pretixPluginEntries,
|
|
},
|
|
}
|
|
},
|
|
optimizeDeps: {
|
|
exclude: ['moment', 'jquery']
|
|
},
|
|
})
|
|
|
|
// Virtual module plugin: generates re-export entries for each shared dep
|
|
// In dev mode, serves /__pretix_importmap so the python template tag can build the import map without hardcoding dep names.
|
|
function sharedDepsPlugin (): Plugin {
|
|
const PREFIX = 'virtual:vendor/'
|
|
const RESOLVED = '\0virtual:vendor/'
|
|
return {
|
|
name: 'pretix-shared-deps',
|
|
resolveId (id) {
|
|
if (id.startsWith(PREFIX))
|
|
return RESOLVED + id.slice(PREFIX.length)
|
|
},
|
|
load (id) {
|
|
if (id.startsWith(RESOLVED)) {
|
|
const pkg = id.slice(RESOLVED.length)
|
|
return `export * from '${pkg}'`
|
|
}
|
|
},
|
|
// Serve the import map data so the Python template tag can fetch it in dev mode
|
|
configureServer (server) {
|
|
server.middlewares.use((req, res, next) => {
|
|
if (req.url === '/__pretix_importmap') {
|
|
const imports = Object.fromEntries(
|
|
SHARED_DEPS.map(dep => [
|
|
dep,
|
|
`/node_modules/.vite/deps/${dep.replace('/', '_')}.js`,
|
|
])
|
|
)
|
|
res.setHeader('Content-Type', 'application/json')
|
|
res.setHeader('Access-Control-Allow-Origin', '*')
|
|
res.end(JSON.stringify(imports))
|
|
return
|
|
}
|
|
next()
|
|
})
|
|
},
|
|
}
|
|
}
|
|
|
|
// TODO move to separate file?
|
|
function discoverPretixPlugins (): { entries: Record<string, string> } {
|
|
let manifestFiles: string[] = []
|
|
try {
|
|
const raw = execSync(`python -c "
|
|
import importlib_metadata as metadata, json, pathlib, tomllib
|
|
result = []
|
|
for ep in metadata.entry_points(group='pretix.plugin'):
|
|
dist = ep.dist
|
|
if not dist: continue
|
|
try:
|
|
url_info = json.loads(dist.read_text('direct_url.json') or '{}')
|
|
if not url_info.get('dir_info', {}).get('editable'):
|
|
continue # non-editable plugins build their own assets
|
|
p = pathlib.Path(url_info['url'].replace('file://', '')) / 'pretixplugin.toml'
|
|
if not p.exists():
|
|
continue
|
|
with p.open('rb') as f:
|
|
if 'vite' in tomllib.load(f):
|
|
result.append(str(p))
|
|
except Exception:
|
|
pass
|
|
print(json.dumps(result))
|
|
"`, { stdio: ['pipe', 'pipe', 'inherit'] }).toString().trim()
|
|
manifestFiles = JSON.parse(raw)
|
|
} catch (error) {
|
|
console.error('Failed to discover pretix plugins, skipping plugin entries:', error)
|
|
}
|
|
const entries: Record<string, string> = {}
|
|
for (const manifestFile of manifestFiles) {
|
|
const packageRoot = manifestFile.replace(/[/\\]pretixplugin\.toml$/, '')
|
|
const parsed = parseToml(readFileSync(manifestFile, 'utf8')) as {
|
|
vite: { entries: Record<string, string> }
|
|
}
|
|
for (const [name, rel] of Object.entries(parsed.vite.entries)) {
|
|
entries[name] = path.join(packageRoot, rel)
|
|
}
|
|
}
|
|
return { entries }
|
|
}
|
|
|
|
// In dev mode, the browser requests /{entryName} from the Vite dev server.
|
|
// Vite can't find these files since they live outside the project root.
|
|
// This plugin rewrites those URLs to /@fs{absPath} so Vite serves them directly.
|
|
function pretixPluginDevEntries (): Plugin {
|
|
return {
|
|
name: 'pretix-plugin-dev-entries',
|
|
configureServer (server) {
|
|
server.middlewares.use((req, _res, next) => {
|
|
const urlPath = req.url?.split('?')[0]
|
|
if (urlPath) {
|
|
const name = urlPath.slice(1) // strip leading /
|
|
if (name in pretixPluginEntries)
|
|
req.url = `/@fs${pretixPluginEntries[name]}`
|
|
}
|
|
next()
|
|
})
|
|
},
|
|
}
|
|
}
|