GithubHelp home page GithubHelp logo

originjs / origin.js Goto Github PK

View Code? Open in Web Editor NEW
125.0 125.0 17.0 2.1 MB

A simple and powerful web application framework.

Home Page: https://originjs.org

License: Other

TypeScript 42.66% JavaScript 23.58% HTML 27.96% Vue 4.47% CSS 1.24% SCSS 0.03% Less 0.04% Stylus 0.02%

origin.js's Introduction

originjs

slogan:originjs is origin;

origin 中文名称 => "元";你也可以理解为源或原;意义为最原始的状态;类似混沌。

originjs is origin 翻译成中文 元本是元 ;见路不走,即见因果;见相非相,即见如来;

本着不拘泥于经验教条,同时又吸收前人成熟的方法,赋能开发者。

Originjs 的理念是一套基于原生Javascript 的轻量级的JavaScript框架,用于数据、方法的处理;

多数程序员在使用前端框架的时候可能会使用vue、react、ng等,虽然他们会以轻量高效著称,但是是否如他们讲的那样只有开发者有发言权。Originjs的出现并非是替代或颠覆而是完善,也就是说无论你是使用vue或react开发的项目您都可以使用Orgingjs加入到您的项目当中;

当然Originjs 不仅仅是为了迎合市场,更迎合我们开发者; 有些相对体量较小而且多是逻辑处理的项目,boss最求的高效&迅速完成开发,这时如果您再去用vue或react还是有一些的笨重。

这个时候就需要用到originjs协助您开发。

在语法上originjs基于原生的JavaScript开发,支持原生JavaScript ES6/7/8/9...,所以您不必为语法上做过多的纠结,只需按照我们的约定方式。

OriginJS

Help developers complete tasks faster

Requirement

  • google analytics installed

Getting started

From bower

bower install cn-originjs --save

From npm

npm install cn-originjs 

How it works

(1)originAjax(a,b,c,d,e);
	//=>ajax 
	Parameters you have to pass!!!
	a:url 
	b:type(post/get/put...) 
	c:cookie save true or false 
	d:callback 
	e:params
(2)originFor
	First step :Preparation data and target DOM Node
	arr: Data to process 
	domNode: Insertion node
	The second step: Call it
	originFor(arr,domNode,function(data){
		//Your code...
	})
	The third step: insert to target DOM Node


origin.post.Ajax(); //=> ajax post 
origin.getParams() //=> return url params in object type
origin.forData();//=> for data
origin.getSource() //=> return utm_source
origin.getMedium() //=> return utm_medium
origin.getContent() //=> return utm_content
origin.getCampaign() //=> return utm_campaign
origin.getTerm() //=> return utm_term

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Licence

CSHANS.CN | CN-OriginJs

origin.js's People

Contributors

alanscut avatar csm-dev-hub avatar egyjs avatar flyfishzy avatar janson1012 avatar kalvenschraut avatar konpeki622 avatar mulinjiao avatar peteralfredlee avatar wangsongc avatar wuzejimaya avatar ygj6 avatar zhenxiongqian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

origin.js's Issues

Can globalStyle supports libary mode?

Is your feature request related to a problem? Please describe.

I'm devploping a components libary in monorepo
globalStyle work fine in my docs project with vitepress
but not work when build in lib mode
this is my repo

Describe the solution you'd like

I hope globalStyle supports lib mode
and maybe you can add a debug option to show finally absolute root dir
the relative path sourcePath in my vitepress config is so strange, though it work fine.
or I can push a pr to add this

Describe alternatives you've considered

Additional context

failed to build with assets plugin

Versions

  • originjs: v0.1.0
  • node: v14.17.5

Reproduction

Additional Details

Steps to reproduce

  1. create a project.
  2. add assets plugin to vite.config.js.
  3. run ori build.

What is Expected?

build successfully.

What is actually happening?

print error: [vite]: Rollup failed to resolve import "src/assets/global-theme.css" from "index.html". This is most likely unintended because it can break your application at runtime. If you do want to externalize this module explicitly add it to build.rollupOptions.external

image

The local config file does not work.

vite.config.ts

import path from 'path';
export default {
      resolve: {
          root: '/a/b',
          cacheDir: 'node_modules/.vite',
          alias: [
              {
                  find: /^~/,
                  replacement: ''
              },
              {
                  find: '@',
                  replacement: path.resolve(__dirname,'src')
              }
          ],
          extensions: [
              '.mjs',
              '.js',
              '.ts',
              '.jsx',
              '.tsx',
              '.json',
              '.vue'
          ]
      },
      build: {
      }          
}

测试输出:

const buildConfig: InlineConfig = {
      configFile: false,
      build: { outDir: 'dist', assetsDir: 'public' },
      css: { postcss: { plugins: [] } },
      mode: 'production',
      publicDir: 'public',
      root: path,
      resolve: {
        extensions: [
          '.js',
          '.mjs',
          '.ts',
          '.jsx',
          '.tsx',
          '.json',
          '.yaml',
          '.yml',
        ],
      },
    }

