cloudflare / collapsify Goto Github PK
View Code? Open in Web Editor NEWCollapsify inlines all the resources of a page into a single document
Home Page: https://github.com/cloudflare/collapsify
License: MIT License
Collapsify inlines all the resources of a page into a single document
Home Page: https://github.com/cloudflare/collapsify
License: MIT License
It looks like this is your first time opening an issue in this project!
Seeing the following warning when running this command :
./cli.js --verbose=2 URL
DBUG[0001] [collapsify:http] Fetching ...
Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`
DBUG[0044] [collapsify:http] Fetching ...
Bit rot seems to be setting in ๐ข
This project cannot be npm install
ed with Node 12/lts nor node 13.
Here are a few test cases
FROM node:10-buster-slim
RUN apt update && apt install -y build-essential python
RUN mkdir /testcase&& cd /testcase && npm init -y && npm install --save-dev collapsify
succeeds with:
... snip ...
---> 41d0e2ee15adk
Successfully built 41d0e2ee15ad
FROM node:12-buster-slim
RUN apt update && apt install -y build-essential python
RUN mkdir /testcase&& cd /testcase && npm init -y && npm install --save-dev collapsify
../src/fds-unix.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE nonblock(Nan::NAN_METHOD_ARGS_TYPE)':
../src/fds-unix.cc:10:33: error: no matching function for call to 'v8::Value::Uint32Value()'
int fd = info[0]->Uint32Value();
^
In file included from /root/.cache/node-gyp/12.16.1/include/node/node.h:63,
from ../../nan/nan.h:54,
from ../src/fds-unix.cc:1:
/root/.cache/node-gyp/12.16.1/include/node/v8.h:2707:41: note: candidate: 'v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const'
V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
^~~~~~~~~~~
FROM node:13-buster-slim
RUN apt update && apt install -y build-essential python
RUN mkdir /testcase&& cd /testcase && npm init -y && npm install --save-dev collapsify
fails with:
../src/fds-unix.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE nonblock(Nan::NAN_METHOD_ARGS_TYPE)':
../src/fds-unix.cc:10:33: error: no matching function for call to 'v8::Value::Uint32Value()'
int fd = info[0]->Uint32Value();
^
In file included from /root/.cache/node-gyp/13.8.0/include/node/node.h:63,
from ../../nan/nan.h:54,
from ../src/fds-unix.cc:1:
/root/.cache/node-gyp/13.8.0/include/node/v8.h:2776:41: note: candidate: 'v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const'
V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
Save them to a tmp dir and execute them with docker build Dockefile.XX .
I can see in the package.json
(etc) for this repo and in npm that the latest version of this package is 0.7.0
but the this version does not have an associated tag pushed or release published to Github, nor is there a changelog. Has something fallen out of sync here? Having this meta information available in the Github repo would help a lot with making the decision on when / if we should update our dependencies.
As an Enterprise customer we ran across an issue with our particular use case today - you may wish for a Cloudflare Error Page (run via collapsify) to not inline a particular image, CSS file, or script on some error pages.
It'd be awesome if it was possible to wrap exclude tags around content you wish to prevent from being inlined.
<!-- {INLINE-DISABLE} -->
<link rel="stylesheet" href="/path/to/style.css">
<img src="/path/to/img.png">
<!-- {INLINE-ENABLE} -->
The example code in the readme does not run in current versions of node. If I copy the code exactly as written into a file called collapse.js
and then run node collapse.js
, I get the following output:
internal/modules/cjs/loader.js:1102
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/cody/code/collapse/node_modules/collapsify/built/collapsify.js
require() of ES modules is not supported.
require() of /Users/cody/code/collapse/node_modules/collapsify/built/collapsify.js from /Users/cody/code/collapse/collapse.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename collapsify.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/cody/code/collapse/node_modules/collapsify/package.json.
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1102:13)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/Users/cody/code/collapse/collapse.js:2:18)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14) {
code: 'ERR_REQUIRE_ESM'
}
If I try changing the first line to import collapsify from 'collapsify';
I get:
(node:32431) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/cody/code/collapse/collapse.js:1
import collapsify from 'collapsify';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47
If I create a basic module and then try to run it, I get:
internal/modules/cjs/loader.js:929
const err = new Error(`Cannot find module '${request}'`);
^
Error: Cannot find module '/Users/cody/code/collapse/node_modules/nanoid/non-secure/index.cjs'
at createEsmNotFoundErr (internal/modules/cjs/loader.js:929:15)
at finalizeEsmResolution (internal/modules/cjs/loader.js:922:15)
at resolveExports (internal/modules/cjs/loader.js:450:14)
at Function.Module._findPath (internal/modules/cjs/loader.js:490:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/Users/cody/code/collapse/node_modules/postcss/lib/input.js:6:18)
at Module._compile (internal/modules/cjs/loader.js:1085:14) {
code: 'MODULE_NOT_FOUND',
path: '/Users/cody/code/collapse/node_modules/nanoid/package.json'
}
Cool project!
Would love to try it out but would prefer to know what license it is under before deep-diving.. :)
e.g. instead of using:
collapsify -V 2 -o test.html "http://localhost:52015/demo.html" -x ''
it'd be handy if I could use:
collapsify -V 2 -o test.html "file://demo.html" -x ''
I know I can spin up a temp web server.. But it's a bit of a pain. ๐
HTML Imports are an emerging standard that enable authors to import document fragments similarly to how CSS is imported today. It would be cool if Collapsify supported inlining HTML Imports in a sane way. For reference, another project that already makes some attempts to do this is Vulcanize.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.