Files
yokots 62102ab1e8 feat(vue-next): minify webpack bundle size (#3983)
* chore(drive/js): bump up ttypescript version

Current ttypescript version not support node v16.20.2, the latest v16 version.
It will cause this issue: https://github.com/cevek/ttypescript/issues/150

* fix(hipp-vue-next): correct patchProps types

align patchProps types with vue runtime core, but
there also have some spec tests to fix

* refactor(vue-next): minify generated style code

just like fromSsrAstNodes, optimize the output in hippy-vue-css-loader,
and make hippy-vue-next-style-parser to compatible with old and new format.

* build(example-scripts): remove webpack.NamedModulesPlugin

webpack.NamedModulesPlugin was deprecated in v4 and removed in v5.
these plugin are default in devlopment mode and should not be configured in production mode,
because it will expose file path and increase bundle sizes.

https://v4.webpack.js.org/migrate/4/#deprecatedremoved-plugins

* chore(examples): update vue3 assets

---------

Co-authored-by: zealotchen <92966734+zealotchen0@users.noreply.github.com>
2024-09-29 19:38:43 +08:00
..
2022-11-22 07:44:08 +00:00
2022-12-09 23:37:49 +08:00
2022-12-09 23:37:49 +08:00
2022-12-09 23:37:49 +08:00

voltron

💡 Introduction

Voltron is Flutter version of Hippy dynamic framework, which contains almost 100% Hippy features. It also has the characteristics of high performance, cross platform, easy learning, etc.

See https://hippyjs.org for details, based on Hippy 3.0

🔨 Getting started

add this line to pubspec.yaml

dependencies:
  voltron: ^0.0.1

import package

import 'package:voltron/voltron.dart';

simple example

import 'package:flutter/material.dart';
import 'package:voltron/voltron.dart';

class VoltronPage extends StatefulWidget {
  VoltronPage();

  @override
  State<StatefulWidget> createState() {
    return _VoltronPageState();
  }
}

class _VoltronPageState extends State<VoltronPage> {
  late VoltronJSLoaderManager _loaderManager;
  late VoltronJSLoader _jsLoader;

  @override
  void initState() {
    super.initState();
    _initVoltronData();
  }

  void _initVoltronData() async {
    var initParams = EngineInitParams();
    initParams.debugMode = false;
    initParams.enableLog = true;
    initParams.coreJSAssetsPath = 'assets/jsbundle/vendor.android.js';
    initParams.codeCacheTag = "common";
    _loaderManager = VoltronJSLoaderManager.createLoaderManager(
      initParams,
      (statusCode, msg) {
        LogUtils.i(
          'loadEngine',
          'code($statusCode), msg($msg)',
        );
      },
    );
    var loadParams = ModuleLoadParams();
    loadParams.componentName = "Demo";
    loadParams.codeCacheTag = "Demo";
    loadParams.jsAssetsPath = 'assets/jsbundle/index.android.js';
    loadParams.jsParams = VoltronMap();
    loadParams.jsParams?.push(
      "msgFromNative",
      "Hi js developer, I come from native code!",
    );
    _jsLoader = _loaderManager.createLoader(
      loadParams,
      moduleListener: (status, msg) {
        LogUtils.i(
          "flutterRender",
          "loadModule status($status), msg ($msg)",
        );
      },
    );
  }

  @override
  void dispose() {
    super.dispose();
    _jsLoader.destroy();
    _loaderManager.destroy();
  }

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: () async {
        return !(_jsLoader.back(() {
          Navigator.of(context).pop();
        }));
      },
      child: Scaffold(
        body: VoltronWidget(
          loader: _jsLoader,
        ),
      ),
    );
  }
}