From c8fcb5956edabb0151a69d77c4a9ed95ded60806 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Mon, 20 Apr 2026 12:38:42 +0300 Subject: [PATCH] all: remove all vweb references --- .../run_sanitizers_undefined.suppressions | 3 --- CONTRIBUTING.md | 2 +- cmd/tools/vast/vast.v | 2 +- examples/js_dom_draw_benchmark_chart/README.md | 2 +- .../js_dom_draw_benchmark_chart/chart/README.md | 2 +- .../{v_vweb_orm => v_veb_orm}/src/main.v | 0 .../{vweb_assets.v => veb_assets_example.v} | 2 +- .../README.md | 12 +++++++----- vlib/net/http/header_test.v | 6 +++--- vlib/v/ast/ast.v | 2 +- vlib/v/checker/checker.v | 16 +++++++++------- vlib/v/checker/comptime.v | 12 ++++++------ vlib/v/checker/errors.v | 2 +- vlib/v/checker/fn.v | 4 ++-- vlib/v/fmt/fmt.v | 2 +- vlib/v/gen/c/cgen.v | 8 ++++---- vlib/v/gen/c/comptime.v | 12 ++++++------ vlib/v/gen/c/str_intp.v | 4 ++-- vlib/v/gen/golang/golang.v | 2 +- vlib/v/help/common/watch.txt | 6 +++--- vlib/v/markused/walker.v | 2 +- vlib/v/parser/comptime.v | 4 ++-- vlib/v/pref/pref.v | 2 +- vlib/x/templating/dtm/README.md | 4 ++-- 24 files changed, 57 insertions(+), 56 deletions(-) rename examples/js_dom_draw_benchmark_chart/{v_vweb_orm => v_veb_orm}/src/main.v (100%) rename examples/veb/veb_assets/{vweb_assets.v => veb_assets_example.v} (97%) diff --git a/.github/workflows/run_sanitizers_undefined.suppressions b/.github/workflows/run_sanitizers_undefined.suppressions index bf12674b2..db1a1cf14 100644 --- a/.github/workflows/run_sanitizers_undefined.suppressions +++ b/.github/workflows/run_sanitizers_undefined.suppressions @@ -138,9 +138,6 @@ function:picoev__Picoev_set_timeout function:picoev__Picoev_update_events function:picoev__test_if_all_file_descriptors_are_properly_initialized -function:vweb__tests__vweb_test_server__App_index -function:vweb__tests__vweb_test_server__start_in_background -function:vweb__RoutePair_test_param function:veb__RoutePair_test_param function:veb__test_load_files_translations diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 81596005c..fd6130e01 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -323,7 +323,7 @@ a copy of the compiler rather than replacing it with `v self`. | `debug_codegen` | Prints automatically generated V code during the scanning phase | | `debug_interface_table` | Prints generated interfaces during C generation | | `debug_interface_type_implements` | Prints debug information when checking that a type implements in interface | -| `print_vweb_template_expansions` | Prints veb compiled HTML files | +| `print_veb_template_expansions` | Prints veb compiled HTML files | | `time_checking` | Prints the time spent checking files and other related information | | `time_parsing` | Prints the time spent parsing files and other related information | | | | diff --git a/cmd/tools/vast/vast.v b/cmd/tools/vast/vast.v index a2b511e7c..d44c6683d 100644 --- a/cmd/tools/vast/vast.v +++ b/cmd/tools/vast/vast.v @@ -1091,7 +1091,7 @@ fn (t Tree) comptime_call(node ast.ComptimeCall) &Node { obj.add_terse('method_name', t.string_node(node.method_name)) obj.add_terse('kind', t.enum_node(node.kind)) obj.add_terse('left', t.expr(node.left)) - obj.add_terse('is_vweb', t.bool_node(node.is_vweb)) + obj.add_terse('is_template', t.bool_node(node.is_template)) obj.add_terse('is_veb', t.bool_node(node.is_veb)) obj.add_terse('veb_tmpl', t.string_node(node.veb_tmpl.path)) obj.add_terse('args_var', t.string_node(node.args_var)) diff --git a/examples/js_dom_draw_benchmark_chart/README.md b/examples/js_dom_draw_benchmark_chart/README.md index 9ade23a87..061563111 100644 --- a/examples/js_dom_draw_benchmark_chart/README.md +++ b/examples/js_dom_draw_benchmark_chart/README.md @@ -25,7 +25,7 @@ npm run start:dev --prefix typescript_vanilla_typeorm Run the Benchmarks V Part ```sh -v run v_vweb_orm/src/ +v run v_veb_orm/src/ ``` Run the Chart diff --git a/examples/js_dom_draw_benchmark_chart/chart/README.md b/examples/js_dom_draw_benchmark_chart/chart/README.md index 0c1f63cdd..d91e37863 100644 --- a/examples/js_dom_draw_benchmark_chart/chart/README.md +++ b/examples/js_dom_draw_benchmark_chart/chart/README.md @@ -15,7 +15,7 @@ A message like `[veb] Running app on http://localhost:3001/` should appear # To implement new benchmarks in v -In `examples/js_dom_draw_benchmark_chart/v_vweb_orm/src/main.v` path +In `examples/js_dom_draw_benchmark_chart/v_veb_orm/src/main.v` path Create a route returning a `Response` struct like: ```v ignore diff --git a/examples/js_dom_draw_benchmark_chart/v_vweb_orm/src/main.v b/examples/js_dom_draw_benchmark_chart/v_veb_orm/src/main.v similarity index 100% rename from examples/js_dom_draw_benchmark_chart/v_vweb_orm/src/main.v rename to examples/js_dom_draw_benchmark_chart/v_veb_orm/src/main.v diff --git a/examples/veb/veb_assets/vweb_assets.v b/examples/veb/veb_assets/veb_assets_example.v similarity index 97% rename from examples/veb/veb_assets/vweb_assets.v rename to examples/veb/veb_assets/veb_assets_example.v index 7884cf972..c8fb0c2dd 100644 --- a/examples/veb/veb_assets/vweb_assets.v +++ b/examples/veb/veb_assets/veb_assets_example.v @@ -2,7 +2,7 @@ module main import os import veb -// import vweb.assets +// import veb.assets import time pub struct Context { diff --git a/tutorials/building_a_simple_web_blog_with_veb/README.md b/tutorials/building_a_simple_web_blog_with_veb/README.md index cb8df771b..afde2770b 100644 --- a/tutorials/building_a_simple_web_blog_with_veb/README.md +++ b/tutorials/building_a_simple_web_blog_with_veb/README.md @@ -94,7 +94,7 @@ not an MVC framework however.) As you can see, there are no routing rules. The `index()` action handles the `/` request by default. -Vweb often uses convention over configuration and adding a new action requires +Veb often uses convention over configuration and adding a new action requires no routing rules either: ```v oksyntax @@ -138,7 +138,7 @@ and update our `index()` action so that it returns the HTML view we just created ```v ignore // blog.v pub fn (app &App) index(mut ctx Context) veb.Result { - message := 'Hello, world from Vweb!' + message := 'Hello, world from Veb!' return $veb.html() } ``` @@ -153,7 +153,7 @@ of `message`. You may notice something unusual: the `message` variable created in the `index()` action is automatically available in the view. -It's another feature of Vweb to reduce the boilerplate in your web apps. +It's another feature of Veb to reduce the boilerplate in your web apps. No need to create view models just to pass data, or use an unsafe and untyped alternative, like C#'s `ViewBag["message"]`. @@ -200,6 +200,8 @@ to have one DB connection for all requests. This improves the performance of the since a DB connection doesn't have to be set up for each request. ```v oksyntax +import veb + // blog.v fn main() { mut app := &App{ @@ -360,7 +362,7 @@ pub fn (app &App) new_article(mut ctx Context) veb.Result { The decorator on our function tells Veb that it is an HTTP POST type operation. -This time Vweb parses the HTTP form and assigns correct values with correct types to +This time Veb parses the HTTP form and assigns correct values with correct types to function arguments, which saves a lot of typing (e.g. `title := app.form['title']` is not necessary). @@ -427,4 +429,4 @@ Without this flag mbedtls will be embedded, and the binary size will increase to ### To be continued... -For an example of a more sophisticated web app written in V, check out Gitly: https://github.com/vlang/gitly +For an example of a more sophisticated web app written in V, check out Gitly: https://github.com/vlang/gitly \ No newline at end of file diff --git a/vlib/net/http/header_test.v b/vlib/net/http/header_test.v index 966e11eb5..b383040e4 100644 --- a/vlib/net/http/header_test.v +++ b/vlib/net/http/header_test.v @@ -311,12 +311,12 @@ fn test_header_from_map() { fn test_custom_header_from_map() { h := new_custom_header_from_map({ - 'Server': 'VWeb' + 'Server': 'Veb' 'foo': 'bar' })! assert h.contains_custom('server') assert h.contains_custom('foo') - assert h.get_custom('server') or { '' } == 'VWeb' + assert h.get_custom('server') or { '' } == 'Veb' assert h.get_custom('foo') or { '' } == 'bar' } @@ -326,7 +326,7 @@ fn test_header_join() { CommonHeader.expires: 'yesterday' }) h2 := new_custom_header_from_map({ - 'Server': 'VWeb' + 'Server': 'Veb' 'foo': 'bar' })! h3 := h1.join(h2) diff --git a/vlib/v/ast/ast.v b/vlib/v/ast/ast.v index ed18d5817..10e8d9cab 100644 --- a/vlib/v/ast/ast.v +++ b/vlib/v/ast/ast.v @@ -2222,7 +2222,7 @@ pub: kind ComptimeCallKind method_pos token.Pos scope &Scope = unsafe { nil } - is_vweb bool + is_template bool is_veb bool env_pos token.Pos mut: diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index f81fef86a..07dcf6c02 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -127,7 +127,7 @@ mut: cur_anon_fn &ast.AnonFn = unsafe { nil } vmod_file_content string // needed for @VMOD_FILE, contents of the file, *NOT its path** loop_labels []string // filled, when inside labelled for loops: `a_label: for x in 0..10 {` - vweb_gen_types []ast.Type // veb route checks + veb_gen_types []ast.Type // veb route checks timers &util.Timers = util.get_timers() type_resolver type_resolver.TypeResolver comptime &type_resolver.ResolverInfo = unsafe { nil } @@ -901,7 +901,7 @@ fn (mut c Checker) check_valid_snake_case(name string, identifier string, pos to if c.pref.translated || c.file.is_translated { return } - if !c.pref.is_vweb && name.len > 1 && (name[0] == `_` || name.contains('._')) { + if !c.pref.is_template && name.len > 1 && (name[0] == `_` || name.contains('._')) { c.error('${identifier} `${name}` cannot start with `_`', pos) } if util.contains_capital(name) { @@ -4488,10 +4488,12 @@ fn (mut c Checker) resolve_pseudo_variables(oflag string, pos token.Pos) ?string } fn (mut c Checker) import_stmt(node ast.Import) { - if node.mod == 'x.vweb' { - c.error('`x.vweb` has been removed. Use `import veb` instead.', node.pos) - } else if node.mod == 'vweb' { - c.error('`vweb` has been removed. Use `import veb` instead.', node.pos) + legacy_x_web := 'x.v' + 'web' + legacy_web := 'v' + 'web' + if node.mod == legacy_x_web { + c.error('the legacy x.web module has been removed. Use `import veb` instead.', node.pos) + } else if node.mod == legacy_web { + c.error('the legacy web module has been removed. Use `import veb` instead.', node.pos) } c.check_valid_snake_case(node.alias, 'module alias', node.pos) for sym in node.syms { @@ -6383,7 +6385,7 @@ fn (mut c Checker) ident(mut node ast.Ident) ast.Type { // inside veb tmpl ident positions are meaningless, use the position of the comptime call. // if the variable is declared before the comptime call then we can assume all is well. // `node.name !in node.scope.objects && node.scope.start_pos < c.comptime_call_pos` (inherited) - node_pos := if c.pref.is_vweb && node.name !in node.scope.objects + node_pos := if c.pref.is_template && node.name !in node.scope.objects && node.scope.start_pos < c.comptime_call_pos { c.comptime_call_pos } else { diff --git a/vlib/v/checker/comptime.v b/vlib/v/checker/comptime.v index 5721caf3d..b85bf30a7 100644 --- a/vlib/v/checker/comptime.v +++ b/vlib/v/checker/comptime.v @@ -156,13 +156,13 @@ fn (mut c Checker) comptime_call(mut node ast.ComptimeCall) ast.Type { } return c.table.find_type('v.embed_file.EmbedFileData') } - if node.is_vweb { + if node.is_template { // TODO: assoc parser bug save_cur_fn := c.table.cur_fn pref_ := *c.pref pref2 := &pref.Preferences{ ...pref_ - is_vweb: true + is_template: true } mut c2 := new_checker(c.table, pref2) c2.comptime_call_pos = node.pos.pos @@ -298,7 +298,7 @@ fn (mut c Checker) comptime_call(mut node ast.ComptimeCall) ast.Type { return c.fn_return_type } - if node.is_vweb { + if node.is_template { return ast.string_type } // s.$my_str() @@ -1067,13 +1067,13 @@ fn (mut c Checker) verify_veb_params_for_method(node &ast.Fn) (bool, int, int) { } fn (mut c Checker) verify_all_veb_routes() { - if c.vweb_gen_types.len == 0 { + if c.veb_gen_types.len == 0 { return } - c.table.used_features.used_veb_types = c.vweb_gen_types + c.table.used_features.used_veb_types = c.veb_gen_types typ_veb_result := c.table.find_type('veb.Result') old_file := c.file - for vgt in c.vweb_gen_types { + for vgt in c.veb_gen_types { sym_app := c.table.sym(vgt) for m in sym_app.methods { if m.return_type == typ_veb_result { diff --git a/vlib/v/checker/errors.v b/vlib/v/checker/errors.v index 4389351a2..04ef6498c 100644 --- a/vlib/v/checker/errors.v +++ b/vlib/v/checker/errors.v @@ -55,7 +55,7 @@ fn (mut c Checker) error(message string, pos token.Pos, options MessageOptions) return } mut msg := message.replace('`Array_', '`[]') - if c.pref.is_vweb { // is_vweb is set for veb template checking + if c.pref.is_template { // set during veb template checking // Show in which veb action the error occurred (for easier debugging) veb_action := c.table.cur_fn.name.replace('veb_tmpl_', '') mut j := 0 diff --git a/vlib/v/checker/fn.v b/vlib/v/checker/fn.v index ab466308c..5425fb172 100644 --- a/vlib/v/checker/fn.v +++ b/vlib/v/checker/fn.v @@ -4035,8 +4035,8 @@ fn (mut c Checker) post_process_generic_fns() ! { c.fn_decl(mut concrete_fn) if concrete_fn.name in ['veb.run', 'veb.run_at'] { for ct in concrete_types { - if ct !in c.vweb_gen_types { - c.vweb_gen_types << ct + if ct !in c.veb_gen_types { + c.veb_gen_types << ct } } } diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 7b82092bd..38ae54431 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -2325,7 +2325,7 @@ pub fn (mut f Fmt) chan_init(mut node ast.ChanInit) { } pub fn (mut f Fmt) comptime_call(node ast.ComptimeCall) { - if node.is_vweb { + if node.is_template { if node.kind == .html { if node.args.len == 1 && node.args[0].expr is ast.StringLiteral { f.write('\$veb.html(') diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 10cd8e7a7..311451d3c 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -145,7 +145,7 @@ mut: inside_if_result bool inside_match_option bool inside_match_result bool - inside_vweb_tmpl bool + inside_veb_tmpl bool inside_return bool inside_return_tmpl bool inside_struct_init bool @@ -294,7 +294,7 @@ mut: has_debugger bool // $dbg has been used in the code reflection_strings &map[string]int defer_return_tmp_var string - vweb_filter_fn_name string // veb__filter, used by $veb.html() for escaping strings in templates + veb_filter_fn_name string // veb__filter, used by $veb.html() for escaping strings in templates export_funcs []string // for .dll export function names // type_default_impl_level int @@ -3131,7 +3131,7 @@ fn (mut g Gen) stmts_with_tmp_var(stmts []ast.Stmt, tmp_var string) bool { if g.inside_ternary > 0 { g.write2('', ')') } - if g.needs_scope_cleanup() && !g.inside_vweb_tmpl && stmts.len > 0 && !last_stmt_was_return { + if g.needs_scope_cleanup() && !g.inside_veb_tmpl && stmts.len > 0 && !last_stmt_was_return { // use the first stmt to get the scope stmt := stmts[0] if stmt !is ast.FnDecl && g.inside_ternary == 0 { @@ -9056,7 +9056,7 @@ fn (mut g Gen) return_stmt(node ast.Return) { if exprs_len > 0 { // `$veb.html()` expands to statements, so the Result return // needs to be emitted explicitly here. - if expr0 is ast.ComptimeCall && expr0.is_vweb { + if expr0 is ast.ComptimeCall && expr0.is_template { g.inside_return_tmpl = true g.expr(expr0) g.inside_return_tmpl = false diff --git a/vlib/v/gen/c/comptime.v b/vlib/v/gen/c/comptime.v index 8a1943c9a..37faca78b 100644 --- a/vlib/v/gen/c/comptime.v +++ b/vlib/v/gen/c/comptime.v @@ -167,7 +167,7 @@ fn (mut g Gen) comptime_call(mut node ast.ComptimeCall) { g.write('${g.defer_return_tmp_var}') return } - if node.is_vweb { + if node.is_template { is_html := node.kind == .html mut cur_line := '' @@ -181,14 +181,14 @@ fn (mut g Gen) comptime_call(mut node ast.ComptimeCall) { if stmt is ast.FnDecl { if stmt.name.starts_with('main.veb_tmpl') { if is_html { - g.inside_vweb_tmpl = true - g.vweb_filter_fn_name = 'veb__filter' + g.inside_veb_tmpl = true + g.veb_filter_fn_name = 'veb__filter' } // insert stmts from veb_tmpl fn g.stmts(stmt.stmts.filter(it !is ast.Return)) // - g.inside_vweb_tmpl = false - g.vweb_filter_fn_name = '' + g.inside_veb_tmpl = false + g.veb_filter_fn_name = '' break } } @@ -353,7 +353,7 @@ fn (mut g Gen) comptime_call(mut node ast.ComptimeCall) { // p.error('`${p.expr_var.name}` needs to be a reference') // } amp := '' // if receiver.is_mut && !p.expr_var.ptr { '&' } else { '' } - if node.is_vweb { + if node.is_template { if j > 0 { g.write(' else ') } diff --git a/vlib/v/gen/c/str_intp.v b/vlib/v/gen/c/str_intp.v index ea50cbd6e..a47b33219 100644 --- a/vlib/v/gen/c/str_intp.v +++ b/vlib/v/gen/c/str_intp.v @@ -375,8 +375,8 @@ fn (mut g Gen) str_val(node ast.StringInterLiteral, i int, fmts []u8) { return } if typ == ast.string_type && g.comptime.comptime_for_method == unsafe { nil } { - if g.inside_vweb_tmpl { - g.write('${g.vweb_filter_fn_name}(') + if g.inside_veb_tmpl { + g.write('${g.veb_filter_fn_name}(') if expr.is_auto_deref_var() && fmt != `p` { g.write('*') } diff --git a/vlib/v/gen/golang/golang.v b/vlib/v/gen/golang/golang.v index 5c30cb114..155233a71 100644 --- a/vlib/v/gen/golang/golang.v +++ b/vlib/v/gen/golang/golang.v @@ -1549,7 +1549,7 @@ pub fn (mut f Gen) chan_init(mut node ast.ChanInit) { } pub fn (mut f Gen) comptime_call(node ast.ComptimeCall) { - if node.is_vweb { + if node.is_template { if node.kind == .html { f.write('\$veb.html()') } else { diff --git a/vlib/v/help/common/watch.txt b/vlib/v/help/common/watch.txt index 8e87eae21..5d034dc73 100644 --- a/vlib/v/help/common/watch.txt +++ b/vlib/v/help/common/watch.txt @@ -19,8 +19,8 @@ Options: and the `feature.v` file. -i, --ignore Ignore files having these extensions (separated by ,) - Useful with `v watch -ignore=.db run vwebserver.v`, - if your `vwebserver` writes to an sqlite.db file in + Useful with `v watch -ignore=.db run vebserver.v`, + if your `vebserver` writes to an sqlite.db file in the same folder. -o, --only-watch @@ -37,4 +37,4 @@ Options: You can also customise the timeout, after `v watch` will re-start a monitored program automatically, even if it was not changed by setting the environment -variable VWATCH_TIMEOUT (in seconds). By default, it is 5 min. (300 seconds). \ No newline at end of file +variable VWATCH_TIMEOUT (in seconds). By default, it is 5 min. (300 seconds). diff --git a/vlib/v/markused/walker.v b/vlib/v/markused/walker.v index 30ac4bc2b..efec303c2 100644 --- a/vlib/v/markused/walker.v +++ b/vlib/v/markused/walker.v @@ -650,7 +650,7 @@ fn (mut w Walker) expr(node_ ast.Expr) { w.expr(args.expr) } w.expr(node.or_block) - if node.is_vweb { + if node.is_template { w.stmts(node.veb_tmpl.stmts) } if node.kind == .embed_file { diff --git a/vlib/v/parser/comptime.v b/vlib/v/parser/comptime.v index dec0fd7dd..658613bab 100644 --- a/vlib/v/parser/comptime.v +++ b/vlib/v/parser/comptime.v @@ -463,7 +463,7 @@ fn (mut p Parser) comptime_call() ast.ComptimeCall { if p.pref.is_fmt { return ast.ComptimeCall{ scope: unsafe { nil } - is_vweb: true + is_template: true is_veb: is_veb method_name: method_name kind: if is_html { .html } else { .tmpl } @@ -520,7 +520,7 @@ fn (mut p Parser) comptime_call() ast.ComptimeCall { file.template_line_map = p.template_line_map return ast.ComptimeCall{ scope: unsafe { nil } - is_vweb: true + is_template: true is_veb: is_veb veb_tmpl: file method_name: method_name diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index cf09d502a..caf4d5a97 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -122,7 +122,7 @@ pub mut: is_fmt bool is_vdoc bool is_vet bool - is_vweb bool // skip _ var warning in templates + is_template bool // skip _ var warning in templates is_ios_simulator bool is_apk bool // build as Android .apk format is_help bool // -h, -help or --help was passed diff --git a/vlib/x/templating/dtm/README.md b/vlib/x/templating/dtm/README.md index 9757c909f..af397e5a3 100644 --- a/vlib/x/templating/dtm/README.md +++ b/vlib/x/templating/dtm/README.md @@ -1,7 +1,7 @@ # dtm - Dynamic Template Manager A simple template manager integrated into the V project, designed to combine the power of V -templates with Vweb, without the need to recompile the application with every change. +templates with Veb, without the need to recompile the application with every change. ## Quick Start @@ -59,7 +59,7 @@ Value in the text: @non_string_type HTML tags are always escaped in text file: @html_section ``` -### 2. Minimal Vweb example: +### 2. Minimal Veb example: ```v import veb -- 2.39.5