use vitest for test

Is your feature request related to a problem? Please describe.

Origin.js creates server with vite, which means we can get faster testing and more simple configuration if using vitest.

Describe the solution you'd like

  • options to select jest or vitest for test in an Origin.js project.
  • migrate package testing to vitest

Vitest print error in initial project

Versions

  • originjs: v1.0.2
  • node: v16.13.0

Reproduction

None.

Additional Details

Steps to reproduce

Create a new project with vitest and run test.

What is Expected?

Works well.

What is actually happening?

print error:
image

when use css-module global inject don't work

Versions

  • originjs: "@originjs/vite-plugin-global-style": "^1.0.1",
  • node: v14.17.6

Reproduction

when use css-module in viit project , @originjs/vite-plugin-global-style don't work
because the css-module file path will be transformed like /vite-app/src/components/templates/Card/style.module.scss?used
it ends with ?used
but GLOBAL_STYLES_DATA extensionRegex only match file end with css extension

Additional Details

Steps to reproduce

  1. css-module file path whild be transformed to /vite-app/src/components/templates/Card/style.module.scss?used
  2. GLOBAL_STYLES_DATA
{
   	name: "sass",
   	globalRegex: /^global.*\.scss$/,
   	extensionRegex: /.scss$/, // only match  scss end
   	globalStylePaths: [],
   	isEnabled: (opt) => {
   		return opt.sassEnabled;
   	}
   },

What is Expected?

should match file with query

What is actually happening?

contributing guide

Is your feature request related to a problem? Please describe.

Guide for contributors.

Describe the solution you'd like

Update documentation

Describe alternatives you've considered

None.

Additional context

None.

Remote project run build failed

Versions

  • originjs: v1.0.2
  • node:

Reproduction

D:\work\ori\remote-vue3>npm run build

> [email protected] build
> vite build

vite v2.8.6 building for production...
✓ 45 modules transformed.
rendering chunks (5)...[vite:esbuild-transpile] Transform failed with 1 error:
assets/__federation_expose_RemoteComponent.js:3:163: ERROR: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")

Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
1  |  import {importShared} from './__federation_fn_import.js'
2  |  import { _ as _export_sfc } from './plugin-vue_export-helper.21dcd24c.js';
3  |  const {defineComponent,openBlock,createElementBlock,createElementVNode:createBaseVNode,toDisplayString,createStaticVNode,pushScopeId,popScopeId,createTextVNode} = await importShared('vue')
   |
          ^
4  |
5  |  var HelloWorld_vue_vue_type_style_index_0_scoped_true_lang = '';

error during build:
Error: Transform failed with 1 error:
assets/__federation_expose_RemoteComponent.js:3:163: ERROR: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
    at failureErrorWithLog (D:\work\ori\remote-vue3\node_modules\esbuild\lib\main.js:1602:15)
    at D:\work\ori\remote-vue3\node_modules\esbuild\lib\main.js:1391:29
    at D:\work\ori\remote-vue3\node_modules\esbuild\lib\main.js:665:9
    at handleIncomingPacket (D:\work\ori\remote-vue3\node_modules\esbuild\lib\main.js:762:9)
    at Socket.readFromStdout (D:\work\ori\remote-vue3\node_modules\esbuild\lib\main.js:632:7)
    at Socket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:199:23)
[!] Error: unfinished hook action(s) on exit:
(vite:esbuild-transpile) renderChunk
(vite:esbuild-transpile) renderChunk
(vite:esbuild-transpile) renderChunk
Additional Details

Steps to reproduce

Use ori to create a remote project and run npm run build.

What is Expected?

dist was successfully built

What is actually happening?

error during build

Can

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

Failed to run `ori dev`

ori dev启动ori init创建的工程时报错

