Compare commits
No commits in common. 'main' and 'master' have entirely different histories.
@ -0,0 +1,19 @@
|
||||
{
|
||||
"extends": [
|
||||
"development"
|
||||
],
|
||||
"hints": {
|
||||
"axe/text-alternatives": [
|
||||
"default",
|
||||
{
|
||||
"image-alt": "off"
|
||||
}
|
||||
],
|
||||
"axe/forms": [
|
||||
"default",
|
||||
{
|
||||
"label": "off"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 304 KiB |
@ -0,0 +1,10 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Zeppelin 忽略的文件
|
||||
/ZeppelinRemoteNotebooks/
|
@ -0,0 +1 @@
|
||||
runspiders.py
|
@ -0,0 +1,7 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<ScalaCodeStyleSettings>
|
||||
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
||||
</ScalaCodeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="@localhost" uuid="4a15801a-0c11-4fc7-bb7c-408db48a4309">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.resource.type" value="Deployment" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,12 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredIdentifiers">
|
||||
<list>
|
||||
<option value="mySpider.items" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.12 (Poetry)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Poetry.iml" filepath="$PROJECT_DIR$/Poetry.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/main.go" dialect="MySQL" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="GENERAL_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Python" name="Python">
|
||||
<configuration sdkName="Python 3.12 (Poetry)" />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="Go" enabled="true" />
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.10" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Python 3.12 (Poetry) interpreter library" level="application" />
|
||||
</component>
|
||||
<component name="PyNamespacePackagesService">
|
||||
<option name="namespacePackageFolders">
|
||||
<list>
|
||||
<option value="$MODULE_DIR$/Spiders" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</module>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,31 @@
|
||||
# Define here the models for your scraped items
|
||||
#
|
||||
# See documentation in:
|
||||
# https://docs.scrapy.org/en/latest/topics/items.html
|
||||
|
||||
import scrapy
|
||||
|
||||
|
||||
class AuthorspiderItem(scrapy.Item):
|
||||
# define the fields for your item here like:
|
||||
# name = scrapy.Field()
|
||||
name = scrapy.Field()
|
||||
sinfo = scrapy.Field()
|
||||
dynasty = scrapy.Field()
|
||||
pass
|
||||
|
||||
|
||||
class FormatItem(scrapy.Item):
|
||||
title = scrapy.Field()
|
||||
author = scrapy.Field()
|
||||
dynasty = scrapy.Field()
|
||||
format = scrapy.Field()
|
||||
pass
|
||||
|
||||
|
||||
class TypeItem(scrapy.Item):
|
||||
author = scrapy.Field()
|
||||
dynasty = scrapy.Field()
|
||||
type = scrapy.Field()
|
||||
title = scrapy.Field()
|
||||
pass
|
@ -0,0 +1,95 @@
|
||||
# Scrapy settings for poetrySpider project
|
||||
#
|
||||
# For simplicity, this file contains only settings considered important or
|
||||
# commonly used. You can find more settings consulting the documentation:
|
||||
#
|
||||
# https://docs.scrapy.org/en/latest/topics/settings.html
|
||||
# https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
|
||||
# https://docs.scrapy.org/en/latest/topics/spider-middleware.html
|
||||
|
||||
BOT_NAME = "poetrySpider"
|
||||
|
||||
SPIDER_MODULES = ["poetrySpider.spiders"]
|
||||
NEWSPIDER_MODULE = "poetrySpider.spiders"
|
||||
|
||||
# Crawl responsibly by identifying yourself (and your website) on the user-agent
|
||||
#USER_AGENT = "poetrySpider (+http://www.yourdomain.com)"
|
||||
|
||||
# Obey robots.txt rules
|
||||
LOG_LEVEL = 'WARNING'
|
||||
ROBOTSTXT_OBEY = False
|
||||
|
||||
# Configure maximum concurrent requests performed by Scrapy (default: 16)
|
||||
#CONCURRENT_REQUESTS = 32
|
||||
|
||||
# Configure a delay for requests for the same website (default: 0)
|
||||
# See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay
|
||||
# See also autothrottle settings and docs
|
||||
#DOWNLOAD_DELAY = 3
|
||||
# The download delay setting will honor only one of:
|
||||
#CONCURRENT_REQUESTS_PER_DOMAIN = 16
|
||||
#CONCURRENT_REQUESTS_PER_IP = 16
|
||||
|
||||
# Disable cookies (enabled by default)
|
||||
#COOKIES_ENABLED = False
|
||||
|
||||
# Disable Telnet Console (enabled by default)
|
||||
#TELNETCONSOLE_ENABLED = False
|
||||
|
||||
# Override the default request headers:
|
||||
#DEFAULT_REQUEST_HEADERS = {
|
||||
# "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
# "Accept-Language": "en",
|
||||
#}
|
||||
|
||||
# Enable or disable spider middlewares
|
||||
# See https://docs.scrapy.org/en/latest/topics/spider-middleware.html
|
||||
#SPIDER_MIDDLEWARES = {
|
||||
# "poetrySpider.middlewares.PoetryspiderSpiderMiddleware": 543,
|
||||
#}
|
||||
|
||||
# Enable or disable downloader middlewares
|
||||
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
|
||||
#DOWNLOADER_MIDDLEWARES = {
|
||||
# "poetrySpider.middlewares.PoetryspiderDownloaderMiddleware": 543,
|
||||
#}
|
||||
|
||||
# Enable or disable extensions
|
||||
# See https://docs.scrapy.org/en/latest/topics/extensions.html
|
||||
#EXTENSIONS = {
|
||||
# "scrapy.extensions.telnet.TelnetConsole": None,
|
||||
#}
|
||||
|
||||
# Configure item pipelines
|
||||
# See https://docs.scrapy.org/en/latest/topics/item-pipeline.html
|
||||
ITEM_PIPELINES = {
|
||||
"poetrySpider.pipelines.AuthorsSpiderPipeline": 300,
|
||||
"poetrySpider.pipelines.FormatSpiderPipeline": 301,
|
||||
"poetrySpider.pipelines.TypeSpiderPipeline": 302,
|
||||
}
|
||||
|
||||
# Enable and configure the AutoThrottle extension (disabled by default)
|
||||
# See https://docs.scrapy.org/en/latest/topics/autothrottle.html
|
||||
#AUTOTHROTTLE_ENABLED = True
|
||||
# The initial download delay
|
||||
#AUTOTHROTTLE_START_DELAY = 5
|
||||
# The maximum download delay to be set in case of high latencies
|
||||
#AUTOTHROTTLE_MAX_DELAY = 60
|
||||
# The average number of requests Scrapy should be sending in parallel to
|
||||
# each remote server
|
||||
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
|
||||
# Enable showing throttling stats for every response received:
|
||||
#AUTOTHROTTLE_DEBUG = False
|
||||
|
||||
# Enable and configure HTTP caching (disabled by default)
|
||||
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
|
||||
#HTTPCACHE_ENABLED = True
|
||||
#HTTPCACHE_EXPIRATION_SECS = 0
|
||||
#HTTPCACHE_DIR = "httpcache"
|
||||
#HTTPCACHE_IGNORE_HTTP_CODES = []
|
||||
#HTTPCACHE_STORAGE = "scrapy.extensions.httpcache.FilesystemCacheStorage"
|
||||
|
||||
# Set settings whose default value is deprecated to a future-proof value
|
||||
REQUEST_FINGERPRINTER_IMPLEMENTATION = "2.7"
|
||||
# TWISTED_REACTOR = "twisted.internet.asyncioreactor.AsyncioSelectorReactor"
|
||||
FEED_EXPORT_ENCODING = "utf-8"
|
@ -0,0 +1,4 @@
|
||||
# This package will contain the spiders of your Scrapy project
|
||||
#
|
||||
# Please refer to the documentation for information on how to create and manage
|
||||
# your spiders.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,116 @@
|
||||
import scrapy
|
||||
from Spiders.poetrySpider.poetrySpider import items
|
||||
from Spiders.poetrySpider.poetrySpider import pipelines
|
||||
import scrapy.spiders
|
||||
from scrapy.utils.project import get_project_settings
|
||||
|
||||
|
||||
# install_reactor("twisted.internet.asyncioreactor.AsyncioSelectorReactor")
|
||||
|
||||
|
||||
class AuthorsSpider(scrapy.Spider):
|
||||
name = "poetry"
|
||||
allowed_domains = ["so.gushiwen.cn"]
|
||||
start_urls = ["https://so.gushiwen.cn/authors/"]
|
||||
custom_settings = {
|
||||
'ITEM_PIPELINES': {"poetrySpider.pipelines.AuthorsSpiderPipeline": 300}
|
||||
}
|
||||
|
||||
def parse(self, response, *args, **kwargs):
|
||||
dynastyurl = response.xpath(
|
||||
"//*[@id=\"html\"]/body/div[2]/div[1]/div[1]/div[2]/div[2]/a/@href").extract()
|
||||
# dynasty = response.xpath(
|
||||
# "//*[@id=\"html\"]/body/div[2]/div[1]/div[1]/div[2]/div[2]/a/text()").extract()
|
||||
|
||||
for url in dynastyurl:
|
||||
nexturl = "https://so.gushiwen.cn" + url
|
||||
yield scrapy.Request(url=nexturl, callback=self.authors)
|
||||
|
||||
def authors(self, response):
|
||||
dynasty = response.xpath("//*[@id=\"html\"]/body/div[2]/div[1]/div[1]/div[1]/h1/text()").extract_first()
|
||||
name = response.xpath("//*[@id=\"leftZhankai\"]/div[@class=\"sonspic\"]/div[1]/p[1]/a[1]/b/text()").extract()
|
||||
# sinfo = response.xpath("//*[@id=\"leftZhankai\"]/div[2]/div[1]/p[2]/text()").extract_first()
|
||||
sinfo = response.xpath('//*[@id="leftZhankai"]/div[@class="sonspic"]/div[1]/p[2]/text()').extract()
|
||||
# poetrynum = response.xpath(
|
||||
# "//*[@id=\"leftZhankai\"]/div[@class=\"sonspic\"]/div[1]/p[2]/a[1]/text()").extract()
|
||||
|
||||
if response.xpath("//*[@id=\"FromPage\"]/div/a[1]/@href").extract_first():
|
||||
nexturl = "https://so.gushiwen.cn" + response.xpath(
|
||||
"//*[@id=\"FromPage\"]/div/a[1]/@href").extract_first()
|
||||
yield scrapy.Request(url=nexturl, callback=self.authors)
|
||||
|
||||
author = items.AuthorspiderItem(name=name, dynasty=dynasty, sinfo=sinfo)
|
||||
yield author
|
||||
pipelines.AuthorsSpiderPipeline()
|
||||
|
||||
|
||||
class FormatSpider(scrapy.Spider):
|
||||
name = "poetryFormat"
|
||||
allowed_domains = ["so.gushiwen.cn"]
|
||||
start_urls = ["https://so.gushiwen.cn/shiwens/"]
|
||||
custom_settings = {
|
||||
'ITEM_PIPELINES': {"poetrySpider.pipelines.FormatSpiderPipeline": 301}
|
||||
}
|
||||
|
||||
def parse(self, response, *args, **kwargs):
|
||||
format = response.xpath(
|
||||
"//*[@id=\"html\"]/body/div[2]/div[1]/div[1]/div[5]/div[2]/a/@href").extract()
|
||||
|
||||
for url in format:
|
||||
nexturl = "https://so.gushiwen.cn" + url
|
||||
yield scrapy.Request(url=nexturl, callback=self.format)
|
||||
|
||||
def format(self, response):
|
||||
format = response.xpath(
|
||||
"//*[@id=\"html\"]/body/div[2]/div[1]/div[1]/div[1]/h1/text()").extract_first()
|
||||
title = response.xpath(
|
||||
"//*[@id=\"leftZhankai\"]/div[@class=\"sons\"]/div[1]/div[2]/p[1]/a/b/text()").extract()
|
||||
author = response.xpath(
|
||||
"//*[@id=\"leftZhankai\"]/div[@class=\"sons\"]/div[1]/div[2]/p[2]/a[1]/text()").extract()
|
||||
dynasty = response.xpath(
|
||||
"//*[@id=\"leftZhankai\"]/div[@class=\"sons\"]/div[1]/div[2]/p[2]/a[2]/text()").extract()
|
||||
# message = response.xpath(
|
||||
# "normalize-space(//*[@id=\"leftZhankai\"]/div[@class=\"sons\"]/div[1]/div[2]/div/text())").extract_first()
|
||||
|
||||
if response.xpath("//*[@id=\"FromPage\"]/div/a[1]/@href").extract_first():
|
||||
nexturl = "https://so.gushiwen.cn" + response.xpath(
|
||||
"//*[@id=\"FromPage\"]/div/a[1]/@href").extract_first()
|
||||
yield scrapy.Request(url=nexturl, callback=self.format)
|
||||
|
||||
item = items.FormatItem(
|
||||
format=format, title=title, author=author, dynasty=dynasty)
|
||||
yield item
|
||||
|
||||
|
||||
class TypeSpider(scrapy.Spider):
|
||||
name = "poetryType"
|
||||
allowed_domains = ["so.gushiwen.cn"]
|
||||
start_urls = ["https://so.gushiwen.cn/shiwens/"]
|
||||
custom_settings = {
|
||||
'ITEM_PIPELINES': {"poetrySpider.pipelines.TypeSpiderPipeline": 302}
|
||||
}
|
||||
|
||||
def parse(self, response, *args, **kwargs):
|
||||
typeurl = response.xpath("//*[@id=\"type1\"]/div[2]/a/@href").extract()[3:57]
|
||||
|
||||
for url in typeurl:
|
||||
nexturl = "https://so.gushiwen.cn" + url
|
||||
yield scrapy.Request(url=nexturl, callback=self.type)
|
||||
|
||||
def type(self, response):
|
||||
type = response.xpath("//*[@id=\"html\"]/body/div[2]/div[1]/div[1]/div[1]/h1/text()").extract_first()
|
||||
title = response.xpath(
|
||||
"//*[@id=\"leftZhankai\"]/div[@class=\"sons\"]/div[1]/div[2]/p[1]/a/b/text()").extract()
|
||||
author = response.xpath(
|
||||
"//*[@id=\"leftZhankai\"]/div[@class=\"sons\"]/div[1]/div[2]/p[2]/a[1]/text()").extract()
|
||||
dynasty = response.xpath(
|
||||
"//*[@id=\"leftZhankai\"]/div[@class=\"sons\"]/div[1]/div[2]/p[2]/a[2]/text()").extract()
|
||||
|
||||
if response.xpath("//*[@id=\"FromPage\"]/div/a[1]/@href").extract_first():
|
||||
nexturl = "https://so.gushiwen.cn" + response.xpath(
|
||||
"//*[@id=\"FromPage\"]/div/a[1]/@href").extract_first()
|
||||
yield scrapy.Request(url=nexturl, callback=self.type)
|
||||
|
||||
item = items.TypeItem(
|
||||
type=type, title=title, author=author, dynasty=dynasty)
|
||||
yield item
|
@ -0,0 +1,50 @@
|
||||
import queue
|
||||
|
||||
from scrapy.crawler import CrawlerRunner
|
||||
from scrapy.crawler import CrawlerProcess
|
||||
from scrapy.utils.log import configure_logging
|
||||
from scrapy.utils.project import get_project_settings
|
||||
from twisted.internet import reactor, defer
|
||||
|
||||
from multiprocessing import Process, Queue
|
||||
from Spiders.poetrySpider.poetrySpider.spiders import poetry
|
||||
|
||||
configure_logging()
|
||||
settings = poetry.get_project_settings()
|
||||
|
||||
|
||||
# process = CrawlerProcess(settings)
|
||||
#
|
||||
# process.crawl(poetry.AuthorsSpider)
|
||||
|
||||
# process.start()
|
||||
def f(q):
|
||||
try:
|
||||
runner = CrawlerRunner(settings)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def crawl():
|
||||
yield runner.crawl(poetry.AuthorsSpider)
|
||||
yield runner.crawl(poetry.FormatSpider)
|
||||
yield runner.crawl(poetry.TypeSpider)
|
||||
reactor.stop()
|
||||
|
||||
crawl()
|
||||
reactor.run()
|
||||
q.put(None)
|
||||
except Exception as e:
|
||||
q.put(e)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
q = Queue()
|
||||
p = Process(target=f, args=(q,))
|
||||
p.start()
|
||||
result = q.get()
|
||||
p.join()
|
||||
|
||||
if result is not None:
|
||||
raise result
|
||||
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
# Automatically created by: scrapy startproject
|
||||
#
|
||||
# For more information about the [deploy] section see:
|
||||
# https://scrapyd.readthedocs.io/en/latest/deploy.html
|
||||
|
||||
[settings]
|
||||
default = poetrySpider.settings
|
||||
|
||||
[deploy]
|
||||
#url = http://localhost:6800/
|
||||
project = poetrySpider
|
@ -0,0 +1,50 @@
|
||||
module Poetry
|
||||
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/gin-contrib/cors v1.7.2
|
||||
github.com/gin-gonic/gin v1.10.0
|
||||
github.com/go-sql-driver/mysql v1.8.1
|
||||
github.com/jinzhu/gorm v1.9.16
|
||||
github.com/qwxingzhe/go-object-storage v0.0.0-20211008003114-a2b816ceeacf
|
||||
golang.org/x/net v0.26.0
|
||||
gorm.io/driver/mysql v1.5.7
|
||||
)
|
||||
|
||||
require (
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/bytedance/sonic v1.11.6 // indirect
|
||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||
github.com/qiniu/go-sdk/v7 v7.9.8 // indirect
|
||||
github.com/qwxingzhe/go-file-type v0.0.0-20210904033909-9eb7f61e24f1 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
golang.org/x/arch v0.8.0 // indirect
|
||||
golang.org/x/crypto v0.24.0 // indirect
|
||||
golang.org/x/sync v0.7.0 // indirect
|
||||
golang.org/x/sys v0.21.0 // indirect
|
||||
golang.org/x/text v0.16.0 // indirect
|
||||
google.golang.org/protobuf v1.34.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gorm.io/gorm v1.25.7 // indirect
|
||||
)
|
@ -0,0 +1,150 @@
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
|
||||
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
|
||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd h1:83Wprp6ROGeiHFAP8WJdI2RoxALQYgdllERc3N5N2DM=
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
|
||||
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
|
||||
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/gin-contrib/cors v1.7.2 h1:oLDHxdg8W/XDoN/8zamqk/Drgt4oVZDvaV0YmvVICQw=
|
||||
github.com/gin-contrib/cors v1.7.2/go.mod h1:SUJVARKgQ40dmrzgXEVxj2m7Ig1v1qIboQkPDTQ9t2E=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
||||
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
|
||||
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
|
||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o=
|
||||
github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
|
||||
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA=
|
||||
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/qiniu/go-sdk/v7 v7.9.8 h1:QE3Nj+bj+ZHGWed2L+nuOKGhtJgXqdMbSaC69YZ05L8=
|
||||
github.com/qiniu/go-sdk/v7 v7.9.8/go.mod h1:Eeqk1/Km3f1MuLUUkg2JCSg/dVkydKbBvEdJJqFgn9g=
|
||||
github.com/qwxingzhe/go-file-type v0.0.0-20210904033909-9eb7f61e24f1 h1:Y1q/Kv60666A8DGWBlUIUjwlXmu1dgypH4PVwSf3tUE=
|
||||
github.com/qwxingzhe/go-file-type v0.0.0-20210904033909-9eb7f61e24f1/go.mod h1:Bpduqz+NKm2imxr5InLA61iSgVvXwIbB3WIk0+gYXHY=
|
||||
github.com/qwxingzhe/go-object-storage v0.0.0-20211008003114-a2b816ceeacf h1:O83ZO3ZTJp8RI/AwQnRLAPOfPZsQg45r0w3cROKEIhU=
|
||||
github.com/qwxingzhe/go-object-storage v0.0.0-20211008003114-a2b816ceeacf/go.mod h1:VHniFqA9a4TNxS5htWLLkwuXgUMAsRqNC6WNrm6wfMU=
|
||||
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
|
||||
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
|
||||
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
|
||||
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
|
||||
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
|
||||
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
|
||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
|
||||
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
|
||||
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
||||
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo=
|
||||
gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
|
||||
gorm.io/gorm v1.25.7 h1:VsD6acwRjz2zFxGO50gPO6AkNs7KKnvfzUjHQhZDz/A=
|
||||
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
@ -0,0 +1,180 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "database/sql"
|
||||
"fmt"
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"github.com/jinzhu/gorm"
|
||||
_ "gorm.io/driver/mysql"
|
||||
"math/rand"
|
||||
_ "os"
|
||||
)
|
||||
|
||||
type Author struct {
|
||||
gorm.Model
|
||||
Name string`gorm:"varchar(100);not null"`
|
||||
Dynasty string`gorm:"varchar(100);not null"`
|
||||
}
|
||||
|
||||
type Format struct {
|
||||
gorm.Model
|
||||
Title string`gorm:"varchar(100);not null"`
|
||||
Author string `gorm:"varchar(100);not null"`
|
||||
Format string `gorm:"varchar(100);not null"`
|
||||
Dynasty string `gorm:"varchar(100);not null"`
|
||||
}
|
||||
|
||||
type Type struct {
|
||||
gorm.Model
|
||||
Title string`gorm:"varchar(100);not null"`
|
||||
Author string `gorm:"varchar(100);not null"`
|
||||
Type string `gorm:"varchar(100);not null"`
|
||||
Dynasty string `gorm:"varchar(100);not null"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
//获取初始化的数据库
|
||||
db := InitDB()
|
||||
//延迟关闭数据库
|
||||
defer db.Close()
|
||||
|
||||
//创建一个默认的路由引擎
|
||||
r := gin.Default()
|
||||
|
||||
config := cors.DefaultConfig()
|
||||
config.AllowOrigins = []string{"*"}
|
||||
r.Use(cors.New(config))
|
||||
|
||||
|
||||
r.POST("/poetry", func(c *gin.Context) {
|
||||
var format[] Format
|
||||
name := c.PostForm("name")
|
||||
db.Where("author =?", name).Find(&format)
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"message":format,
|
||||
})
|
||||
})
|
||||
|
||||
//sql统计一个诗人不同风格诗的数量
|
||||
r.POST("/authortypenum", func(c *gin.Context) {
|
||||
|
||||
type TypeCount struct {
|
||||
Type string
|
||||
Count int
|
||||
}
|
||||
var types []TypeCount
|
||||
name := c.PostForm("name")
|
||||
//db.Where("author =?", name).Find(&types)
|
||||
db.Raw(
|
||||
"select type,count(*) as count from cauc.types where author = ? group by type order by count desc limit 6",
|
||||
name).Scan(&types)
|
||||
|
||||
result := make(map[string]int)
|
||||
for _, tc := range types {
|
||||
result[tc.Type] = tc.Count
|
||||
}
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"message": result,
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
//sql统计某个朝代的诗人数量
|
||||
r.POST("/dynastyauthornum", func(c *gin.Context) {
|
||||
type DynastyCount struct {
|
||||
Dynasty string
|
||||
Count int
|
||||
}
|
||||
var dynastys []DynastyCount
|
||||
db.Raw(
|
||||
"select dynasty,count(*) as count from cauc.authors group by dynasty").Scan(&dynastys)
|
||||
|
||||
result := make(map[string]int)
|
||||
for _, dc := range dynastys {
|
||||
result[dc.Dynasty] = dc.Count
|
||||
}
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"message": result,
|
||||
})
|
||||
})
|
||||
|
||||
//统计诗词每个类型的数量
|
||||
r.POST("/typepeotrynum", func(c *gin.Context) {
|
||||
type TypeCount struct {
|
||||
Type string
|
||||
Count int
|
||||
}
|
||||
var types []TypeCount
|
||||
|
||||
db.Raw(
|
||||
"select type,count(*) as count from cauc.types group by type order by count desc").Scan(&types)
|
||||
|
||||
result := make(map[string]int)
|
||||
var type1 []TypeCount
|
||||
for i := 0; i < 6; i++ {
|
||||
type1 = append(type1, types[rand.Intn(len(types))])
|
||||
}
|
||||
for _, tc := range type1 {
|
||||
result[tc.Type] = tc.Count
|
||||
}
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"message": result,
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
//统计某个朝代诗词的形式数量
|
||||
r.POST("/dynastyformatnum", func(c *gin.Context) {
|
||||
type FormatCount struct {
|
||||
Format string
|
||||
Count int
|
||||
}
|
||||
var formats []FormatCount
|
||||
dynasty := c.PostForm("dynasty")
|
||||
db.Raw(
|
||||
"select format,count(*) as count from cauc.formats where dynasty = ? group by format order by count desc",
|
||||
dynasty).Scan(&formats)
|
||||
|
||||
result := make(map[string]int)
|
||||
for _, fc := range formats {
|
||||
result[fc.Format] = fc.Count
|
||||
}
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"message": result,
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
//在88800端口启动服务
|
||||
panic(r.Run(":8880"))
|
||||
}
|
||||
|
||||
func InitDB() *gorm.DB {
|
||||
driverName := "mysql"
|
||||
host := "127.0.0.1"
|
||||
port := "3306"
|
||||
database := "cauc"
|
||||
username := "root"
|
||||
password := "root"
|
||||
charset := "utf8"
|
||||
args := fmt.Sprintf("%s:%s@(%s:%s)/%s?charset=%s&parseTime=true",
|
||||
username,
|
||||
password,
|
||||
host,
|
||||
port,
|
||||
database,
|
||||
charset)
|
||||
|
||||
db, _ := gorm.Open(driverName, args)
|
||||
|
||||
return db
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
package run
|
||||
|
||||
|
Binary file not shown.
@ -0,0 +1,41 @@
|
||||
module mode
|
||||
|
||||
go 1.21.5
|
||||
|
||||
require (
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/bytedance/sonic v1.11.6 // indirect
|
||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/gin-contrib/cors v1.7.2 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/gin-gonic/gin v1.9.1 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/jinzhu/gorm v1.9.16 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.1 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
golang.org/x/arch v0.7.0 // indirect
|
||||
golang.org/x/crypto v0.22.0 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/protobuf v1.34.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gorm.io/driver/mysql v1.5.7 // indirect
|
||||
gorm.io/gorm v1.25.7 // indirect
|
||||
)
|
@ -0,0 +1,116 @@
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
|
||||
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
|
||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
|
||||
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/gin-contrib/cors v1.7.2 h1:oLDHxdg8W/XDoN/8zamqk/Drgt4oVZDvaV0YmvVICQw=
|
||||
github.com/gin-contrib/cors v1.7.2/go.mod h1:SUJVARKgQ40dmrzgXEVxj2m7Ig1v1qIboQkPDTQ9t2E=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
|
||||
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
||||
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
|
||||
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o=
|
||||
github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/pelletier/go-toml/v2 v2.2.1 h1:9TA9+T8+8CUCO2+WYnDLCgrYi9+omqKXyjDtosvtEhg=
|
||||
github.com/pelletier/go-toml/v2 v2.2.1/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc=
|
||||
golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
|
||||
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
|
||||
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
|
||||
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
|
||||
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4=
|
||||
google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo=
|
||||
gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
|
||||
gorm.io/gorm v1.25.7 h1:VsD6acwRjz2zFxGO50gPO6AkNs7KKnvfzUjHQhZDz/A=
|
||||
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
@ -0,0 +1,218 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "database/sql"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
_ "os"
|
||||
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"github.com/jinzhu/gorm"
|
||||
_ "gorm.io/driver/mysql"
|
||||
)
|
||||
|
||||
type Author struct {
|
||||
gorm.Model
|
||||
Name string `gorm:"varchar(100);not null"`
|
||||
Dynasty string `gorm:"varchar(100);not null"`
|
||||
}
|
||||
|
||||
type Format struct {
|
||||
gorm.Model
|
||||
Title string `gorm:"varchar(100);not null"`
|
||||
Author string `gorm:"varchar(100);not null"`
|
||||
Format string `gorm:"varchar(100);not null"`
|
||||
Dynasty string `gorm:"varchar(100);not null"`
|
||||
}
|
||||
|
||||
type Type struct {
|
||||
gorm.Model
|
||||
Title string `gorm:"varchar(100);not null"`
|
||||
Author string `gorm:"varchar(100);not null"`
|
||||
Type string `gorm:"varchar(100);not null"`
|
||||
Dynasty string `gorm:"varchar(100);not null"`
|
||||
}
|
||||
|
||||
type Mingju struct {
|
||||
gorm.Model
|
||||
Lines string `gorm:"varchar(256);not null"`
|
||||
Author string `gorm:"varchar(100);not null"`
|
||||
Sources string `gorm:"varchar(100);not null"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
//获取初始化的数据库
|
||||
db := InitDB()
|
||||
//延迟关闭数据库
|
||||
defer db.Close()
|
||||
|
||||
//创建一个默认的路由引擎
|
||||
r := gin.Default()
|
||||
|
||||
config := cors.DefaultConfig()
|
||||
config.AllowOrigins = []string{"*"}
|
||||
r.Use(cors.New(config))
|
||||
|
||||
r.POST("/poetry", func(c *gin.Context) {
|
||||
var format []Format
|
||||
name := c.PostForm("name")
|
||||
db.Where("author =?", name).Find(&format)
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"message": format,
|
||||
})
|
||||
})
|
||||
|
||||
//sql统计一个诗人不同风格诗的数量
|
||||
r.POST("/authortypenum", func(c *gin.Context) {
|
||||
|
||||
type TypeCount struct {
|
||||
Type string
|
||||
Count int
|
||||
}
|
||||
var types []TypeCount
|
||||
name := c.PostForm("name")
|
||||
//db.Where("author =?", name).Find(&types)
|
||||
db.Raw(
|
||||
"select type,count(*) as count from cauc.types where author = ? group by type order by count desc limit 6",
|
||||
name).Scan(&types)
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"message": types,
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
//sql统计某个朝代的诗人数量
|
||||
r.POST("/dynastyauthornum", func(c *gin.Context) {
|
||||
type DynastyCount struct {
|
||||
Dynasty string
|
||||
Count int
|
||||
}
|
||||
var dynastys []DynastyCount
|
||||
db.Raw(
|
||||
"select dynasty,count(*) as count from cauc.authors group by dynasty").Scan(&dynastys)
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"message": dynastys,
|
||||
})
|
||||
})
|
||||
|
||||
//统计诗词每个类型的数量
|
||||
r.POST("/typepeotrynum", func(c *gin.Context) {
|
||||
type TypeCount struct {
|
||||
Type string
|
||||
Count int
|
||||
}
|
||||
var types []TypeCount
|
||||
|
||||
db.Raw(
|
||||
"select type,count(*) as count from cauc.types group by type order by count desc").Scan(&types)
|
||||
|
||||
var type1 []TypeCount
|
||||
for i := 0; i < 6; i++ {
|
||||
type1 = append(type1, types[rand.Intn(len(types))])
|
||||
}
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"message": type1,
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
//统计某个朝代诗词的形式数量
|
||||
r.POST("/dynastyformatnum", func(c *gin.Context) {
|
||||
type FormatCount struct {
|
||||
Format string
|
||||
Count int
|
||||
}
|
||||
var formats []FormatCount
|
||||
var dynastys = []string{"先秦", "两汉", "魏晋", "南北朝", "唐代", "五代", "宋代", "金朝", "元代", "明代", "清代"}
|
||||
|
||||
dynasty := dynastys[rand.Intn(len(dynastys))]
|
||||
|
||||
db.Raw(
|
||||
"select format,count(*) as count from cauc.formats where dynasty = ? group by format order by count desc",
|
||||
dynasty).Scan(&formats)
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"message": formats,
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
//随机从数据库中返回4个名句
|
||||
r.POST("/randommingju", func(c *gin.Context) {
|
||||
type Result struct {
|
||||
Mingju string
|
||||
Author string
|
||||
}
|
||||
var mingjus []Mingju
|
||||
|
||||
name := c.PostForm("name")
|
||||
db.Raw(
|
||||
"select * from cauc.mingjus where author=? order by rand() limit 4", name).Scan(&mingjus)
|
||||
|
||||
var results []Result
|
||||
for _, fc := range mingjus {
|
||||
results = append(results, Result{Mingju: fc.Lines, Author: fc.Author + "——" + fc.Sources})
|
||||
}
|
||||
c.JSON(200, gin.H{
|
||||
"message": results,
|
||||
})
|
||||
})
|
||||
r.POST("/formatnum", func(c *gin.Context) {
|
||||
type FormatCount struct {
|
||||
Format string
|
||||
Count int
|
||||
}
|
||||
var formats []FormatCount
|
||||
db.Raw(
|
||||
"select format,count(*) as count from cauc.formats group by format order by count desc",
|
||||
).Scan(&formats)
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"message": formats,
|
||||
})
|
||||
})
|
||||
//统计诗词总数量
|
||||
r.POST("/poetrynum", func(c *gin.Context) {
|
||||
type Count struct {
|
||||
Count int
|
||||
}
|
||||
var count Count
|
||||
db.Raw(
|
||||
"select count(*) as count from cauc.types").Scan(&count)
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"message": count,
|
||||
})
|
||||
})
|
||||
//在88800端口启动服务
|
||||
panic(r.Run(":8880"))
|
||||
}
|
||||
|
||||
func InitDB() *gorm.DB {
|
||||
driverName := "mysql"
|
||||
host := "127.0.0.1"
|
||||
port := "3306"
|
||||
database := "cauc"
|
||||
username := "root"
|
||||
password := "240011@rbb"
|
||||
charset := "utf8"
|
||||
args := fmt.Sprintf("%s:%s@(%s:%s)/%s?charset=%s&parseTime=true",
|
||||
username,
|
||||
password,
|
||||
host,
|
||||
port,
|
||||
database,
|
||||
charset)
|
||||
|
||||
db, _ := gorm.Open(driverName, args)
|
||||
|
||||
return db
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "poem",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/echarts": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.0.2.tgz",
|
||||
"integrity": "sha512-En0VYpc96nw2/2AZoBWPHsGi471zMublttj50kfFpYAeR4geup0Tj9iVgEXh7QYZFPnRiruDJEjcB5PXZ+BYzQ==",
|
||||
"dependencies": {
|
||||
"tslib": "2.0.3",
|
||||
"zrender": "5.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
|
||||
"integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
|
||||
},
|
||||
"node_modules/zrender": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/zrender/-/zrender-5.0.4.tgz",
|
||||
"integrity": "sha512-DJpy0yrHYY5CuH6vhb9IINWbjvBUe/56J8aH86Jb7O8rRPAYZ3M2E469Qf5B3EOIfM3o3aUrO5edRQfLJ+l1Qw==",
|
||||
"dependencies": {
|
||||
"tslib": "2.0.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
github:
|
||||
description: Apache ECharts is a powerful, interactive charting and data visualization library for browser
|
||||
homepage: https://echarts.apache.org
|
||||
labels:
|
||||
- echarts
|
||||
- data-visualization
|
||||
- charts
|
||||
- charting-library
|
||||
- visualization
|
||||
- apache
|
||||
- data-viz
|
||||
- canvas
|
||||
- svg
|
@ -0,0 +1,38 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[**.js]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[**.css]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[**.less]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[**.styl]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[**.html]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[**.tpl]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[**.json]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
@ -0,0 +1,16 @@
|
||||
/dist
|
||||
/node_modules
|
||||
/build
|
||||
/i18n
|
||||
/extension-esm
|
||||
/extension
|
||||
/lib
|
||||
/esm
|
||||
/index.js
|
||||
/index.blank.js
|
||||
/index.common.js
|
||||
/index.simple.js
|
||||
/echarts.all.js
|
||||
/echarts.blank.js
|
||||
/echarts.common.js
|
||||
/echarts.simple.js
|
@ -0,0 +1,229 @@
|
||||
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# Note:
|
||||
# If eslint does not work in VSCode, please check:
|
||||
# (1) Whether "@typescript-eslint/eslint-plugin" and "@typescript-eslint/parser"
|
||||
# are npm installed locally. Should better in the same version.
|
||||
# (2) Whether "VSCode ESlint extension" is installed.
|
||||
# (3) If the project folder is not the root folder of your working space, please
|
||||
# config the "VSCode ESlint extension" in "settings":
|
||||
# ```json
|
||||
# "eslint.workingDirectories": [{"mode": "auto"}]
|
||||
# ```
|
||||
# Note that it should be "workingDirectories" rather than "WorkingDirectories".
|
||||
|
||||
root: true
|
||||
rules:
|
||||
# Check the rules in: node_modules/@typescript-eslint/eslint-plugin/README.md
|
||||
no-console:
|
||||
- 2
|
||||
-
|
||||
allow:
|
||||
- "warn"
|
||||
- "error"
|
||||
prefer-const: 1
|
||||
no-constant-condition: 0
|
||||
comma-dangle: 2
|
||||
no-debugger: 2
|
||||
no-dupe-keys: 2
|
||||
no-empty-character-class: 2
|
||||
no-ex-assign: 2
|
||||
no-extra-boolean-cast: 0
|
||||
no-func-assign: 2
|
||||
no-inner-declarations: 2
|
||||
no-invalid-regexp: 2
|
||||
no-negated-in-lhs: 2
|
||||
no-obj-calls: 2
|
||||
no-sparse-arrays: 2
|
||||
no-unreachable: 2
|
||||
use-isnan: 2
|
||||
valid-typeof: 2
|
||||
block-scoped-var: 2
|
||||
curly:
|
||||
- 2
|
||||
- "all"
|
||||
eqeqeq:
|
||||
- 2
|
||||
- "allow-null"
|
||||
guard-for-in: 2
|
||||
no-else-return: 0
|
||||
no-labels:
|
||||
- 2
|
||||
-
|
||||
allowLoop: true
|
||||
no-eval: 2
|
||||
no-extend-native: 2
|
||||
no-extra-bind: 0
|
||||
no-implied-eval: 2
|
||||
no-iterator: 2
|
||||
no-irregular-whitespace: 2
|
||||
no-lone-blocks: 2
|
||||
no-loop-func: 2
|
||||
no-multi-str: 2
|
||||
no-native-reassign: 2
|
||||
no-new-wrappers: 2
|
||||
no-octal: 2
|
||||
no-octal-escape: 2
|
||||
no-proto: 2
|
||||
no-self-compare: 2
|
||||
no-unneeded-ternary: 2
|
||||
no-with: 2
|
||||
radix: 2
|
||||
wrap-iife:
|
||||
- 2
|
||||
- "any"
|
||||
no-delete-var: 2
|
||||
no-dupe-args: 2
|
||||
no-duplicate-case: 2
|
||||
no-label-var: 2
|
||||
no-shadow-restricted-names: 2
|
||||
no-undef: 2
|
||||
no-undef-init: 2
|
||||
"no-use-before-define": "off"
|
||||
"@typescript-eslint/no-use-before-define": 0
|
||||
brace-style:
|
||||
- 2
|
||||
- "stroustrup"
|
||||
- {}
|
||||
comma-spacing:
|
||||
- 2
|
||||
-
|
||||
before: false
|
||||
after: true
|
||||
comma-style:
|
||||
- 2
|
||||
- "last"
|
||||
new-parens: 2
|
||||
no-array-constructor: 2
|
||||
no-multi-spaces:
|
||||
- 1
|
||||
-
|
||||
ignoreEOLComments: true
|
||||
exceptions:
|
||||
Property: true
|
||||
no-new-object: 2
|
||||
no-trailing-spaces: 2
|
||||
no-extra-parens:
|
||||
- 2
|
||||
- "functions"
|
||||
no-mixed-spaces-and-tabs: 2
|
||||
one-var:
|
||||
- 2
|
||||
- "never"
|
||||
operator-linebreak:
|
||||
- 2
|
||||
- "before"
|
||||
-
|
||||
overrides:
|
||||
"=": "after"
|
||||
"quotes": "off"
|
||||
"@typescript-eslint/quotes":
|
||||
- 2
|
||||
- "single"
|
||||
"semi": "off"
|
||||
"@typescript-eslint/semi":
|
||||
- 2
|
||||
- "always"
|
||||
semi-spacing: 2
|
||||
keyword-spacing: 2
|
||||
key-spacing:
|
||||
- 2
|
||||
-
|
||||
beforeColon: false
|
||||
afterColon: true
|
||||
"space-before-function-paren": "off"
|
||||
"@typescript-eslint/space-before-function-paren":
|
||||
- 2
|
||||
-
|
||||
anonymous: "always"
|
||||
named: "never"
|
||||
space-before-blocks:
|
||||
- 2
|
||||
- "always"
|
||||
computed-property-spacing:
|
||||
- 2
|
||||
- "never"
|
||||
space-in-parens:
|
||||
- 2
|
||||
- "never"
|
||||
space-unary-ops: 2
|
||||
spaced-comment: 0
|
||||
|
||||
max-nested-callbacks:
|
||||
- 1
|
||||
- 5
|
||||
max-depth:
|
||||
- 1
|
||||
- 6
|
||||
max-len:
|
||||
- 2
|
||||
- 120
|
||||
- 4
|
||||
-
|
||||
ignoreUrls: true
|
||||
ignoreComments: true
|
||||
max-params:
|
||||
- 1
|
||||
- 15
|
||||
|
||||
space-infix-ops: 2
|
||||
dot-notation:
|
||||
- 2
|
||||
-
|
||||
allowKeywords: true
|
||||
allowPattern: "^catch$"
|
||||
|
||||
arrow-spacing: 2
|
||||
constructor-super: 2
|
||||
no-confusing-arrow:
|
||||
- 2
|
||||
-
|
||||
allowParens: true
|
||||
no-class-assign: 2
|
||||
no-const-assign: 2
|
||||
# no-dupe-class-members: 2
|
||||
no-this-before-super: 0
|
||||
no-var: 2
|
||||
no-duplicate-imports: 2
|
||||
prefer-rest-params: 0
|
||||
unicode-bom: 2
|
||||
max-statements-per-line: 2
|
||||
|
||||
no-useless-constructor: 0
|
||||
|
||||
"func-call-spacing": "off"
|
||||
"@typescript-eslint/func-call-spacing": "error"
|
||||
|
||||
"no-unused-vars": "off"
|
||||
"@typescript-eslint/no-unused-vars":
|
||||
- 1
|
||||
-
|
||||
vars: "local"
|
||||
args: "none"
|
||||
# Avoid dangerous usage of globals.
|
||||
"no-restricted-globals":
|
||||
- 2
|
||||
- "event"
|
||||
- "name"
|
||||
- "length"
|
||||
- "orientation"
|
||||
- "top"
|
||||
- "parent"
|
||||
- "location"
|
||||
- "closed"
|
@ -0,0 +1,3 @@
|
||||
# for pull request size bot
|
||||
# excludes all files from test directory
|
||||
test/** linguist-generated=true
|
@ -0,0 +1,10 @@
|
||||
<!--
|
||||
Please Use https://ecomfe.github.io/echarts-issue-helper to create the issue.
|
||||
Otherwise, it will be closed immediately.
|
||||
Questions in the form of *How to use ...* should be at Stack Overflow rather than GitHub issue list.
|
||||
|
||||
请注意,所有 issue 必须由 https://ecomfe.github.io/echarts-issue-helper/ 创建,不然将会被直接关闭。建议使用英文提问。
|
||||
Issues 中不要问「如何使用 ECharts 实现……功能」的问题,相关问题请到 SegmentFault 或 Stack Overflow 提问,详见上面的链接。
|
||||
-->
|
||||
|
||||
This issue is not created by [echarts-issue-helper](https://ecomfe.github.io/echarts-issue-helper) and will be soon closed.
|
@ -0,0 +1,66 @@
|
||||
<!-- Please fill in the following information to help us review your PR more efficiently. -->
|
||||
|
||||
## Brief Information
|
||||
|
||||
This pull request is in the type of:
|
||||
|
||||
- [ ] bug fixing
|
||||
- [ ] new feature
|
||||
- [ ] others
|
||||
|
||||
|
||||
|
||||
### What does this PR do?
|
||||
|
||||
<!-- USE ONCE SENTENCE TO DESCRIBE WHAT THIS PR DOES. -->
|
||||
|
||||
|
||||
|
||||
### Fixed issues
|
||||
|
||||
<!--
|
||||
- #xxxx: ...
|
||||
-->
|
||||
|
||||
|
||||
## Details
|
||||
|
||||
### Before: What was the problem?
|
||||
|
||||
<!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
|
||||
|
||||
<!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
|
||||
|
||||
|
||||
|
||||
### After: How is it fixed in this PR?
|
||||
|
||||
<!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
|
||||
|
||||
<!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
|
||||
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Are there any API changes?
|
||||
|
||||
- [ ] The API has been changed.
|
||||
|
||||
<!-- LIST THE API CHANGES HERE -->
|
||||
|
||||
|
||||
|
||||
### Related test cases or examples to use the new APIs
|
||||
|
||||
NA.
|
||||
|
||||
|
||||
|
||||
## Others
|
||||
|
||||
### Merging options
|
||||
|
||||
- [ ] Please squash the commits into a single one when merge.
|
||||
|
||||
### Other information
|
@ -0,0 +1,60 @@
|
||||
# Configuration for probot-stale - https://github.com/probot/stale
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||
daysUntilStale: 730 # two years
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
|
||||
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
||||
daysUntilClose: 7
|
||||
|
||||
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
|
||||
onlyLabels: []
|
||||
|
||||
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||
exemptLabels:
|
||||
- "maybe-later"
|
||||
- "priority: high"
|
||||
|
||||
# Set to true to ignore issues in a project (defaults to false)
|
||||
exemptProjects: true
|
||||
|
||||
# Set to true to ignore issues in a milestone (defaults to false)
|
||||
exemptMilestones: false
|
||||
|
||||
# Set to true to ignore issues with an assignee (defaults to false)
|
||||
exemptAssignees: false
|
||||
|
||||
# Label to use when marking as stale
|
||||
staleLabel: stale
|
||||
|
||||
# Comment to post when marking as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
|
||||
# Comment to post when removing the stale label.
|
||||
unmarkComment: >
|
||||
This issue is marked to be `stale` and is going to be closed within a week. If you think it shouldn't be closed, please leave a comment.
|
||||
|
||||
# Comment to post when closing a stale Issue or Pull Request.
|
||||
# closeComment: >
|
||||
# Your comment here.
|
||||
|
||||
# Limit the number of actions per hour, from 1-30. Default is 30
|
||||
limitPerRun: 30
|
||||
|
||||
# Limit to only `issues` or `pulls`
|
||||
# only: issues
|
||||
|
||||
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
|
||||
# pulls:
|
||||
# daysUntilStale: 30
|
||||
# markComment: >
|
||||
# This pull request has been automatically marked as stale because it has not had
|
||||
# recent activity. It will be closed if no further activity occurs. Thank you
|
||||
# for your contributions.
|
||||
|
||||
# issues:
|
||||
# exemptLabels:
|
||||
# - confirmed
|
@ -0,0 +1,48 @@
|
||||
name: Node CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: npm install
|
||||
run: |
|
||||
npm install
|
||||
npm install git+https://github.com/ecomfe/zrender.git
|
||||
- name: build zrender
|
||||
run: |
|
||||
cd node_modules/zrender
|
||||
npm install
|
||||
npm run prepublish
|
||||
cd ../..
|
||||
- name: check type
|
||||
run: |
|
||||
npm run checktype
|
||||
- name: build release
|
||||
run: |
|
||||
npm run release
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release'
|
||||
|
||||
steps:
|
||||
- name: unit test
|
||||
run: |
|
||||
npm run test
|
@ -0,0 +1,56 @@
|
||||
# Only support regexp, testing against each relative file path
|
||||
# based on the echart base directory. And the pattern should
|
||||
# match the relative path completely.
|
||||
|
||||
node_modules
|
||||
.*\.git
|
||||
.*\.github
|
||||
.*\.editorconfig
|
||||
.*\.gitignore
|
||||
.*\.jshintrc
|
||||
.*\.jshintrc-dist
|
||||
.*\.npmignore
|
||||
.*\.ratignore
|
||||
.*\.headerignore
|
||||
.*\.DS_Store
|
||||
.*\.idea
|
||||
.*rat\.iml
|
||||
__MAC_OS
|
||||
.*README.md
|
||||
.*MANIFEST\.txt
|
||||
DISCLAIMER
|
||||
NOTICE
|
||||
KEYS
|
||||
LICENSE
|
||||
LICENSE-.+
|
||||
licenses
|
||||
map/js
|
||||
map/json
|
||||
benchmark/dep/*
|
||||
test/ut/lib
|
||||
test/data$
|
||||
test/lib/esl\.js
|
||||
test/lib/perlin\.js
|
||||
test/lib/countup\.js
|
||||
.*jquery\.min\.js
|
||||
.*rollup\.browser\.js
|
||||
.*configure
|
||||
.+\.json
|
||||
.+\.map
|
||||
.+\.gexf
|
||||
.+\.jar
|
||||
.+\.bin
|
||||
.+\.csv
|
||||
.+\.png
|
||||
.+\.PNG
|
||||
.+\.jpg
|
||||
.+\.JPG
|
||||
.+\.jpeg
|
||||
.+\.JPEG
|
||||
.+\.gif
|
||||
.+\.GIF
|
||||
.+\.class
|
||||
types
|
||||
lib
|
||||
esm
|
||||
dist
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"hooks": {
|
||||
"pre-commit": "npm run lint && npm run checktype",
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
{
|
||||
"bitwise": false,
|
||||
"camelcase": false,
|
||||
"curly": true,
|
||||
"eqeqeq": false,
|
||||
"forin": false,
|
||||
"immed": true,
|
||||
"latedef": false,
|
||||
"newcap": true,
|
||||
"noarg": false,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"plusplus": false,
|
||||
"quotmark": "single",
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"unused": "vars",
|
||||
"strict": false,
|
||||
"trailing": false,
|
||||
"maxparams": 20,
|
||||
"maxdepth": 6,
|
||||
"maxlen": 200,
|
||||
|
||||
"asi": false,
|
||||
"boss": false,
|
||||
"debug": false,
|
||||
"eqnull": true,
|
||||
"esversion": 3,
|
||||
"module": false,
|
||||
"evil": true,
|
||||
"expr": true,
|
||||
"funcscope": false,
|
||||
"globalstrict": false,
|
||||
"iterator": false,
|
||||
"lastsemic": false,
|
||||
"laxbreak": true,
|
||||
"laxcomma": false,
|
||||
"loopfunc": false,
|
||||
"multistr": false,
|
||||
"onecase": false,
|
||||
"proto": false,
|
||||
"regexdash": false,
|
||||
"scripturl": false,
|
||||
"smarttabs": false,
|
||||
"shadow": true,
|
||||
"sub": true,
|
||||
"supernew": false,
|
||||
"validthis": true,
|
||||
|
||||
"browser": true,
|
||||
"couch": false,
|
||||
"devel": true,
|
||||
"dojo": false,
|
||||
"jquery": true,
|
||||
"mootools": false,
|
||||
"node": false,
|
||||
"nonstandard": false,
|
||||
"prototypejs": false,
|
||||
"rhino": false,
|
||||
"wsh": false,
|
||||
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"passfail": false,
|
||||
"white": false,
|
||||
|
||||
"predef": [
|
||||
"global"
|
||||
]
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
path_classifiers:
|
||||
test:
|
||||
- test
|
||||
library:
|
||||
- benchmark/dep
|
||||
generated:
|
||||
- dist
|
||||
extraction:
|
||||
javascript:
|
||||
index:
|
||||
exclude:
|
||||
- dist
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"typescript.tsdk": "./node_modules/typescript/lib"
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
This file contains the PGP keys of various developers.
|
||||
Please don't use them for email unless you have to. Their main
|
||||
purpose is code signing.
|
||||
|
||||
Examples of importing this file in your keystore:
|
||||
gpg --import KEYS.txt
|
||||
(need pgp and other examples here)
|
||||
|
||||
Examples of adding your key to this file:
|
||||
pgp -kxa <your name> and append it to this file.
|
||||
(pgpk -ll <your name> && pgpk -xa <your name>) >> this file.
|
||||
(gpg --list-sigs <your name>
|
||||
&& gpg --armor --export <your name>) >> this file.
|
||||
|
||||
---------------------------------------
|
||||
pub rsa4096 2018-04-23 [SC]
|
||||
9B06D9B4FA37C4DD52725742747985D7E3CEB635
|
||||
uid [ultimate] Su Shuang (CODE SIGNING KEY) <sushuang@apache.org>
|
||||
sig 3 747985D7E3CEB635 2018-04-23 Su Shuang (CODE SIGNING KEY) <sushuang@apache.org>
|
||||
sub rsa4096 2018-04-23 [E]
|
||||
sig 747985D7E3CEB635 2018-04-23 Su Shuang (CODE SIGNING KEY) <sushuang@apache.org>
|
||||
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQINBFrd5SYBEADoCBw12lsK1sxn3r879jI50GhRAg5vF0aBql0h2BIJ3d+oYYSm
|
||||
nIsK/XGpIk3t6ZhJRXK+le89t8a7vBsU+y0+3+OehxOV63du1wscQU9GPu7IfXhw
|
||||
V4YcsGK330+V/GiwBs3EX808fdQrdkfCsaGEJhKJbK2fldUcnNp3M1Y2+DVZqGmb
|
||||
I7fRJuEj/S9bcVGWnv40jBbMKjx/8LyP2dxZLyy1+whEUimU9em6Tj+SnyISe1I2
|
||||
sLa3lwhWer0rkrz0siGFTgDHaDvLlpL9TV34acj/FOon3XKMtx4neNVmkC3QVi0z
|
||||
PSlnX6EV8Fas9ylA4x9bdaUo6zUZKO533ASfC6uEibvE2XSRXYJ0xB2bThcQbkdl
|
||||
332JqD1TkyF/UQRel3pUm/bCsv2daKD98ZO+eCbvNNonrip2qXDwJJ5HzlXlThyR
|
||||
eN1Og90gXvYix4sbsZgNEIyYSaLri7/GjyMD34GCLQiV/kvc/foaC/hkvz6kVOiq
|
||||
/tMHY3KsGYAIF4Z9kuTCwJOwFqgfb+Y15bPRDK84uyCiRhtIubNWY7Euy4bBd3ul
|
||||
uazQ9LabBhZaa7HCOMssW+TaB+GondZJTiwnI6MCTJKrKtvb8kzcKR4mNf/dvF0O
|
||||
x7zwVBeklMKXjkpOtje/+/XOYKuD3g1BZ/+vrfMFPTZ7y7ASC2ylcKI0/QARAQAB
|
||||
tDJTdSBTaHVhbmcgKENPREUgU0lHTklORyBLRVkpIDxzdXNodWFuZ0BhcGFjaGUu
|
||||
b3JnPokCTgQTAQoAOBYhBJsG2bT6N8TdUnJXQnR5hdfjzrY1BQJa3eUmAhsDBQsJ
|
||||
CAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJEHR5hdfjzrY13yIP+wS+Mh86IuIK+zG5
|
||||
qr/cncV541RxvIGbv5uCQEbFRIwtR8SJEyx2tu4pIgsaTu93hdwxHFCcOZT2IsXP
|
||||
meRWPfhaguDFQArdu4VdOfq2AbMqqByFWRsbwvF8CX8fGMPBCsMp0pzqp0px1uUr
|
||||
WlK5hBSVwDHWACElyJE7jmk5K+O7RmDUD2E/pgXid+SiU8W+k9vWj49nHAhStYTm
|
||||
SwVQA4Gl7jGCJY5jFwZIRD5/b8kVYjbJFl9CBDD2nOIytrGfMVlhp2OcT1f6yZvZ
|
||||
oY2nvWLBUF0SmQzlli3EW9zzsNAXDu3f81kqwa+kC2WqQ3s4bKZKQurN5sCWvoyX
|
||||
db+AWedArK+m3fH9y3JFIr5Lu1MwfbgfMfm9EZS4A+3DqLFIsLrmnzbGZ9FCkqsj
|
||||
TuvKWOP2H365xH44gHImYKZ92PDdLKE7XArVU5b9qtAimgCDsCjEiXTB4S3NVJGX
|
||||
R0RZCttKgnrLHwAad3TeLhktWcjH4TdxNCrNZsHLO9mklGyeM1IxKqba4OdHTmYX
|
||||
tYYlixSlAu5vSPa+vDkILRfyU87n9YD9RiVGmvy27IP7wdxSClJun6+9fviU2NpG
|
||||
FCkLZovYz8/Qht1c8yQZGscw3sa316m1nJz42Lo+p2s6AQZhZupu8bi/W85VHoxa
|
||||
roRO16i+mFr4bnbo2/jftB6UVVo7uQINBFrd5SYBEACVsgwBHz5cpBqZQVNS6o0W
|
||||
RUnWWNDiBYidNQNTWCF9NDF0HCh6oHecjjXQEPduvMPdzOPpawAkKMRG+7MlHiu/
|
||||
ugAq0RluoM3QzDZwvCPw+p/NTESZMqLvbHXEs2u6YCdIsFcTLXr2d+JBWDeGri0S
|
||||
YB4gjjQIVvDGqG0tDoW4JmqHHMZiJ6c+h2Rq+saHte0rctHcVAq4p5I8O1iJ1Mkg
|
||||
gKJ/TBsjPM5aK6ahPpIPPh48nbhpsLjKHwqB/UWdUcB/HUDa0YfV4JbJilEeeQFZ
|
||||
PzlP5SJaGyuEnTnhEwnoXpFetfMYi+Mxnc4VoSrQ3UOsVpD2Ii3haUjdKWTjukyn
|
||||
o3sCxvsBTQ8jyBtjjhLw1jfWJdHJ2WCDGVtQVuJ6Gx1GCV0XRbKDTWdIBnCkdKtU
|
||||
FY+VMt77oQ/ydeRsZDXhkdgBqqkvdiRHRyEFy72rx61cGTIKuKcWu0rJx8/LnVyi
|
||||
nOEk8K8mgNR8omnpFmkkStOtSDLjDb8WeIdigxwJ4wtQnLlLGWiAAVNnDDsqgGIB
|
||||
3rrR+/HKUa05CwKI1oIC7i4f7qkgfFUjjr1e496FDSq2tBTLukq/v5FpU6C0JSVq
|
||||
MeD5+UuGtSezBxQUdxV7caftIptopwWnx4bBjWSuk2FVCzWcYMnXNIbtfEbqMKuS
|
||||
mrpk4mOBNAV6XYzNcOHQqwARAQABiQI2BBgBCgAgFiEEmwbZtPo3xN1ScldCdHmF
|
||||
1+POtjUFAlrd5SYCGwwACgkQdHmF1+POtjXK4g//c7vJXmN0FtACspBJVrgsKrYj
|
||||
ha4c2PCEynfKSwhVXW3yHnQMwh8/bpQUs5bwCTWx27IEeBrfb03/X9tlx12koGvl
|
||||
LujaR7IP6xaqWpbh6rrfttOKGx3xKopJ4nHgNPIYN/ApflAacwyOd+/leWOjHrii
|
||||
JXbB60oc7FNvfQRREICLZyeAnzlAcEOVcWvBTngB0EDUZucKwkQtt0x3YvKetgQf
|
||||
EMFBAH4RUXG0ms85acX2rpi/kbdarFv6Hc2pzakoWDKNjHMMae1J8wQbPRaXx1NB
|
||||
+xF362eLXZaxtvKdzs9Q03R46DY9cyQRofG5WNnZapgemEzPgixur8FYK5EPCQkh
|
||||
Y2FA0WUbZFIkO7pE7UNS5ZN5fHkkEhAFo4wV0uqWRVBpFrjKeBxtRkIaw7jLCHr5
|
||||
3EpkTusjT/529rEYIq9cGOTwf75AbKR1IZFxffEZYOU76y6SH0bINoYp0VxFJ/IR
|
||||
zy5CHqvyUQVUed5O/7UzkYx0IVBGk2wSwOtC7+iRptqj+kI9RCjGizhNe4hG3SUq
|
||||
1qkUGkQu6+skyXeFCR1PIAbQgleRNUQotsh/rfsfZpQOomBdvDRPT8ZcN5bjUIJ1
|
||||
5c4abryWPkun+BgZk+YFtYLbGZVJAUy2OtXRG5uYzeLc5ID+X5XwwtZOO4gSWMTh
|
||||
oQH7TsthVKvdZyjtZQg=
|
||||
=Uv8d
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
pub rsa4096 2019-01-24 [SC]
|
||||
1683FBD23F6DD36C0E52223507D78F777D2C0C27
|
||||
uid [ultimate] Ovilia (CODE SIGNING KEY) <oviliazhang@gmail.com>
|
||||
sig 3 07D78F777D2C0C27 2019-01-24 Ovilia (CODE SIGNING KEY) <oviliazhang@gmail.com>
|
||||
sub rsa4096 2019-01-24 [E]
|
||||
sig 07D78F777D2C0C27 2019-01-24 Ovilia (CODE SIGNING KEY) <oviliazhang@gmail.com>
|
||||
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQINBFxJWEYBEADYzZRcG+WIllHo8PloMv9pX2QZxmZiVJzM7Prgg8KlWfHnO68/
|
||||
7Et//hMA2zexJWweZwM0ffmjvcIIEre23De6KaA2htM/54aPoBweDAOBi34RsdR9
|
||||
kpN0RvipvJMMZKGB0tDSB3mLhWaiApDGMsysfJAgTaGsIISrC2+xLO/+HxgoEAIX
|
||||
a0BTJ+P3cOLPghBBaRtyKNWJjJ2e4XzlVM0T4bM06QmzC0qWTSufKqk1XAZTSOGU
|
||||
LXYESonSu/+kL2TCsKi90THNX69a9SBx3DAohbb5WKjXkYistSQi9S33jqZMIc7n
|
||||
I1kG1x39YxZiQwwszwbfa3/+qE3X0Qjp2k3fD7wa+qDnSpHTchqy8d71EN0wU6S/
|
||||
9vEiJ2e+gxN6WZetK9wl90P70Iu0rvLqSu+5EdkenvIbh6i4CR+Cer1Sky2z7rEY
|
||||
vmEjFNjV2ktvbu83RDofxp4ERSbZOwq8VMOWqj6Ft9mIWfw1OAoSkLCRchYFR1ue
|
||||
r+e3FuF01KlCXjTV4t24F7l5QO/bwexnmYuVTlSEo4PVZLJAv/UYSP0ngie5DawL
|
||||
z2RDCuRrROgtzcf84SaRxwcPNQ0h6EZlKZ4NFL7nl4rwbDsyZRdBqzQ5JPm6dbGe
|
||||
CZXCBA84ivcnK845flcsl7ITNjcfsLbeN9s6FMnYZgOHZh/ucmw2dL+5vQARAQAB
|
||||
tDFPdmlsaWEgKENPREUgU0lHTklORyBLRVkpIDxvdmlsaWF6aGFuZ0BnbWFpbC5j
|
||||
b20+iQJOBBMBCAA4FiEEFoP70j9t02wOUiI1B9ePd30sDCcFAlxJWEYCGwMFCwkI
|
||||
BwIGFQoJCAsCBBYCAwECHgECF4AACgkQB9ePd30sDCcgHA//be3mdnRU+jYCP3VU
|
||||
l/pcYnbxoIfAhf1Z2orVcN3/E6v2wDYvbvcV7EX/cqwMXBc0/CEVisGQ3zX5CM4/
|
||||
C/vwjAsPNPWsX8iyE/Mui/Ktl9tZqQ3/8hTOHe5RQIn0VQ5wIYmyh3Q42BI4vKK3
|
||||
BodV9PwONdRhQVJ15x1fp59wiPTqflcXJ0qdGml3JY4ULLFYh63MBV4as6pg/Qtb
|
||||
1enZmw8/Bgg6mhY6HiBI+v+8wAwdatwYuG33JdzhoPVbjsnovqAE+kMvOuxmVbK/
|
||||
q5dwdwFULbyHzojNAj7zg1zjtksawP8Uspc02JHr16pW3u48E2/uk6XCkTpFDJ09
|
||||
xqwtZyEGSobl/9BaDuidXQ9UDsrOIYuvBXO53vlVv1nwzyF7qUhNRNn1HdzIbEiV
|
||||
16CaYT5Soy4Xh5sFTFoIg0g/E8JquSgIEJN/NutqbQOHO4ldMxaDEgFp7dRJ/tqo
|
||||
CEJgahC/D16efbIUP2gVScYsJK3VYNjuEfnTu2qiR7XDXosG0zGOMGsr4xCuSx8y
|
||||
mwtrqRZdl4wfaHi2/QojJGAXwd1Q9WNBxYKuE31amAo7AxGKZ8QLZ9m0RwitG912
|
||||
yP7gsw9k/TA195GJiQ5W1qNTHa4gKXhzFtPqg7s9xhJOkb+GOk6tOCWzts1IJSXa
|
||||
oyGerp3bGP4Ho49nipEFjeiUKgW5Ag0EXElYRgEQAMbeZQMWRo9h6RgGm7eLCfz2
|
||||
K9Ro9yL0U0Jz8SmNz2I7YoYqg4idPV7D0gBym/502QsalQc427vE4QtJGlNPx8yH
|
||||
uXIKD0u9sGadO3wkz3WmPqyVMlAgdzjB9ddoWjeQDYTvJLO1eo4LtVUoSydoOs67
|
||||
bBNr9Wi2hIso60+cZGxczI+dTkqvgd+nSrhzG1+N1NPjpGqLUSvjWEZiu4NT1oVd
|
||||
4f8C6SpQNkgUbliomLE9Zv8Wkcj8RDU5je+dU8r4fKQy1GtDVGW89QXGKALwTg4F
|
||||
4/d+/qbF/ZhfZk3e6dxJV4Slmb+IKWUd5dcEYwXIdYXJuQu84CnEtsnQDsIUCc5V
|
||||
Qfk1E4SqEmc0gWsmTlsPKF51VdeDpbqQShGgt+xM65wCL7/JASnuEwr1Jt2pPRDq
|
||||
VF9s4APQJi/neuJh1A6RlHU6PFcPXmqjsglMdbfKdc0dzoOcc4OcSFPdAlX935L8
|
||||
Tlwrp2dy2ARNTSdCvbXx4Lj+Ru7tIUTjDqIFzRLBdppRU/NO6SpNMoIKkOwrjFYd
|
||||
H8nV9z6+nYHfJNR/FfT8LLx7ac/trYwDYWMJhk/h9taOszZ5OpQM4LOrWwyg2HA8
|
||||
80H95TcQ0c1/dp5OBfPSNfse75yBJrW0PwtQA3++38PHQQZVhO7J3Ha2Y9/MmLqU
|
||||
Ip+rhd38hfkHlkrwCr7tABEBAAGJAjYEGAEIACAWIQQWg/vSP23TbA5SIjUH1493
|
||||
fSwMJwUCXElYRgIbDAAKCRAH1493fSwMJ4GVD/9AS8YwflROUAodGe7jBHZ41oye
|
||||
4I8AX8iTP1qxww8ydeCBVCz3n3lvEHHP8JfVB0aJwiezUtt/1uV0bTFt9ycxyJS1
|
||||
5eIefOVN0wFEsj4pgQfBfSWxI0Yd97m+W1xg5h+aAN9W1MNH6rb1ktHCebW709Vf
|
||||
Bs+NfktKww98M134cQlmJSo1pBQEBzKaE5KEvLAiafluAPTkvafZfe+35QQdJAXx
|
||||
iLE/ZNJQ8L9lBYZaA5mM/NKNzeEqeSTwfvcIonY5sD2EsgBU/ux6QzjRV5EmteJr
|
||||
eg+bCWJnbVvZY/2LVru8NKDgfhTSMN0ocDLaWKW6aQO36TequQNdD09wasdSpQmV
|
||||
GoCydtdCVoetGdGm8SZvi6EUgAWH4eI3Su/19V8sVo3kHhJ1d575NJCFwTPvKAre
|
||||
s8wgU+7CgTojnMxFmb68p+lLe1qQheyXaa44WQ7d7hmXPIoe3EgMYtMc7tLcKccE
|
||||
upu7zWG7BNU97kpUw7nmHKalI/1fKEEAYQUmNm9mNVGKjLVNtuG8jw6Zq0vX1tP9
|
||||
mh+T3SMBEnsdzoQ+E31lIDNYTZaEHxt0XupNdjt+uEfASdrD3+8+jlWVkpO3FlZ0
|
||||
MhfLdHrk689ty11m+5HlrSU7O1I1wZkt/OlYsZmS1yIpD1hEnOuSjAuqm4D3s+YI
|
||||
B4WM8AJSCwl8WlZrRA==
|
||||
=wft0
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
@ -0,0 +1,223 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
========================================================================
|
||||
Apache ECharts Subcomponents:
|
||||
|
||||
The Apache ECharts project contains subcomponents with separate copyright
|
||||
notices and license terms. Your use of the source code for these
|
||||
subcomponents is also subject to the terms and conditions of the following
|
||||
licenses.
|
||||
|
||||
BSD 3-Clause (d3.js):
|
||||
The following files embed [d3.js](https://github.com/d3/d3) BSD 3-Clause:
|
||||
`/src/chart/treemap/treemapLayout.js`,
|
||||
`/src/chart/tree/layoutHelper.js`,
|
||||
`/src/chart/graph/forceHelper.js`,
|
||||
`/src/util/number.js`,
|
||||
`/src/scale/Time.js`,
|
||||
See `/licenses/LICENSE-d3` for details of the license.
|
@ -0,0 +1,5 @@
|
||||
Apache ECharts
|
||||
Copyright 2017-2021 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
@ -0,0 +1,103 @@
|
||||
# Apache ECharts
|
||||
|
||||
<a href="https://echarts.apache.org/">
|
||||
<img style="vertical-align: top;" src="./asset/logo.png?raw=true" alt="logo" height="50px">
|
||||
</a>
|
||||
|
||||
Apache ECharts is a free, powerful charting and visualization library offering an easy way of adding intuitive, interactive, and highly customizable charts to your commercial products. It is written in pure JavaScript and based on <a href="https://github.com/ecomfe/zrender">zrender</a>, which is a whole new lightweight canvas library.
|
||||
|
||||
**[中文官网](https://echarts.apache.org/zh/index.html)** | **[ENGLISH HOMEPAGE](https://echarts.apache.org/en/index.html)**
|
||||
|
||||
[](https://travis-ci.org/apache/echarts) [](https://www.npmjs.com/package/echarts) [](https://www.npmjs.com/package/echarts)
|
||||
|
||||
## Get Apache ECharts
|
||||
|
||||
You may choose one of the following methods:
|
||||
|
||||
+ Download from Official Website in [中文下载页](https://echarts.apache.org/zh/download.html)
|
||||
+ Download from Official Website in [English](https://echarts.apache.org/en/download.html)
|
||||
+ `npm install echarts --save`
|
||||
+ CDN: [jsDelivr CDN](https://www.jsdelivr.com/package/npm/echarts?path=dist)
|
||||
|
||||
## Docs
|
||||
|
||||
+ Tutorial
|
||||
+ [中文](https://echarts.apache.org/zh/tutorial.html)
|
||||
+ [English](https://echarts.apache.org/en/tutorial.html)
|
||||
|
||||
+ API
|
||||
+ [中文](https://echarts.apache.org/zh/api.html)
|
||||
+ [English](https://echarts.apache.org/en/api.html)
|
||||
|
||||
+ Option Manual
|
||||
+ [中文](https://echarts.apache.org/zh/option.html)
|
||||
+ [English](https://echarts.apache.org/en/option.html)
|
||||
|
||||
## Get Help
|
||||
|
||||
+ [GitHub Issues](https://github.com/apache/echarts/issues) for bug report and feature requests
|
||||
+ Email [dev@echarts.apache.org](mailto:dev@echarts.apache.org) for general questions
|
||||
+ Subscribe [mailing list](https://echarts.apache.org/en/maillist.html) to get updated with the project
|
||||
|
||||
## Build
|
||||
|
||||
Build echarts source code:
|
||||
|
||||
Execute the instructions in the root directory of the echarts:
|
||||
([Node.js](https://nodejs.org) is required)
|
||||
|
||||
```shell
|
||||
# Install the dependencies from NPM:
|
||||
npm install
|
||||
|
||||
# Rebuild source code immediately in watch mode when changing the source code.
|
||||
npm run dev
|
||||
|
||||
# Check correctness of TypeScript code.
|
||||
npm run checktype
|
||||
|
||||
# If intending to build and get all types of the "production" files:
|
||||
npm run release
|
||||
```
|
||||
|
||||
Then the "production" files are generated in the `dist` directory.
|
||||
|
||||
More custom build approaches can be checked in this tutorial: [Create Custom Build of ECharts](https://echarts.apache.org/en/tutorial.html#Create%20Custom%20Build%20of%20ECharts) please.
|
||||
|
||||
## Contribution
|
||||
|
||||
If you wish to debug locally or make pull requests, please refer to [contributing](https://github.com/apache/echarts/blob/master/CONTRIBUTING.md) document.
|
||||
|
||||
## Resources
|
||||
|
||||
### Awesome ECharts
|
||||
|
||||
[https://github.com/ecomfe/awesome-echarts](https://github.com/ecomfe/awesome-echarts)
|
||||
|
||||
### Extensions
|
||||
|
||||
+ [ECharts GL](https://github.com/ecomfe/echarts-gl) An extension pack of ECharts, which provides 3D plots, globe visualization, and WebGL acceleration.
|
||||
|
||||
+ [Liquidfill 水球图](https://github.com/ecomfe/echarts-liquidfill)
|
||||
|
||||
+ [Wordcloud 字符云](https://github.com/ecomfe/echarts-wordcloud)
|
||||
|
||||
+ [Extension for Baidu Map 百度地图扩展](https://github.com/apache/echarts/tree/master/extension-src/bmap) An extension provides a wrapper of Baidu Map Service SDK.
|
||||
|
||||
+ [vue-echarts](https://github.com/ecomfe/vue-echarts) ECharts component for Vue.js
|
||||
|
||||
+ [echarts-stat](https://github.com/ecomfe/echarts-stat) Statistics tool for ECharts
|
||||
|
||||
## License
|
||||
|
||||
ECharts is available under the Apache License V2.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
Please refer to [Apache Code of Conduct](https://www.apache.org/foundation/policies/conduct.html).
|
||||
|
||||
## Paper
|
||||
|
||||
Deqing Li, Honghui Mei, Yi Shen, Shuang Su, Wenli Zhang, Junting Wang, Ming Zu, Wei Chen.
|
||||
[ECharts: A Declarative Framework for Rapid Construction of Web-based Visualization](https://www.sciencedirect.com/science/article/pii/S2468502X18300068).
|
||||
Visual Informatics, 2018.
|
After Width: | Height: | Size: 236 KiB |
After Width: | Height: | Size: 7.2 KiB |
@ -0,0 +1,77 @@
|
||||
{
|
||||
"bitwise": false,
|
||||
"camelcase": true,
|
||||
"curly": true,
|
||||
"eqeqeq": false,
|
||||
"forin": false,
|
||||
"immed": true,
|
||||
"latedef": false,
|
||||
"newcap": true,
|
||||
"noarg": false,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"plusplus": false,
|
||||
"quotmark": "single",
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"unused": "vars",
|
||||
"strict": false,
|
||||
"trailing": false,
|
||||
"maxparams": 20,
|
||||
"maxdepth": 6,
|
||||
"maxlen": 200,
|
||||
|
||||
"asi": false,
|
||||
"boss": false,
|
||||
"debug": false,
|
||||
"eqnull": true,
|
||||
"esversion": 6,
|
||||
"evil": true,
|
||||
"expr": true,
|
||||
"funcscope": false,
|
||||
"globalstrict": false,
|
||||
"iterator": false,
|
||||
"lastsemic": false,
|
||||
"laxbreak": true,
|
||||
"laxcomma": false,
|
||||
"loopfunc": false,
|
||||
"multistr": false,
|
||||
"onecase": false,
|
||||
"proto": false,
|
||||
"regexdash": false,
|
||||
"scripturl": false,
|
||||
"smarttabs": false,
|
||||
"shadow": true,
|
||||
"sub": true,
|
||||
"supernew": false,
|
||||
"validthis": true,
|
||||
|
||||
"browser": true,
|
||||
"couch": false,
|
||||
"devel": true,
|
||||
"dojo": false,
|
||||
"jquery": true,
|
||||
"mootools": false,
|
||||
"node": false,
|
||||
"nonstandard": false,
|
||||
"prototypejs": false,
|
||||
"rhino": false,
|
||||
"wsh": false,
|
||||
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"passfail": false,
|
||||
"white": false,
|
||||
|
||||
"varstmt": true,
|
||||
|
||||
"predef": [
|
||||
"__DEV__",
|
||||
"global",
|
||||
"require",
|
||||
"exports",
|
||||
"Buffer",
|
||||
"module",
|
||||
"__dirname"
|
||||
]
|
||||
}
|
@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
const fs = require('fs');
|
||||
const preamble = require('./preamble');
|
||||
const pathTool = require('path');
|
||||
const chalk = require('chalk');
|
||||
|
||||
// In the `.headerignore`, each line is a pattern in RegExp.
|
||||
// all relative path (based on the echarts base directory) is tested.
|
||||
// The pattern should match the relative path completely.
|
||||
const excludesPath = pathTool.join(__dirname, '../.headerignore');
|
||||
const ecBasePath = pathTool.join(__dirname, '../');
|
||||
|
||||
const isVerbose = process.argv[2] === '--verbose';
|
||||
|
||||
// const lists = [
|
||||
// '../src/**/*.js',
|
||||
// '../build/*.js',
|
||||
// '../benchmark/src/*.js',
|
||||
// '../benchmark/src/gulpfile.js',
|
||||
// '../extension-src/**/*.js',
|
||||
// '../extension/**/*.js',
|
||||
// '../map/js/**/*.js',
|
||||
// '../test/build/**/*.js',
|
||||
// '../test/node/**/*.js',
|
||||
// '../test/ut/core/*.js',
|
||||
// '../test/ut/spe/*.js',
|
||||
// '../test/ut/ut.js',
|
||||
// '../test/*.js',
|
||||
// '../theme/*.js',
|
||||
// '../theme/tool/**/*.js',
|
||||
// '../echarts.all.js',
|
||||
// '../echarts.blank.js',
|
||||
// '../echarts.common.js',
|
||||
// '../echarts.simple.js',
|
||||
// '../index.js',
|
||||
// '../index.common.js',
|
||||
// '../index.simple.js'
|
||||
// ];
|
||||
|
||||
function run() {
|
||||
const updatedFiles = [];
|
||||
const passFiles = [];
|
||||
const pendingFiles = [];
|
||||
|
||||
eachFile(function (absolutePath, fileExt) {
|
||||
const fileStr = fs.readFileSync(absolutePath, 'utf-8');
|
||||
|
||||
const existLicense = preamble.extractLicense(fileStr, fileExt);
|
||||
|
||||
if (existLicense) {
|
||||
passFiles.push(absolutePath);
|
||||
return;
|
||||
}
|
||||
|
||||
// Conside binary files, only add for files with known ext.
|
||||
if (!preamble.hasPreamble(fileExt)) {
|
||||
pendingFiles.push(absolutePath);
|
||||
return;
|
||||
}
|
||||
|
||||
fs.writeFileSync(absolutePath, preamble.addPreamble(fileStr, fileExt), 'utf-8');
|
||||
updatedFiles.push(absolutePath);
|
||||
});
|
||||
|
||||
console.log('\n');
|
||||
console.log('----------------------------');
|
||||
console.log(' Files that exists license: ');
|
||||
console.log('----------------------------');
|
||||
if (passFiles.length) {
|
||||
if (isVerbose) {
|
||||
passFiles.forEach(function (path) {
|
||||
console.log(chalk.green(path));
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log(chalk.green(passFiles.length + ' files. (use argument "--verbose" see details)'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.log('Nothing.');
|
||||
}
|
||||
|
||||
console.log('\n');
|
||||
console.log('--------------------');
|
||||
console.log(' License added for: ');
|
||||
console.log('--------------------');
|
||||
if (updatedFiles.length) {
|
||||
updatedFiles.forEach(function (path) {
|
||||
console.log(chalk.green(path));
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log('Nothing.');
|
||||
}
|
||||
|
||||
console.log('\n');
|
||||
console.log('----------------');
|
||||
console.log(' Pending files: ');
|
||||
console.log('----------------');
|
||||
if (pendingFiles.length) {
|
||||
pendingFiles.forEach(function (path) {
|
||||
console.log(chalk.red(path));
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log('Nothing.');
|
||||
}
|
||||
|
||||
console.log('\nDone.');
|
||||
}
|
||||
|
||||
function eachFile(visit) {
|
||||
|
||||
const excludePatterns = [];
|
||||
const extReg = /\.([a-zA-Z0-9_-]+)$/;
|
||||
|
||||
prepareExcludePatterns();
|
||||
travel('./');
|
||||
|
||||
function travel(relativePath) {
|
||||
if (isExclude(relativePath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const absolutePath = pathTool.join(ecBasePath, relativePath);
|
||||
const stat = fs.statSync(absolutePath);
|
||||
|
||||
if (stat.isFile()) {
|
||||
visit(absolutePath, getExt(absolutePath));
|
||||
}
|
||||
else if (stat.isDirectory()) {
|
||||
fs.readdirSync(relativePath).forEach(function (file) {
|
||||
travel(pathTool.join(relativePath, file));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function prepareExcludePatterns() {
|
||||
const content = fs.readFileSync(excludesPath, {encoding: 'utf-8'});
|
||||
content.replace(/\r/g, '\n').split('\n').forEach(function (line) {
|
||||
line = line.trim();
|
||||
if (line && line.charAt(0) !== '#') {
|
||||
excludePatterns.push(new RegExp(line));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function isExclude(relativePath) {
|
||||
for (let i = 0; i < excludePatterns.length; i++) {
|
||||
if (excludePatterns[i].test(relativePath)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getExt(path) {
|
||||
if (path) {
|
||||
const mathResult = path.match(extReg);
|
||||
return mathResult && mathResult[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
@ -0,0 +1,114 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const preamble = require('./preamble');
|
||||
const ts = require('typescript');
|
||||
const path = require('path');
|
||||
const fsExtra = require('fs-extra');
|
||||
|
||||
const umdWrapperHead = `
|
||||
${preamble.js}
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['exports'], factory);
|
||||
} else if (
|
||||
typeof exports === 'object' &&
|
||||
typeof exports.nodeName !== 'string'
|
||||
) {
|
||||
// CommonJS
|
||||
factory(exports);
|
||||
} else {
|
||||
// Browser globals
|
||||
factory({});
|
||||
}
|
||||
})(this, function(exports) {
|
||||
`;
|
||||
|
||||
const umdWrapperHeadWithEcharts = `
|
||||
${preamble.js}
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['exports', 'echarts'], factory);
|
||||
} else if (
|
||||
typeof exports === 'object' &&
|
||||
typeof exports.nodeName !== 'string'
|
||||
) {
|
||||
// CommonJS
|
||||
factory(exports, require('echarts/lib/echarts'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory({}, root.echarts);
|
||||
}
|
||||
})(this, function(exports, echarts) {
|
||||
`;
|
||||
|
||||
const umdWrapperTail = `
|
||||
});`;
|
||||
|
||||
async function buildI18nWrap() {
|
||||
const targetDir = path.join(__dirname, '../i18n');
|
||||
const sourceDir = path.join(__dirname, '../src/i18n');
|
||||
const files = fs.readdirSync(sourceDir);
|
||||
files.forEach(t => {
|
||||
if(!t.startsWith('lang')) {
|
||||
return;
|
||||
}
|
||||
const fileName = t.replace(/\.ts$/, '');
|
||||
const type = fileName.replace(/^lang/, '');
|
||||
const echartsRegister = `
|
||||
echarts.registerLocale('${type}', localeObj);
|
||||
`;
|
||||
const pureExports = `
|
||||
for (var key in localeObj) {
|
||||
if (localeObj.hasOwnProperty(key)) {
|
||||
exports[key] = localeObj[key];
|
||||
}
|
||||
}
|
||||
`;
|
||||
const code = fs.readFileSync(path.join(sourceDir, t), 'utf-8');
|
||||
// const outputText = ts.transpileModule(code, {
|
||||
// module: ts.ModuleKind.CommonJS,
|
||||
// }).outputText;
|
||||
// Simple regexp replace is enough
|
||||
const outputCode = code.replace(/export\s+?default/, 'var localeObj =')
|
||||
.replace(/\/\*([\w\W]*?)\*\//, '');
|
||||
|
||||
fsExtra.ensureDirSync(targetDir);
|
||||
|
||||
fs.writeFileSync(path.join(targetDir, fileName + '.js'), umdWrapperHeadWithEcharts + outputCode + echartsRegister + umdWrapperTail, 'utf-8');
|
||||
fs.writeFileSync(path.join(targetDir, fileName + '-obj.js'), umdWrapperHead + outputCode + pureExports + umdWrapperTail, 'utf-8');
|
||||
})
|
||||
console.log('i18n build completed');
|
||||
}
|
||||
|
||||
buildI18nWrap();
|
||||
|
||||
module.exports = {
|
||||
buildI18n: buildI18nWrap
|
||||
};
|
@ -0,0 +1,211 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const config = require('./config.js');
|
||||
const commander = require('commander');
|
||||
const chalk = require('chalk');
|
||||
const rollup = require('rollup');
|
||||
const prePublish = require('./pre-publish');
|
||||
const transformDEV = require('./transform-dev');
|
||||
const preamble = require('./preamble');
|
||||
|
||||
async function run() {
|
||||
|
||||
/**
|
||||
* Tips for `commander`:
|
||||
* (1) If arg xxx not specified, `commander.xxx` is undefined.
|
||||
* Otherwise:
|
||||
* If '-x, --xxx', `commander.xxx` can only be true/false, even if '--xxx yyy' input.
|
||||
* If '-x, --xxx <some>', the 'some' string is required, or otherwise error will be thrown.
|
||||
* If '-x, --xxx [some]', the 'some' string is optional, that is, `commander.xxx` can be boolean or string.
|
||||
* (2) `node ./build/build.js --help` will print helper info and exit.
|
||||
*/
|
||||
|
||||
let descIndent = ' ';
|
||||
let egIndent = ' ';
|
||||
|
||||
commander
|
||||
.usage('[options]')
|
||||
.description([
|
||||
'Build echarts and generate result files in directory `echarts/dist`.',
|
||||
'',
|
||||
' For example:',
|
||||
'',
|
||||
egIndent + 'node build/build.js --prepublish'
|
||||
+ '\n' + descIndent + '# Only prepublish.',
|
||||
egIndent + 'node build/build.js --type ""'
|
||||
+ '\n' + descIndent + '# Only generate `dist/echarts.js`.',
|
||||
egIndent + 'node build/build.js --type common --min'
|
||||
+ '\n' + descIndent + '# Only generate `dist/echarts.common.min.js`.',
|
||||
egIndent + 'node build/build.js --type simple --min'
|
||||
+ '\n' + descIndent + '# Only generate `dist/echarts-en.simple.min.js`.',
|
||||
].join('\n'))
|
||||
.option(
|
||||
'--prepublish',
|
||||
'Build all for release'
|
||||
)
|
||||
.option(
|
||||
'--min',
|
||||
'Whether to compress the output file, and remove error-log-print code.'
|
||||
)
|
||||
.option(
|
||||
'--type <type name>', [
|
||||
'Can be "simple" or "common" or "all" (default). Or can be simple,common,all to build multiple. For example,',
|
||||
descIndent + '`--type ""` or `--type "common"`.'
|
||||
].join('\n'))
|
||||
.option(
|
||||
'--format <format>',
|
||||
'The format of output bundle. Can be "umd", "amd", "iife", "cjs", "esm".'
|
||||
)
|
||||
.parse(process.argv);
|
||||
|
||||
let isPrePublish = !!commander.prepublish;
|
||||
let buildType = commander.type || 'all';
|
||||
|
||||
let opt = {
|
||||
min: commander.min,
|
||||
format: commander.format || 'umd'
|
||||
};
|
||||
|
||||
validateIO(opt.input, opt.output);
|
||||
|
||||
if (isPrePublish) {
|
||||
await prePublish();
|
||||
}
|
||||
else if (buildType === 'extension') {
|
||||
const cfgs = [
|
||||
config.createBMap(opt),
|
||||
config.createDataTool(opt)
|
||||
];
|
||||
await build(cfgs);
|
||||
}
|
||||
else if (buildType === 'myTransform') {
|
||||
const cfgs = [
|
||||
config.createMyTransform(opt)
|
||||
];
|
||||
await build(cfgs);
|
||||
}
|
||||
else {
|
||||
const types = buildType.split(',').map(a => a.trim());
|
||||
const cfgs = types.map(type =>
|
||||
config.createECharts({
|
||||
...opt,
|
||||
type
|
||||
})
|
||||
);
|
||||
await build(cfgs);
|
||||
}
|
||||
}
|
||||
|
||||
function checkBundleCode(cfg) {
|
||||
// Make sure process.env.NODE_ENV is eliminated.
|
||||
for (let output of cfg.output) {
|
||||
let code = fs.readFileSync(output.file, {encoding: 'utf-8'});
|
||||
if (!code) {
|
||||
throw new Error(`${output.file} is empty`);
|
||||
}
|
||||
transformDEV.recheckDEV(code);
|
||||
console.log(chalk.green.dim('Check code: correct.'));
|
||||
}
|
||||
}
|
||||
|
||||
function validateIO(input, output) {
|
||||
if ((input != null && output == null)
|
||||
|| (input == null && output != null)
|
||||
) {
|
||||
throw new Error('`input` and `output` must be both set.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array.<Object>} configs A list of rollup configs:
|
||||
* See: <https://rollupjs.org/#big-list-of-options>
|
||||
* For example:
|
||||
* [
|
||||
* {
|
||||
* ...inputOptions,
|
||||
* output: [outputOptions],
|
||||
* },
|
||||
* ...
|
||||
* ]
|
||||
*/
|
||||
async function build(configs) {
|
||||
console.log(chalk.yellow(`
|
||||
NOTICE: If you are using 'npm run build'. Run 'npm run prepublish' before build !!!
|
||||
`));
|
||||
|
||||
console.log(chalk.yellow(`
|
||||
NOTICE: If you are using syslink on zrender. Run 'npm run prepublish' in zrender first !!
|
||||
`));
|
||||
|
||||
for (let singleConfig of configs) {
|
||||
console.log(
|
||||
chalk.cyan.dim('\Bundling '),
|
||||
chalk.cyan(singleConfig.input)
|
||||
);
|
||||
|
||||
console.time('rollup build');
|
||||
const bundle = await rollup.rollup(singleConfig);
|
||||
|
||||
for (let output of singleConfig.output) {
|
||||
console.log(
|
||||
chalk.green.dim('Created '),
|
||||
chalk.green(output.file),
|
||||
chalk.green.dim(' successfully.')
|
||||
);
|
||||
|
||||
await bundle.write(output);
|
||||
|
||||
};
|
||||
console.timeEnd('rollup build');
|
||||
|
||||
checkBundleCode(singleConfig);
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
await run();
|
||||
}
|
||||
catch (err) {
|
||||
console.log(chalk.red('BUILD ERROR!'));
|
||||
// rollup parse error.
|
||||
if (err) {
|
||||
if (err.loc) {
|
||||
console.warn(chalk.red(`${err.loc.file} (${err.loc.line}:${err.loc.column})`));
|
||||
console.warn(chalk.red(err.message));
|
||||
}
|
||||
if (err.frame) {
|
||||
console.warn(chalk.red(err.frame));
|
||||
}
|
||||
console.log(chalk.red(err ? err.stack : err));
|
||||
|
||||
err.id != null && console.warn(chalk.red(`id: ${err.id}`));
|
||||
err.hook != null && console.warn(chalk.red(`hook: ${err.hook}`));
|
||||
err.code != null && console.warn(chalk.red(`code: ${err.code}`));
|
||||
err.plugin != null && console.warn(chalk.red(`plugin: ${err.plugin}`));
|
||||
}
|
||||
// console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
const nodeResolvePlugin = require('@rollup/plugin-node-resolve').default;
|
||||
const nodePath = require('path');
|
||||
const ecDir = nodePath.resolve(__dirname, '..');
|
||||
const {terser} = require('rollup-plugin-terser');
|
||||
const replace = require('@rollup/plugin-replace');
|
||||
const MagicString = require('magic-string');
|
||||
const preamble = require('./preamble');
|
||||
|
||||
function createAddLicensePlugin(sourcemap) {
|
||||
return {
|
||||
renderChunk(code, chunk) {
|
||||
const s = new MagicString(code);
|
||||
s.prepend(preamble.js);
|
||||
return {
|
||||
code: s.toString(),
|
||||
map: sourcemap ? s.generateMap({ hires: true }).toString() : null
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createOutputs(basename, { min }, commonOutputOpts) {
|
||||
commonOutputOpts = {
|
||||
format: 'umd',
|
||||
...commonOutputOpts
|
||||
}
|
||||
function createReplacePlugin(replacement) {
|
||||
const plugin = replace({
|
||||
'process.env.NODE_ENV': JSON.stringify(replacement)
|
||||
});
|
||||
// Remove transform hook. It will have warning when using in output
|
||||
delete plugin.transform;
|
||||
return plugin;
|
||||
}
|
||||
const output = [{
|
||||
...commonOutputOpts,
|
||||
// Disable sourcemap in
|
||||
sourcemap: true,
|
||||
plugins: [
|
||||
createReplacePlugin('development'),
|
||||
createAddLicensePlugin(true)
|
||||
],
|
||||
file: basename + '.js'
|
||||
}];
|
||||
|
||||
if (min) {
|
||||
output.push({
|
||||
...commonOutputOpts,
|
||||
// Disable sourcemap in min file.
|
||||
sourcemap: false,
|
||||
// TODO preamble
|
||||
plugins: [
|
||||
createReplacePlugin('production'),
|
||||
terser(),
|
||||
createAddLicensePlugin(false)
|
||||
],
|
||||
file: basename + '.min.js'
|
||||
})
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} [opt]
|
||||
* @param {string} [opt.type=''] 'all' or 'simple' or 'common', default is 'all'
|
||||
* @param {boolean} [opt.sourcemap] If set, `opt.input` is required too, and `opt.type` is ignored.
|
||||
* @param {string} [opt.format='umd'] If set, `opt.input` is required too, and `opt.type` is ignored.
|
||||
* @param {string} [opt.min=false] If build minified output
|
||||
* @param {boolean} [opt.addBundleVersion=false] Only for debug in watch, prompt that the two build is different.
|
||||
*/
|
||||
exports.createECharts = function (opt = {}) {
|
||||
const srcType = opt.type !== 'all' ? '.' + opt.type : '';
|
||||
const postfixType = srcType;
|
||||
const format = opt.format || 'umd';
|
||||
const postfixFormat = (format !== 'umd') ? '.' + format.toLowerCase() : '';
|
||||
|
||||
const input = nodePath.resolve(ecDir, `index${srcType}.js`);
|
||||
|
||||
return {
|
||||
plugins: [nodeResolvePlugin()],
|
||||
treeshake: {
|
||||
moduleSideEffects: false
|
||||
},
|
||||
|
||||
input: input,
|
||||
|
||||
output: createOutputs(
|
||||
nodePath.resolve(ecDir, `dist/echarts${postfixFormat}${postfixType}`),
|
||||
opt,
|
||||
{
|
||||
name: 'echarts',
|
||||
// Ignore default exports, which is only for compitable code like:
|
||||
// import echarts from 'echarts/lib/echarts';
|
||||
exports: 'named',
|
||||
format: format
|
||||
}
|
||||
)
|
||||
};
|
||||
};
|
||||
|
||||
exports.createBMap = function (opt) {
|
||||
const input = nodePath.resolve(ecDir, `extension/bmap/bmap.js`);
|
||||
|
||||
return {
|
||||
plugins: [nodeResolvePlugin()],
|
||||
input: input,
|
||||
external: ['echarts'],
|
||||
output: createOutputs(
|
||||
nodePath.resolve(ecDir, `dist/extension/bmap`),
|
||||
opt,
|
||||
{
|
||||
name: 'bmap',
|
||||
globals: {
|
||||
// For UMD `global.echarts`
|
||||
echarts: 'echarts'
|
||||
}
|
||||
}
|
||||
)
|
||||
};
|
||||
};
|
||||
|
||||
exports.createDataTool = function (opt) {
|
||||
let input = nodePath.resolve(ecDir, `extension/dataTool/index.js`);
|
||||
|
||||
return {
|
||||
plugins: [nodeResolvePlugin()],
|
||||
input: input,
|
||||
external: ['echarts'],
|
||||
output: createOutputs(
|
||||
nodePath.resolve(ecDir, `dist/extension/dataTool`),
|
||||
opt,
|
||||
{
|
||||
name: 'dataTool',
|
||||
globals: {
|
||||
// For UMD `global.echarts`
|
||||
echarts: 'echarts'
|
||||
}
|
||||
}
|
||||
)
|
||||
};
|
||||
};
|
||||
|
||||
exports.createMyTransform = function (opt) {
|
||||
let input = nodePath.resolve(ecDir, `test/lib/myTransform/src/index.ts`);
|
||||
|
||||
return {
|
||||
plugins: [nodeResolvePlugin()],
|
||||
input: input,
|
||||
output: createOutputs(
|
||||
nodePath.resolve(ecDir, `test/lib/myTransform/dist/myTransform`),
|
||||
opt,
|
||||
{
|
||||
name: 'myTransform'
|
||||
}
|
||||
)
|
||||
};
|
||||
};
|
@ -0,0 +1,93 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
const chokidar = require('chokidar');
|
||||
const path = require('path');
|
||||
const {build} = require('esbuild');
|
||||
const fs = require('fs');
|
||||
const debounce = require('lodash.debounce');
|
||||
|
||||
const outFilePath = path.resolve(__dirname, '../dist/echarts.js');
|
||||
|
||||
const umdMark = '// ------------- WRAPPED UMD --------------- //';
|
||||
const umdWrapperHead = `
|
||||
${umdMark}
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['exports'], factory);
|
||||
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
|
||||
// CommonJS
|
||||
factory(exports);
|
||||
} else {
|
||||
// Browser globals
|
||||
factory((root.echarts = {}));
|
||||
}
|
||||
}(typeof self !== 'undefined' ? self : this, function (exports, b) {
|
||||
`;
|
||||
|
||||
const umdWrapperTail = `
|
||||
}));`;
|
||||
|
||||
async function wrapUMDCode() {
|
||||
const code = fs.readFileSync(outFilePath, 'utf-8');
|
||||
if (code.indexOf(umdMark) >= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
fs.writeFileSync(
|
||||
outFilePath,
|
||||
// Replaced __DEV__ with a same length string to avoid breaking source map
|
||||
umdWrapperHead + code.replace(/__DEV__/g, "\'_DEV_\'") + umdWrapperTail,
|
||||
'utf-8'
|
||||
);
|
||||
|
||||
const sourceMap = JSON.parse(fs.readFileSync(outFilePath + '.map', 'utf-8'));
|
||||
// Fast trick for fixing source map
|
||||
sourceMap.mappings = umdWrapperHead.split('\n').map(() => '').join(';') + sourceMap.mappings;
|
||||
|
||||
fs.writeFileSync(outFilePath + '.map', JSON.stringify(sourceMap), 'utf-8');
|
||||
}
|
||||
|
||||
function rebuild() {
|
||||
build({
|
||||
// stdio: 'inherit',
|
||||
entryPoints: [path.resolve(__dirname, '../src/echarts.all.ts')],
|
||||
outfile: outFilePath,
|
||||
format: 'cjs',
|
||||
sourcemap: true,
|
||||
bundle: true,
|
||||
}).catch(e => {
|
||||
console.error(e.toString());
|
||||
}).then(async () => {
|
||||
console.time('Wrap UMD');
|
||||
await wrapUMDCode();
|
||||
console.timeEnd('Wrap UMD');
|
||||
})
|
||||
}
|
||||
|
||||
const debouncedRebuild = debounce(rebuild, 100);
|
||||
|
||||
chokidar.watch([
|
||||
path.resolve(__dirname, '../src/**/*.ts'),
|
||||
path.resolve(__dirname, '../node_modules/zrender/src/**/*.ts'),
|
||||
], {
|
||||
persistent: true
|
||||
}).on('all', debouncedRebuild);
|
@ -0,0 +1,419 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* [Create CommonJS files]:
|
||||
* Compatible with prevoius folder structure: `echarts/lib` exists in `node_modules`
|
||||
* (1) Build all files to CommonJS to `echarts/lib`.
|
||||
* (2) Remove __DEV__.
|
||||
* (3) Mount `echarts/src/export.js` to `echarts/lib/echarts.js`.
|
||||
*
|
||||
* [Create ESModule files]:
|
||||
* Build all files to CommonJS to `echarts/esm`.
|
||||
*/
|
||||
|
||||
const nodePath = require('path');
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
const fsExtra = require('fs-extra');
|
||||
const chalk = require('chalk');
|
||||
const ts = require('typescript');
|
||||
const globby = require('globby');
|
||||
const transformDEVUtil = require('./transform-dev');
|
||||
const preamble = require('./preamble');
|
||||
const dts = require('@lang/rollup-plugin-dts').default;
|
||||
const rollup = require('rollup');
|
||||
|
||||
const ecDir = nodePath.resolve(__dirname, '..');
|
||||
const tmpDir = nodePath.resolve(ecDir, 'pre-publish-tmp');
|
||||
|
||||
const tsConfig = readTSConfig();
|
||||
|
||||
const autoGeneratedFileAlert = `
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
`;
|
||||
|
||||
const mainSrcGlobby = {
|
||||
patterns: [
|
||||
'src/**/*.ts'
|
||||
],
|
||||
cwd: ecDir
|
||||
};
|
||||
const extensionSrcGlobby = {
|
||||
patterns: [
|
||||
'extension-src/**/*.ts'
|
||||
],
|
||||
cwd: ecDir
|
||||
};
|
||||
const extensionSrcDir = nodePath.resolve(ecDir, 'extension-src');
|
||||
const extensionESMDir = nodePath.resolve(ecDir, 'extension');
|
||||
|
||||
const typesDir = nodePath.resolve(ecDir, 'types');
|
||||
const esmDir = 'lib';
|
||||
|
||||
|
||||
const compileWorkList = [
|
||||
{
|
||||
logLabel: 'main ts -> js-esm',
|
||||
compilerOptionsOverride: {
|
||||
module: 'ES2015',
|
||||
rootDir: ecDir,
|
||||
outDir: tmpDir,
|
||||
// Generate types when buidling esm
|
||||
declaration: true,
|
||||
declarationDir: typesDir
|
||||
},
|
||||
srcGlobby: mainSrcGlobby,
|
||||
transformOptions: {
|
||||
filesGlobby: {patterns: ['**/*.js'], cwd: tmpDir},
|
||||
preamble: preamble.js,
|
||||
transformDEV: true
|
||||
},
|
||||
before: async function () {
|
||||
fsExtra.removeSync(tmpDir);
|
||||
fsExtra.removeSync(nodePath.resolve(ecDir, 'types'));
|
||||
fsExtra.removeSync(nodePath.resolve(ecDir, esmDir));
|
||||
fsExtra.removeSync(nodePath.resolve(ecDir, 'index.js'));
|
||||
fsExtra.removeSync(nodePath.resolve(ecDir, 'index.blank.js'));
|
||||
fsExtra.removeSync(nodePath.resolve(ecDir, 'index.common.js'));
|
||||
fsExtra.removeSync(nodePath.resolve(ecDir, 'index.simple.js'));
|
||||
},
|
||||
after: async function () {
|
||||
fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.all.js'), nodePath.resolve(ecDir, 'index.js'));
|
||||
fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.blank.js'), nodePath.resolve(ecDir, 'index.blank.js'));
|
||||
fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.common.js'), nodePath.resolve(ecDir, 'index.common.js'));
|
||||
fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.simple.js'), nodePath.resolve(ecDir, 'index.simple.js'));
|
||||
fs.renameSync(nodePath.resolve(tmpDir, 'src'), nodePath.resolve(ecDir, esmDir));
|
||||
|
||||
transformRootFolderInEntry(nodePath.resolve(ecDir, 'index.js'), esmDir);
|
||||
transformRootFolderInEntry(nodePath.resolve(ecDir, 'index.blank.js'), esmDir);
|
||||
transformRootFolderInEntry(nodePath.resolve(ecDir, 'index.common.js'), esmDir);
|
||||
transformRootFolderInEntry(nodePath.resolve(ecDir, 'index.simple.js'), esmDir);
|
||||
|
||||
await transformDistributionFiles(nodePath.resolve(ecDir, esmDir), esmDir);
|
||||
await transformDistributionFiles(nodePath.resolve(ecDir, 'types'), esmDir);
|
||||
fsExtra.removeSync(tmpDir);
|
||||
}
|
||||
},
|
||||
{
|
||||
logLabel: 'extension ts -> js-esm',
|
||||
compilerOptionsOverride: {
|
||||
module: 'ES2015',
|
||||
rootDir: extensionSrcDir,
|
||||
outDir: extensionESMDir
|
||||
},
|
||||
srcGlobby: extensionSrcGlobby,
|
||||
transformOptions: {
|
||||
filesGlobby: {patterns: ['**/*.js'], cwd: extensionESMDir},
|
||||
preamble: preamble.js,
|
||||
transformDEV: true
|
||||
},
|
||||
before: async function () {
|
||||
fsExtra.removeSync(extensionESMDir);
|
||||
},
|
||||
after: async function () {
|
||||
await transformDistributionFiles(extensionESMDir, 'lib');
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
module.exports = async function () {
|
||||
|
||||
for (let {
|
||||
logLabel, compilerOptionsOverride, srcGlobby,
|
||||
transformOptions, before, after
|
||||
} of compileWorkList) {
|
||||
|
||||
process.stdout.write(chalk.green.dim(`[${logLabel}]: compiling ...`));
|
||||
|
||||
before && await before();
|
||||
|
||||
let srcPathList = await readFilePaths(srcGlobby);
|
||||
|
||||
await tsCompile(compilerOptionsOverride, srcPathList);
|
||||
|
||||
process.stdout.write(chalk.green.dim(` done \n`));
|
||||
|
||||
process.stdout.write(chalk.green.dim(`[${logLabel}]: transforming ...`));
|
||||
|
||||
await transformCode(transformOptions);
|
||||
|
||||
after && await after();
|
||||
|
||||
process.stdout.write(chalk.green.dim(` done \n`));
|
||||
}
|
||||
|
||||
process.stdout.write(chalk.green.dim(`Generating entries ...`));
|
||||
generateEntries();
|
||||
process.stdout.write(chalk.green.dim(`Bundling DTS ...`));
|
||||
await bundleDTS();
|
||||
|
||||
console.log(chalk.green.dim('All done.'));
|
||||
};
|
||||
|
||||
async function runTsCompile(localTs, compilerOptions, srcPathList) {
|
||||
// Must do it. becuase the value in tsconfig.json might be different from the inner representation.
|
||||
// For example: moduleResolution: "NODE" => moduleResolution: 2
|
||||
const {options, errors} = localTs.convertCompilerOptionsFromJson(compilerOptions, ecDir);
|
||||
|
||||
if (errors.length) {
|
||||
let errMsg = 'tsconfig parse failed: '
|
||||
+ errors.map(error => error.messageText).join('. ')
|
||||
+ '\n compilerOptions: \n' + JSON.stringify(compilerOptions, null, 4);
|
||||
assert(false, errMsg);
|
||||
}
|
||||
|
||||
// See: https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API
|
||||
|
||||
let program = localTs.createProgram(srcPathList, options);
|
||||
let emitResult = program.emit();
|
||||
|
||||
let allDiagnostics = localTs
|
||||
.getPreEmitDiagnostics(program)
|
||||
.concat(emitResult.diagnostics);
|
||||
|
||||
allDiagnostics.forEach(diagnostic => {
|
||||
if (diagnostic.file) {
|
||||
let {line, character} = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
let message = localTs.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
||||
console.log(chalk.red(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`));
|
||||
}
|
||||
else {
|
||||
console.log(chalk.red(localTs.flattenDiagnosticMessageText(diagnostic.messageText, '\n')));
|
||||
}
|
||||
});
|
||||
assert(!emitResult.emitSkipped, 'ts compile failed.');
|
||||
}
|
||||
module.exports.runTsCompile = runTsCompile;
|
||||
|
||||
async function tsCompile(compilerOptionsOverride, srcPathList) {
|
||||
assert(
|
||||
compilerOptionsOverride
|
||||
&& compilerOptionsOverride.module
|
||||
&& compilerOptionsOverride.rootDir
|
||||
&& compilerOptionsOverride.outDir
|
||||
);
|
||||
|
||||
let compilerOptions = {
|
||||
...tsConfig.compilerOptions,
|
||||
...compilerOptionsOverride,
|
||||
sourceMap: false
|
||||
};
|
||||
|
||||
runTsCompile(ts, compilerOptions, srcPathList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform import/require path in the entry file to `esm` or `lib`.
|
||||
*/
|
||||
function transformRootFolderInEntry(entryFile, replacement) {
|
||||
let code = fs.readFileSync(entryFile, 'utf-8');
|
||||
// Simple regex replacement
|
||||
// TODO More robust way?
|
||||
assert(
|
||||
!/(import\s+|from\s+|require\(\s*)["']\.\/echarts\./.test(code)
|
||||
&& !/(import\s+|from\s+|require\(\s*)["']echarts\./.test(code),
|
||||
'Import echarts.xxx.ts is not supported.'
|
||||
);
|
||||
code = code.replace(/((import\s+|from\s+|require\(\s*)["'])\.\//g, `$1./${replacement}/`);
|
||||
fs.writeFileSync(
|
||||
entryFile,
|
||||
// Also transform zrender.
|
||||
singleTransformZRRootFolder(code, replacement),
|
||||
'utf-8'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform `zrender/src` to `zrender/esm` in all files
|
||||
*/
|
||||
async function transformDistributionFiles(rooltFolder, replacement) {
|
||||
const files = await readFilePaths({
|
||||
patterns: ['**/*.js', '**/*.d.ts'],
|
||||
cwd: rooltFolder
|
||||
});
|
||||
// Simple regex replacement
|
||||
// TODO More robust way?
|
||||
for (let fileName of files) {
|
||||
let code = fs.readFileSync(fileName, 'utf-8');
|
||||
code = singleTransformZRRootFolder(code, replacement);
|
||||
// For lower ts version, not use import type
|
||||
// TODO Use https://github.com/sandersn/downlevel-dts ?
|
||||
// if (fileName.endsWith('.d.ts')) {
|
||||
// code = singleTransformImportType(code);
|
||||
// }
|
||||
fs.writeFileSync(fileName, code, 'utf-8');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove __esModule mark.
|
||||
*
|
||||
* In the 4.x version. The exported CJS don't have __esModule mark.
|
||||
* Developers can use `import echarts from 'echarts/lib/echarts' instead of
|
||||
* `import * as echarts from 'echarts/lib/echarts'` to import all the exported methods.
|
||||
* It's not recommand but developers may still have the chance to do it.
|
||||
* But in the tsc export with __esModule mark. This will get an undefined export.
|
||||
* To avoid breaking this kind of code. We remove __esModule mark manually here.
|
||||
*/
|
||||
function removeESmoduleMark() {
|
||||
const filePath = nodePath.resolve(ecDir, 'lib/echarts.js');
|
||||
const code = fs.readFileSync(filePath, 'utf-8')
|
||||
.replace('\nexports.__esModule = true;\n', '');
|
||||
if (code.indexOf('__esModule') >= 0) {
|
||||
throw new Error('Seems still has __esModule mark');
|
||||
}
|
||||
fs.writeFileSync(filePath, code, 'utf-8');
|
||||
}
|
||||
|
||||
function singleTransformZRRootFolder(code, replacement) {
|
||||
return code.replace(/([\"\'])zrender\/src\//g, `$1zrender/${replacement}/`);
|
||||
}
|
||||
|
||||
// function singleTransformImportType(code) {
|
||||
// return code.replace(/import\s+type\s+/g, 'import ');
|
||||
// }
|
||||
|
||||
/**
|
||||
* @param {Object} transformOptions
|
||||
* @param {Object} transformOptions.filesGlobby {patterns: string[], cwd: string}
|
||||
* @param {string} [transformOptions.preamble] See './preamble.js'
|
||||
* @param {boolean} [transformOptions.transformDEV]
|
||||
*/
|
||||
async function transformCode({filesGlobby, preamble, transformDEV}) {
|
||||
|
||||
let filePaths = await readFilePaths(filesGlobby);
|
||||
|
||||
filePaths.map(filePath => {
|
||||
let code = fs.readFileSync(filePath, 'utf8');
|
||||
|
||||
if (transformDEV) {
|
||||
let result = transformDEVUtil.transform(code, false);
|
||||
code = result.code;
|
||||
}
|
||||
|
||||
code = autoGeneratedFileAlert + code;
|
||||
|
||||
if (preamble) {
|
||||
code = preamble + code;
|
||||
}
|
||||
|
||||
fs.writeFileSync(filePath, code, 'utf8');
|
||||
});
|
||||
}
|
||||
|
||||
async function readFilePaths({patterns, cwd}) {
|
||||
assert(patterns && cwd);
|
||||
return (
|
||||
await globby(patterns, {cwd})
|
||||
).map(
|
||||
srcPath => nodePath.resolve(cwd, srcPath)
|
||||
);
|
||||
}
|
||||
|
||||
async function bundleDTS() {
|
||||
|
||||
const outDir = nodePath.resolve(__dirname, '../types/dist');
|
||||
const commonConfig = {
|
||||
onwarn(warning, rollupWarn) {
|
||||
// Not warn circular dependency
|
||||
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
|
||||
rollupWarn(warning);
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
dts({
|
||||
respectExternal: true
|
||||
})
|
||||
// {
|
||||
// generateBundle(options, bundle) {
|
||||
// for (let chunk of Object.values(bundle)) {
|
||||
// chunk.code = `
|
||||
// type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||
// ${chunk.code}`
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
]
|
||||
};
|
||||
|
||||
// Bundle chunks.
|
||||
const parts = [
|
||||
'core', 'charts', 'components', 'renderers', 'option'
|
||||
];
|
||||
const inputs = {};
|
||||
parts.forEach(partName => {
|
||||
inputs[partName] = nodePath.resolve(__dirname, `../types/src/export/${partName}.d.ts`)
|
||||
});
|
||||
|
||||
const bundle = await rollup.rollup({
|
||||
input: inputs,
|
||||
...commonConfig
|
||||
});
|
||||
let idx = 1;
|
||||
await bundle.write({
|
||||
dir: outDir,
|
||||
minifyInternalExports: false,
|
||||
manualChunks: (id) => {
|
||||
// Only create one chunk.
|
||||
return 'shared';
|
||||
},
|
||||
chunkFileNames: 'shared.d.ts'
|
||||
});
|
||||
|
||||
// Bundle all in one
|
||||
const bundleAllInOne = await rollup.rollup({
|
||||
input: nodePath.resolve(__dirname, `../types/src/export/all.d.ts`),
|
||||
...commonConfig
|
||||
});
|
||||
await bundleAllInOne.write({
|
||||
file: nodePath.resolve(outDir, 'echarts.d.ts')
|
||||
});
|
||||
}
|
||||
|
||||
function readTSConfig() {
|
||||
// tsconfig.json may have comment string, which is invalid if
|
||||
// using `require('tsconfig.json'). So we use a loose parser.
|
||||
let filePath = nodePath.resolve(ecDir, 'tsconfig.json');
|
||||
const tsConfigText = fs.readFileSync(filePath, {encoding: 'utf8'});
|
||||
return (new Function(`return ( ${tsConfigText} )`))();
|
||||
}
|
||||
|
||||
|
||||
function generateEntries() {
|
||||
['charts', 'components', 'renderers', 'core'].forEach(entryName => {
|
||||
if (entryName !== 'option') {
|
||||
const jsCode = fs.readFileSync(nodePath.join(__dirname, `template/${entryName}.js`), 'utf-8');
|
||||
fs.writeFileSync(nodePath.join(__dirname, `../${entryName}.js`), jsCode, 'utf-8');
|
||||
}
|
||||
|
||||
const dtsCode = fs.readFileSync(nodePath.join(__dirname, `/template/${entryName}.d.ts`), 'utf-8');
|
||||
fs.writeFileSync(nodePath.join(__dirname, `../${entryName}.d.ts`), dtsCode, 'utf-8');
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.readTSConfig = readTSConfig;
|
@ -0,0 +1,231 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
const cStyleComment = `
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
`;
|
||||
|
||||
const hashComment = `
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
`;
|
||||
|
||||
const mlComment = `
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
`;
|
||||
|
||||
function hasPreamble(fileExt) {
|
||||
return fileExt && preambleMap[fileExt];
|
||||
}
|
||||
|
||||
function addPreamble(fileStr, fileExt) {
|
||||
if (fileStr && fileExt) {
|
||||
const addFn = addFns[fileExt];
|
||||
const headStr = preambleMap[fileExt];
|
||||
return addFn && headStr && addFn(headStr, fileStr);
|
||||
}
|
||||
}
|
||||
|
||||
const addFns = {
|
||||
|
||||
ts: function (headStr, fileStr) {
|
||||
return headStr + fileStr;
|
||||
},
|
||||
|
||||
js: function (headStr, fileStr) {
|
||||
return headStr + fileStr;
|
||||
},
|
||||
|
||||
css: function (headStr, fileStr) {
|
||||
return headStr + fileStr;
|
||||
},
|
||||
|
||||
java: function (headStr, fileStr) {
|
||||
return headStr + fileStr;
|
||||
},
|
||||
|
||||
yml: addShellLikeHeader,
|
||||
|
||||
yaml: addShellLikeHeader,
|
||||
|
||||
sh: addShellLikeHeader,
|
||||
|
||||
html: function (headStr, fileStr) {
|
||||
// Git diff enables manual check.
|
||||
let resultStr = fileStr.replace(/^\s*<!DOCTYPE\s[^<>]+>/i, '$&' + headStr);
|
||||
// If no doctype
|
||||
if (resultStr.length === fileStr.length) {
|
||||
resultStr = headStr + fileStr;
|
||||
}
|
||||
return resultStr;
|
||||
},
|
||||
|
||||
xml: xmlAddFn,
|
||||
|
||||
xsl: xmlAddFn
|
||||
};
|
||||
|
||||
function addShellLikeHeader(headStr, fileStr) {
|
||||
// Git diff enables manual check.
|
||||
if (/^#\!/.test(fileStr)) {
|
||||
const lines = fileStr.split('\n');
|
||||
lines.splice(1, 0, headStr);
|
||||
return lines.join('\n');
|
||||
}
|
||||
else {
|
||||
return headStr + fileStr;
|
||||
}
|
||||
}
|
||||
|
||||
function xmlAddFn(headStr, fileStr) {
|
||||
// Git diff enables manual check.
|
||||
let resultStr = fileStr.replace(/^\s*<\?xml\s[^<>]+\?>/i, '$&' + headStr);
|
||||
// If no <?xml version='1.0' ?>
|
||||
if (resultStr.length === fileStr.length) {
|
||||
resultStr = headStr + fileStr;
|
||||
}
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
const preambleMap = {
|
||||
ts: cStyleComment,
|
||||
js: cStyleComment,
|
||||
css: cStyleComment,
|
||||
java: cStyleComment,
|
||||
yml: hashComment,
|
||||
yaml: hashComment,
|
||||
sh: hashComment,
|
||||
html: mlComment,
|
||||
xml: mlComment,
|
||||
xsl: mlComment
|
||||
};
|
||||
|
||||
const licenseReg = [
|
||||
{name: 'Apache', reg: /apache (license|commons)/i},
|
||||
{name: 'BSD', reg: /BSD/},
|
||||
{name: 'LGPL', reg: /LGPL/},
|
||||
{name: 'GPL', reg: /GPL/},
|
||||
{name: 'Mozilla', reg: /mozilla public/i},
|
||||
{name: 'MIT', reg: /mit license/i},
|
||||
{name: 'BSD-d3', reg: /Copyright\s+\(c\)\s+2010-2015,\s+Michael\s+Bostock/i}
|
||||
];
|
||||
|
||||
function extractLicense(fileStr, fileExt) {
|
||||
let commentText = extractComment(fileStr.trim(), fileExt);
|
||||
if (!commentText) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < licenseReg.length; i++) {
|
||||
if (licenseReg[i].reg.test(commentText)) {
|
||||
return licenseReg[i].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const cStyleCommentReg = /\/\*[\S\s]*?\*\//;
|
||||
const hashCommentReg = /^\s*#.*$/gm;
|
||||
const mlCommentReg = /<\!\-\-[\S\s]*?\-\->/;
|
||||
const commentReg = {
|
||||
ts: cStyleCommentReg,
|
||||
js: cStyleCommentReg,
|
||||
css: cStyleCommentReg,
|
||||
java: cStyleCommentReg,
|
||||
yml: hashCommentReg,
|
||||
yaml: hashCommentReg,
|
||||
sh: hashCommentReg,
|
||||
html: mlCommentReg,
|
||||
xml: mlCommentReg,
|
||||
xsl: mlCommentReg
|
||||
};
|
||||
|
||||
function extractComment(str, fileExt) {
|
||||
const reg = commentReg[fileExt];
|
||||
|
||||
if (!fileExt || !reg || !str) {
|
||||
return;
|
||||
}
|
||||
|
||||
reg.lastIndex = 0;
|
||||
|
||||
if (fileExt === 'sh' || fileExt === 'yml' || fileExt === 'yaml') {
|
||||
let result = str.match(reg);
|
||||
return result && result.join('\n');
|
||||
}
|
||||
else {
|
||||
let result = reg.exec(str);
|
||||
return result && result[0];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Object.assign({
|
||||
extractLicense,
|
||||
hasPreamble,
|
||||
addPreamble
|
||||
}, preambleMap);
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './types/dist/charts';
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
// In somehow. If we export like
|
||||
// export * as LineChart './chart/line/install'
|
||||
// The exported code will be transformed to
|
||||
// import * as LineChart_1 './chart/line/install'; export {LineChart_1 as LineChart};
|
||||
// Treeshaking in webpack will not work even if we configured sideEffects to false in package.json
|
||||
|
||||
export * from './lib/export/charts';
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './types/dist/components';
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './lib/export/components';
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './types/dist/core';
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './lib/export/core';
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './types/dist/option';
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './types/dist/renderers';
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './lib/export/renderers';
|
@ -0,0 +1,75 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
const { TypeScriptVersion } = require('@definitelytyped/typescript-versions');
|
||||
const {
|
||||
cleanTypeScriptInstalls,
|
||||
installAllTypeScriptVersions,
|
||||
typeScriptPath
|
||||
} = require('@definitelytyped/utils');
|
||||
const { runTsCompile } = require('./pre-publish');
|
||||
const globby = require('globby');
|
||||
const semver = require('semver');
|
||||
|
||||
const MIN_VERSION = '3.5.0';
|
||||
|
||||
async function installTs() {
|
||||
// await cleanTypeScriptInstalls();
|
||||
await installAllTypeScriptVersions();
|
||||
}
|
||||
|
||||
async function runTests() {
|
||||
const compilerOptions = {
|
||||
declaration: false,
|
||||
importHelpers: false,
|
||||
sourceMap: false,
|
||||
pretty: false,
|
||||
removeComments: false,
|
||||
allowJs: false,
|
||||
outDir: __dirname + '/../test/types/tmp',
|
||||
typeRoots: [__dirname + '/../types/dist'],
|
||||
rootDir: __dirname + '/../test/types',
|
||||
|
||||
// Must pass in most strict cases
|
||||
strict: true
|
||||
};
|
||||
const testsList = await globby(__dirname + '/../test/types/*.ts');
|
||||
|
||||
for (let version of TypeScriptVersion.shipped) {
|
||||
if (semver.lt(version + '.0', MIN_VERSION)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log(`Testing ts version ${version}`);
|
||||
const ts = require(typeScriptPath(version));
|
||||
await runTsCompile(ts, compilerOptions, testsList);
|
||||
|
||||
console.log(`Finished test of ts version ${version}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await installTs();
|
||||
await runTests();
|
||||
}
|
||||
|
||||
module.exports = main;
|
||||
|
||||
main();
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
const babel = require('@babel/core');
|
||||
const parser = require('@babel/parser');
|
||||
|
||||
function transformDEVPlugin ({types, template}) {
|
||||
return {
|
||||
visitor: {
|
||||
Identifier: {
|
||||
enter(path, state) {
|
||||
if (path.isIdentifier({ name: '__DEV__' }) && path.scope.hasGlobal('__DEV__')) {
|
||||
path.replaceWith(
|
||||
parser.parseExpression(state.opts.expr)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
module.exports.transform = function (sourceCode, sourcemap, expr) {
|
||||
let {code, map} = babel.transformSync(sourceCode, {
|
||||
plugins: [ [transformDEVPlugin, {
|
||||
expr: expr || 'process.env.NODE_ENV !== \'production\''
|
||||
}] ],
|
||||
compact: false,
|
||||
sourceMaps: sourcemap
|
||||
});
|
||||
|
||||
return {code, map};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} code
|
||||
* @throws {Error} If check failed.
|
||||
*/
|
||||
module.exports.recheckDEV = function (code) {
|
||||
return code.indexOf('process.env.NODE_ENV') >= 0;
|
||||
};
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './types/dist/charts';
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
// In somehow. If we export like
|
||||
// export * as LineChart './chart/line/install'
|
||||
// The exported code will be transformed to
|
||||
// import * as LineChart_1 './chart/line/install'; export {LineChart_1 as LineChart};
|
||||
// Treeshaking in webpack will not work even if we configured sideEffects to false in package.json
|
||||
|
||||
export * from './lib/export/charts';
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './types/dist/components';
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './lib/export/components';
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './types/dist/core';
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './lib/export/core';
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue