Skip to content

Commit

Permalink
Fix: fix missing dist within the deno package by removing dist from g…
Browse files Browse the repository at this point in the history
…itignore
  • Loading branch information
matubu committed Jul 30, 2023
1 parent fbe12cd commit 888e893
Show file tree
Hide file tree
Showing 94 changed files with 424 additions and 9 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/minify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: minify-workflow

on:
# Triggers the workflow on push events but only for the main or dev branch
push:
branches: [ main, dev ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: push

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Set up workspace
uses: actions/checkout@v2

- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 16

- name: Install dependencies
run: npm i

- name: Build the packages
run: npm run build

- name: Auto commit
run: |
git add .
git -c user.name='minify-bot' -c user.email='speed-highlight@protonmail.com' commit -m "Auto minify" || exit 0
git push
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 0 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ jobs:
registry-url: https://registry.npmjs.org/
scope: '@speed-highlight'

- name: Install dependencies
run: npm i

- name: Build packages
run: npm run build

- name: Publish to npm
run: |
npm publish --access public
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package
esbuild-*
.DS_Store
node_modules
dist
node_modules
1 change: 1 addition & 0 deletions dist/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var t={num:{type:"num",match:/(\.e?|\b)\d(e-|[\d.oxa-fA-F_])*(\.|\b)/g},str:{type:"str",match:/(["'])(\\[^]|(?!\1)[^\r\n\\])*\1?/g},strDouble:{type:"str",match:/"((?!")[^\r\n\\]|\\[^])*"?/g}};export{t as default};
8 changes: 8 additions & 0 deletions dist/detect.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Try to find the language the given code belong to
* @param code The code
* @returns The language of the code
*/
export declare function detectLanguage(
code: string
): Promise<import('.').ShjLanguage>
1 change: 1 addition & 0 deletions dist/detect.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 114 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/////////// typedef.js ///////////

/**
* Supported languages.
*/
export type ShjLanguage = 'asm'|'bash'|'bf'|'c'|'css'|'csv'|'diff'|'docker'|'git'|'go'|'html'|'http'|'ini'|'java'|'js'|'jsdoc'|'json'|'leanpub-md'|'log'|'lua'|'make'|'md'|'pl'|'plain'|'py'|'regex'|'rs'|'sql'|'todo'|'toml'|'ts'|'uri'|'xml'|'yaml';

/**
* Themes supported in the browser.
*/
export type ShjBrowserTheme = 'atom-dark'|'github-dark'|'github-dim'|'dark'|'default'|'github-light'|'visual-studio-dark';

/**
* Languages supported in the terminal.
*/
export type ShjTerminalTheme = 'default'|'atom-dark';

/**
* * `inline` inside `code` element
* * `oneline` inside `div` element and containing only one line
* * `multiline` inside `div` element
*/
export type ShjDisplayMode = 'inline'|'oneline'|'multiline';

export type ShjToken = 'deleted'|'err'|'var'|'section'|'kwd'|'class'|'cmnt'|'insert'|'type'|'func'|'bool'|'num'|'oper'|'str'|'esc';

export interface ShjOptions {
/**
* Indicates whether to hide line numbers.
* @default false
*/
hideLineNumbers: boolean;
}

/////////// Custom Types ///////////

export type ShjLanguageComponent =
| { type: string; match: RegExp }
| { extand: string }
| {
match: RegExp;
sub:
| string
| ((code: string) => {
type: string;
sub: Array<{ match: RegExp; sub: string | Promise<string> }>
});
};

export type ShjLanguageDefinition = Array<ShjLanguageComponent>;

/////////// index.js ///////////

/**
* Find the tokens in the given code and call the callback
* @param src The code
* @param lang The language of the code
* @param callback The callback function
* this function will be given
* * the text of the token
* * the type of the token
*/
export declare function tokenize<T extends string = ShjLanguage>(
src: string,
lang: T,
callback: (value: string, token: ShjToken) => void
): Promise<void>;

/**
* Highlight a string passed as argument and return it
* @example
* elm.innerHTML = await highlightText(code, 'js');
* @param src The code
* @param lang The language of the code
* @param multiline If it is multiline, it will add a wrapper for the line numbering and header
* @param Customization options
* @returns The highlighted string
*/
export declare function highlightText<T extends string = ShjLanguage>(
src: string,
lang: T,
multiline?: boolean,
opt?: ShjOptions
): Promise<string>;

/**
* Highlight a DOM element by getting the new innerHTML with highlightText
* @param elm The DOM element
* @param lang The language of the code (seaching by default on `elm` for a 'shj-lang-' class)
* @param mode The display mode (guessed by default)
* @param opt Customization options
*/
export declare function highlightElement<T extends string = ShjLanguage>(
elm: Element,
lang?: T,
mode?: ShjDisplayMode,
opt?: ShjOptions
): Promise<void>;

/**
* Call highlightElement on element with a css class starting with `shj-lang-`
* @param opt Customization options
*/
export declare function highlightAll(opt?: ShjOptions): Promise<void>;

/**
* Load a language and add it to the langs object
* @param name The name of the language
* @param module Module that has the language as the default export
*/
export declare function loadLanguage(
name: string,
module: { default: ShjLanguageDefinition }
): void;
1 change: 1 addition & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/asm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/bash.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/bf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var t=[{match:/[^\[\->+.<\]\s].*/g,sub:"todo"},{type:"func",match:/\.+/g},{type:"kwd",match:/[<>]+/g},{type:"oper",match:/[+-]+/g}];export{t as default};
1 change: 1 addition & 0 deletions dist/languages/c.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/css.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/csv.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var e=[{expand:"strDouble"},{type:"oper",match:/,/g}];export{e as default};
1 change: 1 addition & 0 deletions dist/languages/diff.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var t=[{type:"deleted",match:/^[-<].*/gm},{type:"insert",match:/^[+>].*/gm},{type:"kwd",match:/!.*/gm},{type:"section",match:/^@@.*@@$|^\d.*|^([*-+])\1\1.*/gm}];export{t as default};
1 change: 1 addition & 0 deletions dist/languages/docker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import E from"./bash.js";var L=[{type:"kwd",match:/^(FROM|RUN|CMD|LABEL|MAINTAINER|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ARG|ONBUILD|STOPSIGNAL|HEALTHCHECK|SHELL)\b/gim},...E];export{L as default};
1 change: 1 addition & 0 deletions dist/languages/git.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import t from"./diff.js";var m=[{match:/^#.*/gm,sub:"todo"},{expand:"str"},...t,{type:"func",match:/^(\$ )?git(\s.*)?$/gm},{type:"kwd",match:/^commit \w+$/gm}];export{m as default};
1 change: 1 addition & 0 deletions dist/languages/go.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/html.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/http.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/ini.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var t=[{match:/(^[ \f\t\v]*)[#;].*/gm,sub:"todo"},{type:"str",match:/.*/g},{type:"var",match:/.*(?==)/g},{type:"section",match:/^\s*\[.+\]\s*$/gm},{type:"oper",match:/=/g}];export{t as default};
1 change: 1 addition & 0 deletions dist/languages/java.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/js.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/js_template_literals.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/jsdoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import t from"./todo.js";var a=[{type:"kwd",match:/@\w+/g},{type:"class",match:/{[\w\s|<>,.@\[\]]+}/g},{type:"var",match:/\[[\w\s="']+\]/g},...t];let e="cmnt";export{a as default,e as type};
1 change: 1 addition & 0 deletions dist/languages/json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var a=[{type:"var",match:/("|')?[a-zA-Z]\w*\1(?=\s*:)/g},{expand:"str"},{expand:"num"},{type:"num",match:/\bnull\b/g},{type:"bool",match:/\b(true|false)\b/g}];export{a as default};
1 change: 1 addition & 0 deletions dist/languages/leanpub-md.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/log.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/lua.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/languages/make.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 888e893

Please sign in to comment.