D:\work\ori测试\ori-demo>ori dev
 > ../../songwang/origin.js/node_modules/vite/dist/node/chunks/dep-c1a9de64.js:51112:38: error: [plugin: vite:dep-scan] ENOENT: no such file or directory, open '/work/songwang/origin.js/packages/cli-service/dist/src/config/src/components/HelloWorld.vue'
    51112 │                 let raw = fs__default.readFileSync(path, 'utf-8');
          ╵                                       ^
    at Object.openSync (fs.js:476:3)
    at Object.readFileSync (fs.js:377:35)
    at D:\work\songwang\origin.js\node_modules\vite\dist\node\chunks\dep-c1a9de64.js:51112:39
    at callback (D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:869:34)
    at handleRequest (D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:652:36)
    at handleIncomingPacket (D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:699:7)
    at Socket.readFromStdout (D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:576:7)
    at Socket.emit (events.js:315:20)
    at Socket.EventEmitter.emit (domain.js:467:12)
    at addChunk (internal/streams/readable.js:309:12)

   ../../songwang/origin.js/node_modules/vite/dist/node/chunks/dep-c1a9de64.js:51111:18: note: This error came from the "onLoad" callback registered here     
    51111 │             build.onLoad({ filter: htmlTypesRE, namespace: 'html' }, async ({ path }) => {
          ╵                   ~~~~~~
    at setup (D:\work\songwang\origin.js\node_modules\vite\dist\node\chunks\dep-c1a9de64.js:51111:19)
    at handlePlugins (D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:736:23)
    at Object.buildOrServe (D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:1024:7)
    at D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:1754:17
    at new Promise (<anonymous>)
    at Object.build (D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:1753:14)
    at Object.build (D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:1629:51)
    at D:\work\songwang\origin.js\node_modules\vite\dist\node\chunks\dep-c1a9de64.js:51039:54
    at Array.map (<anonymous>)

   html:D:/work/ori测试/ori-demo/src/views/Index.vue:6:7: note: The plugin "vite:dep-scan" was triggered by this import
        6 │ import '@/components/HelloWorld.vue'
          ╵        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(node:17960) UnhandledPromiseRejectionWarning: Error: Build failed with 1 error:
../../songwang/origin.js/node_modules/vite/dist/node/chunks/dep-c1a9de64.js:51112:38: error: [plugin: vite:dep-scan] ENOENT: no such file or directory, open '/work/songwang/origin.js/packages/cli-service/dist/src/config/src/components/HelloWorld.vue'
    at failureErrorWithLog (D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:1449:15)
    at D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:1131:28
    at runOnEndCallbacks (D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:921:63)
    at buildResponseToResult (D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:1129:7)
    at D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:1236:14
    at D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:609:9
    at handleIncomingPacket (D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:706:9)
    at Socket.readFromStdout (D:\work\songwang\origin.js\node_modules\esbuild\lib\main.js:576:7)
    at Socket.emit (events.js:315:20)
    at Socket.EventEmitter.emit (domain.js:467:12)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:17960) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:17960) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate 
the Node.js process with a non-zero exit code.

ori init failed to create remote project

Versions

  • originjs: v1.0.0
  • node:

Reproduction

D:\work\ori>ori init aaaaa
? Please set the initial version number of the project: 1.0.0
? Please set the project code license: MIT
? Please select the plugin you need (Use enter to skip): ModuleFederation: Use Module Federation in vite
? Please select if this is project a Host or Remote for Module Federation: Remote
✔ Downloading...
Successfully created the folder!
Successfully change file name!     
✖ Install project dependency.......
Failed to download dependencies and initialize git repository
Error: Command failed: cd aaaaa && git init && npm install
npm ERR! code EJSONPARSE
npm ERR! path D:\work\ori\aaaaa/package.json
npm ERR! JSON.parse Unexpected string in JSON at position 168 while parsing '{
npm ERR! JSON.parse   "name": "aaaaa",
npm ERR! JSON.parse   "version": "1.0.0'
npm ERR! JSON.parse Failed to parse JSON data.
npm ERR! JSON.parse Note: package.json must be actual JSON, not just JavaScript.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\AppData\Local\npm-cache\_logs\2022-03-01T08_03_47_110Z-debug-0.log

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'cd aaaaa && git init && npm install'
}
Additional Details

Steps to reproduce

1、ori init remote
2、Select remote for module Federation

What is Expected?

What is actually happening?

tovite与tovue3使用顺序问题

  • 创建vue2-demo,先升级vite,再升级vue3,会报错
ori tovite
ori tovue3
npm run serve-vite

报错:启动vite时,vite配置中vue的版本不匹配
image

  • 创建vue2-demo,先升级vue3,再升级vite,运行正常
ori tovue3
ori tovite
npm run serve-vite

Browser tab defaultly shows project name

Is your feature request related to a problem? Please describe.

None.

Describe the solution you'd like

Create a project, then run server. The browser tab title is always Vite App.

Describe alternatives you've considered

That's good to show the project name user defined.

Additional context

None.

replace vuex with pinia

Is your feature request related to a problem? Please describe.

https://vuex.vuejs.org/
The official state management library for Vue has changed to Pinia.

Describe the solution you'd like

When creating an origin.js project, pinia can be selected to import.

Describe alternatives you've considered

Add pinia to cli options.

Additional context

None.

Publish the TypeScript typings for vite-plugin-content

Is your feature request related to a problem? Please describe.

I can see that vite--plugin-content is completely written in TypeScript, yet the typings are missing on the npm package.

It would be really nice (and easy!) to get these published in the package so that consumer projects can get proper typing help while writing the code!

image

Describe the solution you'd like

Output and publish the TypeScript typings in the npm package.

Describe alternatives you've considered

Ignoring the error.

Additional context

(None)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.