├── .gitignore ├── CONNECTING.md ├── README.md ├── amplify-vue-admin-module ├── README.md ├── babel.config.js ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ └── index.html └── src │ ├── App.vue │ ├── components │ ├── Asset.vue │ ├── AssetNew.vue │ ├── Assets.vue │ ├── Header.vue │ ├── Home.vue │ ├── ImageNew.vue │ ├── Images.vue │ ├── Layout.vue │ ├── LayoutNew.vue │ ├── Layouts.vue │ ├── Page.vue │ ├── PageNew.vue │ ├── Pages.vue │ ├── Product.vue │ ├── ProductFeatures.vue │ ├── ProductNew.vue │ ├── Products.vue │ ├── Publish.vue │ ├── Settings.vue │ ├── Snippet.vue │ ├── SnippetNew.vue │ ├── Snippets.vue │ ├── TableRow.vue │ └── TableRowPublish.vue │ ├── main.js │ ├── mixins │ ├── dataAccessMixin.js │ ├── fileUploadMixin.js │ └── pageMixin.js │ ├── routes.js │ └── store.js └── sam-backend ├── DynamoDBLoader.json ├── README.md ├── build-asset ├── index.js └── package.json ├── build-page ├── index.js └── package.json ├── copy-uploaded-images ├── index.js └── package.json ├── dependencies └── nodejs │ ├── node_modules │ ├── .bin │ │ ├── he │ │ ├── html-minifier │ │ └── uglifyjs │ ├── camel-case │ │ ├── LICENSE │ │ ├── camel-case.d.ts │ │ ├── camel-case.js │ │ └── package.json │ ├── clean-css │ │ ├── History.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── index.js │ │ ├── lib │ │ │ ├── clean.js │ │ │ ├── optimizer │ │ │ │ ├── hack.js │ │ │ │ ├── level-0 │ │ │ │ │ └── optimize.js │ │ │ │ ├── level-1 │ │ │ │ │ ├── optimize.js │ │ │ │ │ ├── shorten-hex.js │ │ │ │ │ ├── shorten-hsl.js │ │ │ │ │ ├── shorten-rgb.js │ │ │ │ │ ├── sort-selectors.js │ │ │ │ │ ├── tidy-at-rule.js │ │ │ │ │ ├── tidy-block.js │ │ │ │ │ └── tidy-rules.js │ │ │ │ ├── level-2 │ │ │ │ │ ├── break-up.js │ │ │ │ │ ├── can-override.js │ │ │ │ │ ├── clone.js │ │ │ │ │ ├── compactable.js │ │ │ │ │ ├── extract-properties.js │ │ │ │ │ ├── invalid-property-error.js │ │ │ │ │ ├── is-mergeable.js │ │ │ │ │ ├── merge-adjacent.js │ │ │ │ │ ├── merge-media-queries.js │ │ │ │ │ ├── merge-non-adjacent-by-body.js │ │ │ │ │ ├── merge-non-adjacent-by-selector.js │ │ │ │ │ ├── optimize.js │ │ │ │ │ ├── properties │ │ │ │ │ │ ├── every-values-pair.js │ │ │ │ │ │ ├── find-component-in.js │ │ │ │ │ │ ├── has-inherit.js │ │ │ │ │ │ ├── is-component-of.js │ │ │ │ │ │ ├── is-mergeable-shorthand.js │ │ │ │ │ │ ├── merge-into-shorthands.js │ │ │ │ │ │ ├── optimize.js │ │ │ │ │ │ ├── override-properties.js │ │ │ │ │ │ ├── overrides-non-component-shorthand.js │ │ │ │ │ │ ├── populate-components.js │ │ │ │ │ │ ├── understandable.js │ │ │ │ │ │ └── vendor-prefixes.js │ │ │ │ │ ├── reduce-non-adjacent.js │ │ │ │ │ ├── remove-duplicate-font-at-rules.js │ │ │ │ │ ├── remove-duplicate-media-queries.js │ │ │ │ │ ├── remove-duplicates.js │ │ │ │ │ ├── remove-unused-at-rules.js │ │ │ │ │ ├── reorderable.js │ │ │ │ │ ├── restore-with-components.js │ │ │ │ │ ├── restore.js │ │ │ │ │ ├── restructure.js │ │ │ │ │ ├── rules-overlap.js │ │ │ │ │ ├── specificities-overlap.js │ │ │ │ │ ├── specificity.js │ │ │ │ │ └── tidy-rule-duplicates.js │ │ │ │ ├── remove-unused.js │ │ │ │ ├── restore-from-optimizing.js │ │ │ │ ├── validator.js │ │ │ │ └── wrap-for-optimizing.js │ │ │ ├── options │ │ │ │ ├── compatibility.js │ │ │ │ ├── fetch.js │ │ │ │ ├── format.js │ │ │ │ ├── inline-request.js │ │ │ │ ├── inline-timeout.js │ │ │ │ ├── inline.js │ │ │ │ ├── optimization-level.js │ │ │ │ ├── rebase-to.js │ │ │ │ ├── rebase.js │ │ │ │ └── rounding-precision.js │ │ │ ├── reader │ │ │ │ ├── apply-source-maps.js │ │ │ │ ├── extract-import-url-and-media.js │ │ │ │ ├── input-source-map-tracker.js │ │ │ │ ├── is-allowed-resource.js │ │ │ │ ├── load-original-sources.js │ │ │ │ ├── load-remote-resource.js │ │ │ │ ├── match-data-uri.js │ │ │ │ ├── normalize-path.js │ │ │ │ ├── read-sources.js │ │ │ │ ├── rebase-local-map.js │ │ │ │ ├── rebase-remote-map.js │ │ │ │ ├── rebase.js │ │ │ │ ├── restore-import.js │ │ │ │ └── rewrite-url.js │ │ │ ├── tokenizer │ │ │ │ ├── marker.js │ │ │ │ ├── token.js │ │ │ │ └── tokenize.js │ │ │ ├── utils │ │ │ │ ├── clone-array.js │ │ │ │ ├── format-position.js │ │ │ │ ├── has-protocol.js │ │ │ │ ├── is-data-uri-resource.js │ │ │ │ ├── is-http-resource.js │ │ │ │ ├── is-https-resource.js │ │ │ │ ├── is-import.js │ │ │ │ ├── is-remote-resource.js │ │ │ │ ├── natural-compare.js │ │ │ │ ├── override.js │ │ │ │ └── split.js │ │ │ └── writer │ │ │ │ ├── helpers.js │ │ │ │ ├── one-time.js │ │ │ │ ├── simple.js │ │ │ │ └── source-maps.js │ │ └── package.json │ ├── commander │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── Readme.md │ │ ├── index.js │ │ ├── package.json │ │ └── typings │ │ │ └── index.d.ts │ ├── he │ │ ├── LICENSE-MIT.txt │ │ ├── README.md │ │ ├── bin │ │ │ └── he │ │ ├── he.js │ │ ├── man │ │ │ └── he.1 │ │ └── package.json │ ├── html-minifier │ │ ├── LICENSE │ │ ├── README.md │ │ ├── cli.js │ │ ├── package.json │ │ ├── sample-cli-config-file.conf │ │ └── src │ │ │ ├── htmlminifier.js │ │ │ ├── htmlparser.js │ │ │ ├── tokenchain.js │ │ │ └── utils.js │ ├── lower-case │ │ ├── LICENSE │ │ ├── README.md │ │ ├── lower-case.d.ts │ │ ├── lower-case.js │ │ └── package.json │ ├── no-case │ │ ├── LICENSE │ │ ├── README.md │ │ ├── no-case.d.ts │ │ ├── no-case.js │ │ ├── package.json │ │ └── vendor │ │ │ ├── camel-case-regexp.js │ │ │ ├── camel-case-upper-regexp.js │ │ │ └── non-word-regexp.js │ ├── param-case │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── param-case.d.ts │ │ └── param-case.js │ ├── relateurl │ │ ├── README.md │ │ ├── lib │ │ │ ├── constants.js │ │ │ ├── format.js │ │ │ ├── index.js │ │ │ ├── options.js │ │ │ ├── parse │ │ │ │ ├── host.js │ │ │ │ ├── hrefInfo.js │ │ │ │ ├── index.js │ │ │ │ ├── path.js │ │ │ │ ├── port.js │ │ │ │ ├── query.js │ │ │ │ └── urlstring.js │ │ │ ├── relate │ │ │ │ ├── absolutize.js │ │ │ │ ├── findRelation.js │ │ │ │ ├── index.js │ │ │ │ └── relativize.js │ │ │ └── util │ │ │ │ ├── devlog.js │ │ │ │ ├── object.js │ │ │ │ └── path.js │ │ ├── license │ │ └── package.json │ ├── source-map │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dist │ │ │ ├── source-map.debug.js │ │ │ ├── source-map.js │ │ │ ├── source-map.min.js │ │ │ └── source-map.min.js.map │ │ ├── lib │ │ │ ├── array-set.js │ │ │ ├── base64-vlq.js │ │ │ ├── base64.js │ │ │ ├── binary-search.js │ │ │ ├── mapping-list.js │ │ │ ├── quick-sort.js │ │ │ ├── source-map-consumer.js │ │ │ ├── source-map-generator.js │ │ │ ├── source-node.js │ │ │ └── util.js │ │ ├── package.json │ │ ├── source-map.d.ts │ │ └── source-map.js │ ├── uglify-js │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bin │ │ │ └── uglifyjs │ │ ├── lib │ │ │ ├── ast.js │ │ │ ├── compress.js │ │ │ ├── minify.js │ │ │ ├── mozilla-ast.js │ │ │ ├── output.js │ │ │ ├── parse.js │ │ │ ├── propmangle.js │ │ │ ├── scope.js │ │ │ ├── sourcemap.js │ │ │ ├── transform.js │ │ │ └── utils.js │ │ ├── package.json │ │ └── tools │ │ │ ├── domprops.json │ │ │ ├── exit.js │ │ │ ├── exports.js │ │ │ ├── node.js │ │ │ └── props.html │ └── upper-case │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── upper-case.d.ts │ │ └── upper-case.js │ ├── package-lock.json │ └── package.json ├── enhance-product-page ├── index.js └── package.json ├── get-dynamodb-object ├── index.js └── package.json ├── get-dynamodb-objects ├── index.js └── package.json ├── invalidate-cloudfront-cache ├── index.js └── package.json ├── move-to-production-bucket ├── index.js └── package.json ├── put-dynamodb-object ├── index.js └── package.json ├── return-s3-post-policy ├── index.js └── package.json └── template.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # admin-module 3 | 4 | amplify-vue-admin-module/src/aws-exports.js 5 | 6 | amplify-vue-admin-module/node_modules 7 | amplify-vue-admin-module/dist 8 | amplify-vue-admin-module/amplify 9 | #amplify/\#current-cloud-backend 10 | #amplify/.config/local-* 11 | #amplify/mock-data 12 | #amplify/backend/amplify-meta.json 13 | #amplify/backend/awscloudformation 14 | amplify-vue-admin-module/build/ 15 | amplify-vue-admin-module/dist/ 16 | amplify-vue-admin-module/node_modules/ 17 | amplify-vue-admin-module/src/aws-exports.js 18 | amplify-vue-admin-module/awsconfiguration.json 19 | amplify-vue-admin-module/amplifyconfiguration.json 20 | amplify-vue-admin-module/amplify-build-config.json 21 | amplify-vue-admin-module/amplify-gradle-config.json 22 | amplify-vue-admin-module/amplifyxc.config 23 | 24 | #sam-backend 25 | sam-backend/.aws-sam 26 | sam-backend/events 27 | sam-backend/samconfig.toml 28 | 29 | # local env files 30 | .env.local 31 | .env.*.local 32 | 33 | # Log files 34 | npm-debug.log* 35 | yarn-debug.log* 36 | yarn-error.log* 37 | 38 | # Editor directories and files 39 | .idea 40 | .vscode 41 | *.suo 42 | *.ntvs* 43 | *.njsproj 44 | *.sln 45 | *.sw? 46 | *.DS_Store 47 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "admin-module", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "@aws-amplify/ui": "^2.0.2", 12 | "aws-amplify": "^3.0.10", 13 | "aws-amplify-vue": "^2.1.1", 14 | "core-js": "^3.6.4", 15 | "vue": "^2.6.11", 16 | "vue-currency-filter": "^5.0.2", 17 | "vue-multiselect": "^2.1.6", 18 | "vue-router": "^3.1.6", 19 | "vue2-editor": "^2.10.2", 20 | "vuex": "^3.3.0" 21 | }, 22 | "devDependencies": { 23 | "@vue/cli-plugin-babel": "~4.3.0", 24 | "@vue/cli-plugin-eslint": "~4.3.0", 25 | "@vue/cli-service": "~4.3.0", 26 | "babel-eslint": "^10.1.0", 27 | "eslint": "^6.7.2", 28 | "eslint-plugin-vue": "^6.2.2", 29 | "vue-template-compiler": "^2.6.11" 30 | }, 31 | "eslintConfig": { 32 | "root": true, 33 | "env": { 34 | "node": true 35 | }, 36 | "extends": [ 37 | "plugin:vue/essential", 38 | "eslint:recommended" 39 | ], 40 | "parserOptions": { 41 | "parser": "babel-eslint" 42 | }, 43 | "rules": {} 44 | }, 45 | "browserslist": [ 46 | "> 1%", 47 | "last 2 versions", 48 | "not dead" 49 | ], 50 | "description": "## Project setup ``` npm install ```", 51 | "main": "babel.config.js", 52 | "author": "", 53 | "license": "ISC" 54 | } 55 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Spontaign/serverless-cms/7bb51ea53427ca74004b0b29cedb703c91ec2048/amplify-vue-admin-module/public/favicon.ico -------------------------------------------------------------------------------- /amplify-vue-admin-module/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | <%= htmlWebpackPlugin.options.title %> 12 | 13 | 14 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/App.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 17 | 18 | 20 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/components/Asset.vue: -------------------------------------------------------------------------------- 1 | 64 | 99 | 100 | 101 | 103 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/components/AssetNew.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 51 | 52 | 53 | 55 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/components/Header.vue: -------------------------------------------------------------------------------- 1 | 49 | 50 | 82 | 83 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/components/Home.vue: -------------------------------------------------------------------------------- 1 | 38 | 39 | 81 | 82 | 83 | 85 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/components/LayoutNew.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 68 | 69 | 70 | 72 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/components/PageNew.vue: -------------------------------------------------------------------------------- 1 | 50 | 51 | 79 | 80 | 82 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/components/ProductNew.vue: -------------------------------------------------------------------------------- 1 | 50 | 51 | 79 | 80 | 82 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/components/Snippet.vue: -------------------------------------------------------------------------------- 1 | 56 | 91 | 92 | 94 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/components/SnippetNew.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 67 | 68 | 69 | 71 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/components/TableRow.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 23 | 24 | 26 | 27 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | 3 | import App from "./App.vue"; 4 | import store from "./store"; 5 | 6 | import { router } from './routes'; 7 | 8 | import Amplify, * as AmplifyModules from "aws-amplify"; 9 | import { Auth, Logger } from "aws-amplify"; 10 | import { AmplifyPlugin } from "aws-amplify-vue"; 11 | 12 | import { AmplifyEventBus } from "aws-amplify-vue"; 13 | 14 | import VueCurrencyFilter from 'vue-currency-filter' 15 | Vue.use(VueCurrencyFilter, 16 | { 17 | symbol : '$', 18 | thousandsSeparator: ',', 19 | fractionCount: 0, 20 | fractionSeparator: ',', 21 | symbolSpacing:false 22 | 23 | }) 24 | 25 | import awsconfig from "./aws-exports"; 26 | Amplify.configure(awsconfig); 27 | 28 | Vue.use(Auth); 29 | 30 | Vue.use(AmplifyPlugin, AmplifyModules); 31 | 32 | Amplify.Logger.LOG_LEVEL = "DEBUG"; 33 | 34 | const logger = new Logger("main"); 35 | Auth.currentAuthenticatedUser() 36 | .then(user => logger.debug(user)) 37 | .catch(err => logger.debug(err)); 38 | 39 | Vue.config.productionTip = false; 40 | 41 | AmplifyEventBus.$on("authState", info => { 42 | console.log(`AUTH: event emitted by an Amplify component: ${info}`); 43 | if (info === "signedIn") { 44 | store.commit("setSignedIn", true); 45 | 46 | Auth.currentAuthenticatedUser() 47 | .then(data => { 48 | if (data && data.signInUserSession) { 49 | store.commit("setUser", data); 50 | } 51 | }) 52 | .catch(e => { 53 | console.log(e); 54 | }); 55 | } else if (info === 'signedOut') { 56 | console.log(`SIGNED OUT, sending to HOME PAGE`); 57 | router.push("home") 58 | } 59 | }); 60 | 61 | new Vue({ 62 | router, 63 | store, 64 | render: h => h(App) 65 | }).$mount("#app"); -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/mixins/fileUploadMixin.js: -------------------------------------------------------------------------------- 1 | import { API } from "aws-amplify"; 2 | import axios from 'axios' 3 | 4 | export const fileUploadMixin = { 5 | 6 | methods: { 7 | 8 | /* returns unique id for uploaded images */ 9 | newUploadId() { 10 | return Math.floor(Date.now() / 1000).toString() + Math.random().toString(36).substring(2, 10); 11 | }, 12 | 13 | /* get a post policy from AWS to allow client to post a file directly to the S3 bucket */ 14 | getPostPolicy(fileName, imageObj) { 15 | 16 | let vm = this; 17 | 18 | let apiName = 'AdminModule'; 19 | let path = '/post-policy'; 20 | let apiInit = { 21 | queryStringParameters: { 22 | fileName: fileName 23 | } 24 | }; 25 | 26 | API.get(apiName, path, apiInit).then(response => { 27 | console.log("response from AWS is... ", response) 28 | vm.handleImagePost(response,imageObj) 29 | }).catch(error => { 30 | console.log(error.response) 31 | }); 32 | 33 | }, 34 | 35 | /* received post policy and actually uploades the file to S3 via POST */ 36 | handleImagePost(ap,imageObj) { 37 | 38 | let vm = this 39 | 40 | let fd = new FormData(); 41 | 42 | fd.append("Policy",ap.fields.Policy); 43 | fd.append("key",ap.fields.key); 44 | fd.append("X-Amz-Algorithm",ap.fields['X-Amz-Algorithm']); 45 | fd.append("X-Amz-Credential",ap.fields['X-Amz-Credential']); 46 | fd.append("X-Amz-Date",ap.fields['X-Amz-Date']); 47 | fd.append("X-Amz-Security-Token",ap.fields['X-Amz-Security-Token']); 48 | fd.append("X-Amz-Signature",ap.fields['X-Amz-Signature']); 49 | 50 | fd.append("file", imageObj.file, ap.fields.key); 51 | 52 | axios({ 53 | method: 'post', 54 | url: ap.url, 55 | data: fd, 56 | headers: {'Content-Type': 'multipart/form-data','Accept': 'text/html,application/xhtml+xml,application/xml,application/json, text/plain, */*' } 57 | }) 58 | .then(response => { 59 | 60 | console.log("Passing to handleNewImage... => response is...", response); 61 | let path = vm.stageWebBase + ap.fields.key; 62 | vm.handleNewImage(path,imageObj); 63 | 64 | }) 65 | 66 | }, 67 | 68 | /* after successful upload, test to make sure file is available */ 69 | async handleNewImage(path,imageObj) { 70 | 71 | let vm = this; 72 | 73 | console.log("Testing this image...", path); 74 | 75 | for (let i = 0; i < 10; i++) { 76 | 77 | console.log("Waiting 3 seconds for image to load. Try#", (i+1) ); 78 | 79 | await new Promise(resolve => setTimeout(resolve,3000)); 80 | let imageTest = await vm.testImage(path); 81 | console.log("imageTest is ", imageTest); 82 | if(imageTest) { 83 | vm.newImageLoaded(path,imageObj); 84 | i = 10; 85 | } 86 | 87 | } 88 | 89 | }, 90 | 91 | /* tries to get newly uploaded image to be sure it is available */ 92 | async testImage(path) { 93 | console.log("Testing if image exists => ", path); 94 | let image = new Image(); 95 | image.src = path; 96 | console.log("image is ", image); 97 | console.log("image.width is ", image.width); 98 | if (image.width !== 0) { 99 | return true; 100 | } else { 101 | return false; 102 | } 103 | } 104 | 105 | 106 | 107 | } 108 | }; 109 | -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/mixins/pageMixin.js: -------------------------------------------------------------------------------- 1 | export const pageMixin = { 2 | 3 | methods: { 4 | 5 | /* called from editor as custom fucntion to handle uploaded images */ 6 | handleImageAdded: function(file, Editor, cursorLocation, resetUploader) { 7 | 8 | this.editorImageUploading = true; 9 | 10 | let ext = file.name.split('.').pop(); 11 | 12 | let fType = file.type; 13 | 14 | if (fType == "image/jpeg" || fType == "image/png" || fType == "image/gif") { 15 | console.log("Correct Image Type"); 16 | } 17 | else { 18 | console.log("Incorrect file type!"); 19 | console.log("Incorrect file type! Must be an image JPG or PNG!"); 20 | return 21 | } 22 | 23 | this.uploadName = this.uploadedImagePrefix + this.newUploadId() + "." + ext; 24 | this.getPostPolicy(this.uploadName, {file:file,Editor:Editor,cursorLocation:cursorLocation,resetUploader}); 25 | 26 | }, 27 | 28 | /* when upload has completed, this function returns url to the editor */ 29 | newImageLoaded(path,imageObj) { 30 | 31 | imageObj.Editor.insertEmbed(imageObj.cursorLocation, "image", path); 32 | imageObj.resetUploader(); 33 | this.entry.pendingChanges = true; 34 | 35 | this.editorImageUploading = false; 36 | 37 | }, 38 | 39 | toggleShow() { 40 | this.entry.show = !this.entry.show; 41 | this.entry.pendingChanges = true; 42 | }, 43 | pendingChanges() { 44 | this.entry.pendingChanges = true; 45 | }, 46 | editRawBody() { 47 | this.rawHTML = this.entry.pageBody; 48 | }, 49 | editRawBodySubmit() { 50 | this.entry.pageBody = this.rawHTML; 51 | this.entry.pendingChanges = true; 52 | } 53 | } 54 | 55 | }; -------------------------------------------------------------------------------- /amplify-vue-admin-module/src/store.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | import Vuex from "vuex"; 3 | Vue.use(Vuex); 4 | export default new Vuex.Store({ 5 | 6 | state: { 7 | user: null, 8 | signedIn: false, 9 | configuration: {}, 10 | changedEntries: [], 11 | recentlyPublished: [], 12 | recentlyPreviewed: [] 13 | }, 14 | mutations: { 15 | setUser(state, user) { 16 | console.log("mutations setUser user is... ", user) 17 | state.user = user; 18 | }, 19 | setSignedIn(state, signedIn) { 20 | console.log("mutations setSignedIn amd signedIn is... ", signedIn) 21 | state.signedIn = signedIn; 22 | }, 23 | UPDATE_CONFIGURATION(state,c) { 24 | console.log("Updating configuraiton... ") 25 | state.configuration = c; 26 | 27 | }, 28 | PUSH_CHANGED_ENTRY(state,eObj) { 29 | console.log("mutations PUSH_CHANGED_ENTRY... ", eObj.eid); 30 | if (state.changedEntries.some(entry => entry.eid === eObj.eid)) { 31 | console.log("Already in changed... ", eObj.eid); 32 | } else { 33 | state.changedEntries.push(eObj); 34 | } 35 | }, 36 | ENTRY_PUBLISHED(state,obj) { 37 | 38 | const isId = (eid) => eid === obj.eid; 39 | 40 | let i = state.changedEntries.findIndex(isId); 41 | 42 | state.changedEntries.splice(i,1); 43 | 44 | let o = { 45 | eid:obj.eid, 46 | u:state.configuration.prodWebBase+obj.websiteKey, 47 | title:obj.title, 48 | pushPublish:false 49 | }; 50 | 51 | let x = state.recentlyPublished.findIndex( ({title}) => title === o.title); 52 | if(x === -1) { 53 | state.recentlyPublished.push(o); 54 | } else { 55 | console.log("Has recently been published so not pushing..."); 56 | } 57 | 58 | // CHECK IF IN PREVIEW... 59 | let p = state.recentlyPreviewed.findIndex( ({title}) => title === o.title); 60 | if(p > -1) { 61 | state.recentlyPreviewed.splice(p,1); 62 | } 63 | }, 64 | ENTRY_PREVIEWED(state,obj) { 65 | //console.log("ENTRY_PREVIEWED => ", obj.eid); 66 | //console.log("ENTRY_PREVIEWED => ", obj.title); 67 | //console.log("ENTRY_PREVIEWED => ", obj.websiteKey); 68 | 69 | let o = { 70 | u:state.configuration.stageWebBase+obj.websiteKey, 71 | title:obj.title 72 | }; 73 | 74 | let x = state.recentlyPreviewed.findIndex( ({title}) => title === o.title); 75 | if(x === -1) { 76 | state.recentlyPreviewed.push(o); 77 | } else { 78 | console.log("Has recently been previewed so not pushing..."); 79 | } 80 | 81 | }, 82 | 83 | CLEAR_RECENTLY_PUBLISHED(state) { 84 | console.log("mutations CLEAR_RECENTLY_LOADED... "); 85 | state.recentlyPublished = []; 86 | }, 87 | CLEAR_RECENTLY_PREVIEWED(state) { 88 | console.log("mutations CLEAR_RECENTLY_PREVIEWED... "); 89 | state.recentlyPreviewed = []; 90 | } 91 | }, 92 | actions: { 93 | clearRecentlyPublished(context) { 94 | context.commit('CLEAR_RECENTLY_PUBLISHED') 95 | }, 96 | clearRecentlyPreviewed(context) { 97 | context.commit('CLEAR_RECENTLY_PREVIEWED') 98 | } 99 | } 100 | }); 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /sam-backend/build-asset/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "build-asset", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /sam-backend/build-page/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "build-page", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /sam-backend/copy-uploaded-images/index.js: -------------------------------------------------------------------------------- 1 | const AWS = require('aws-sdk'); 2 | const s3 = new AWS.S3({ apiVersion: '2006-03-01' }); 3 | 4 | 5 | const copyFile = async (b,k,d) => { 6 | 7 | let ext = k.split('.').pop(); 8 | let ct = 'image/jpg'; 9 | console.log("===> ct is ... ", ct); 10 | if (ext === 'png') { ct = 'image/png'; } 11 | else if (ext === 'gif') { ct = 'image/gif'; } 12 | 13 | let copyParams = { 14 | CopySource: b + '/' + k, 15 | Bucket: d, 16 | Key: k, 17 | ACL: 'public-read', 18 | ContentType: ct, 19 | MetadataDirective: 'REPLACE' 20 | }; 21 | 22 | console.log("===========> About to write to S3 params: ", copyParams); 23 | 24 | let copyObjectPromise = s3.copyObject(copyParams).promise(); 25 | copyObjectPromise.then(function(data) { 26 | console.log('Copied to... ', d); 27 | }).catch(function(err) { 28 | console.log(err); 29 | }); 30 | 31 | return copyObjectPromise; 32 | }; 33 | 34 | 35 | 36 | exports.handler = async (event, context, callback) => { 37 | 38 | console.log("=========> event is ", event); 39 | 40 | let srcBucket = event.Records[0].s3.bucket.name; 41 | let srcKey = event.Records[0].s3.object.key; 42 | 43 | await copyFile(srcBucket,srcKey,process.env.STAGING_BUCKET); 44 | await copyFile(srcBucket,srcKey,process.env.PRODUCTION_BUCKET); 45 | 46 | callback(null, { 47 | statusCode:400, 48 | body: "Objects copied..." 49 | }); 50 | 51 | }; 52 | 53 | 54 | -------------------------------------------------------------------------------- /sam-backend/copy-uploaded-images/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "copy-uploaded-images", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/.bin/he: -------------------------------------------------------------------------------- 1 | ../he/bin/he -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/.bin/html-minifier: -------------------------------------------------------------------------------- 1 | ../html-minifier/cli.js -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/.bin/uglifyjs: -------------------------------------------------------------------------------- 1 | ../uglify-js/bin/uglifyjs -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/camel-case/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/camel-case/camel-case.d.ts: -------------------------------------------------------------------------------- 1 | declare function camelCase (value: string, locale?: string, mergeNumbers?: boolean): string; 2 | 3 | export = camelCase; 4 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/camel-case/camel-case.js: -------------------------------------------------------------------------------- 1 | var upperCase = require('upper-case') 2 | var noCase = require('no-case') 3 | 4 | /** 5 | * Camel case a string. 6 | * 7 | * @param {string} value 8 | * @param {string} [locale] 9 | * @return {string} 10 | */ 11 | module.exports = function (value, locale, mergeNumbers) { 12 | var result = noCase(value, locale) 13 | 14 | // Replace periods between numeric entities with an underscore. 15 | if (!mergeNumbers) { 16 | result = result.replace(/ (?=\d)/g, '_') 17 | } 18 | 19 | // Replace spaces between words with an upper cased character. 20 | return result.replace(/ (.)/g, function (m, $1) { 21 | return upperCase($1, locale) 22 | }) 23 | } 24 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/camel-case/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "camel-case@^3.0.0", 3 | "_id": "camel-case@3.0.0", 4 | "_inBundle": false, 5 | "_integrity": "sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=", 6 | "_location": "/camel-case", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "camel-case@^3.0.0", 12 | "name": "camel-case", 13 | "escapedName": "camel-case", 14 | "rawSpec": "^3.0.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^3.0.0" 17 | }, 18 | "_requiredBy": [ 19 | "/html-minifier" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", 22 | "_shasum": "ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73", 23 | "_spec": "camel-case@^3.0.0", 24 | "_where": "/Users/danbartlett/Dev/AWS/SAM/aws-serverless-cms/dependencies/nodejs/node_modules/html-minifier", 25 | "author": { 26 | "name": "Blake Embrey", 27 | "email": "hello@blakeembrey.com", 28 | "url": "http://blakeembrey.me" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/blakeembrey/camel-case/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": { 35 | "no-case": "^2.2.0", 36 | "upper-case": "^1.1.1" 37 | }, 38 | "deprecated": false, 39 | "description": "Camel case a string", 40 | "devDependencies": { 41 | "istanbul": "^0.4.3", 42 | "mocha": "^2.2.1", 43 | "standard": "^7.1.2" 44 | }, 45 | "files": [ 46 | "camel-case.js", 47 | "camel-case.d.ts", 48 | "LICENSE" 49 | ], 50 | "homepage": "https://github.com/blakeembrey/camel-case", 51 | "keywords": [ 52 | "camel", 53 | "case", 54 | "camelcase", 55 | "camel-case", 56 | "dash", 57 | "hyphen", 58 | "dot", 59 | "underscore", 60 | "lodash", 61 | "separator", 62 | "string", 63 | "text", 64 | "convert" 65 | ], 66 | "license": "MIT", 67 | "main": "camel-case.js", 68 | "name": "camel-case", 69 | "repository": { 70 | "type": "git", 71 | "url": "git://github.com/blakeembrey/camel-case.git" 72 | }, 73 | "scripts": { 74 | "lint": "standard", 75 | "test": "npm run lint && npm run test-cov", 76 | "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- -R spec --bail", 77 | "test-spec": "mocha -- -R spec --bail" 78 | }, 79 | "typings": "camel-case.d.ts", 80 | "version": "3.0.0" 81 | } 82 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2017 JakubPawlowicz.com 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 14 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 17 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 18 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/clean'); 2 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/hack.js: -------------------------------------------------------------------------------- 1 | var Hack = { 2 | ASTERISK: 'asterisk', 3 | BANG: 'bang', 4 | BACKSLASH: 'backslash', 5 | UNDERSCORE: 'underscore' 6 | }; 7 | 8 | module.exports = Hack; 9 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-0/optimize.js: -------------------------------------------------------------------------------- 1 | function level0Optimize(tokens) { 2 | // noop as level 0 means no optimizations! 3 | return tokens; 4 | } 5 | 6 | module.exports = level0Optimize; 7 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-1/shorten-hsl.js: -------------------------------------------------------------------------------- 1 | // HSL to RGB converter. Both methods adapted from: 2 | // http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript 3 | 4 | function hslToRgb(h, s, l) { 5 | var r, g, b; 6 | 7 | // normalize hue orientation b/w 0 and 360 degrees 8 | h = h % 360; 9 | if (h < 0) 10 | h += 360; 11 | h = ~~h / 360; 12 | 13 | if (s < 0) 14 | s = 0; 15 | else if (s > 100) 16 | s = 100; 17 | s = ~~s / 100; 18 | 19 | if (l < 0) 20 | l = 0; 21 | else if (l > 100) 22 | l = 100; 23 | l = ~~l / 100; 24 | 25 | if (s === 0) { 26 | r = g = b = l; // achromatic 27 | } else { 28 | var q = l < 0.5 ? 29 | l * (1 + s) : 30 | l + s - l * s; 31 | var p = 2 * l - q; 32 | r = hueToRgb(p, q, h + 1/3); 33 | g = hueToRgb(p, q, h); 34 | b = hueToRgb(p, q, h - 1/3); 35 | } 36 | 37 | return [~~(r * 255), ~~(g * 255), ~~(b * 255)]; 38 | } 39 | 40 | function hueToRgb(p, q, t) { 41 | if (t < 0) t += 1; 42 | if (t > 1) t -= 1; 43 | if (t < 1/6) return p + (q - p) * 6 * t; 44 | if (t < 1/2) return q; 45 | if (t < 2/3) return p + (q - p) * (2/3 - t) * 6; 46 | return p; 47 | } 48 | 49 | function shortenHsl(hue, saturation, lightness) { 50 | var asRgb = hslToRgb(hue, saturation, lightness); 51 | var redAsHex = asRgb[0].toString(16); 52 | var greenAsHex = asRgb[1].toString(16); 53 | var blueAsHex = asRgb[2].toString(16); 54 | 55 | return '#' + 56 | ((redAsHex.length == 1 ? '0' : '') + redAsHex) + 57 | ((greenAsHex.length == 1 ? '0' : '') + greenAsHex) + 58 | ((blueAsHex.length == 1 ? '0' : '') + blueAsHex); 59 | } 60 | 61 | module.exports = shortenHsl; 62 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-1/shorten-rgb.js: -------------------------------------------------------------------------------- 1 | function shortenRgb(red, green, blue) { 2 | var normalizedRed = Math.max(0, Math.min(parseInt(red), 255)); 3 | var normalizedGreen = Math.max(0, Math.min(parseInt(green), 255)); 4 | var normalizedBlue = Math.max(0, Math.min(parseInt(blue), 255)); 5 | 6 | // Credit: Asen http://jsbin.com/UPUmaGOc/2/edit?js,console 7 | return '#' + ('00000' + (normalizedRed << 16 | normalizedGreen << 8 | normalizedBlue).toString(16)).slice(-6); 8 | } 9 | 10 | module.exports = shortenRgb; 11 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-1/sort-selectors.js: -------------------------------------------------------------------------------- 1 | var naturalCompare = require('../../utils/natural-compare'); 2 | 3 | function naturalSorter(scope1, scope2) { 4 | return naturalCompare(scope1[1], scope2[1]); 5 | } 6 | 7 | function standardSorter(scope1, scope2) { 8 | return scope1[1] > scope2[1] ? 1 : -1; 9 | } 10 | 11 | function sortSelectors(selectors, method) { 12 | switch (method) { 13 | case 'natural': 14 | return selectors.sort(naturalSorter); 15 | case 'standard': 16 | return selectors.sort(standardSorter); 17 | case 'none': 18 | case false: 19 | return selectors; 20 | } 21 | } 22 | 23 | module.exports = sortSelectors; 24 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-1/tidy-at-rule.js: -------------------------------------------------------------------------------- 1 | function tidyAtRule(value) { 2 | return value 3 | .replace(/\s+/g, ' ') 4 | .replace(/url\(\s+/g, 'url(') 5 | .replace(/\s+\)/g, ')') 6 | .trim(); 7 | } 8 | 9 | module.exports = tidyAtRule; 10 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-1/tidy-block.js: -------------------------------------------------------------------------------- 1 | var SUPPORTED_COMPACT_BLOCK_MATCHER = /^@media\W/; 2 | 3 | function tidyBlock(values, spaceAfterClosingBrace) { 4 | var withoutSpaceAfterClosingBrace; 5 | var i; 6 | 7 | for (i = values.length - 1; i >= 0; i--) { 8 | withoutSpaceAfterClosingBrace = !spaceAfterClosingBrace && SUPPORTED_COMPACT_BLOCK_MATCHER.test(values[i][1]); 9 | 10 | values[i][1] = values[i][1] 11 | .replace(/\n|\r\n/g, ' ') 12 | .replace(/\s+/g, ' ') 13 | .replace(/(,|:|\() /g, '$1') 14 | .replace(/ \)/g, ')') 15 | .replace(/'([a-zA-Z][a-zA-Z\d\-_]+)'/, '$1') 16 | .replace(/"([a-zA-Z][a-zA-Z\d\-_]+)"/, '$1') 17 | .replace(withoutSpaceAfterClosingBrace ? /\) /g : null, ')'); 18 | } 19 | 20 | return values; 21 | } 22 | 23 | module.exports = tidyBlock; 24 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/clone.js: -------------------------------------------------------------------------------- 1 | var wrapSingle = require('../wrap-for-optimizing').single; 2 | 3 | var Token = require('../../tokenizer/token'); 4 | 5 | function deep(property) { 6 | var cloned = shallow(property); 7 | for (var i = property.components.length - 1; i >= 0; i--) { 8 | var component = shallow(property.components[i]); 9 | component.value = property.components[i].value.slice(0); 10 | cloned.components.unshift(component); 11 | } 12 | 13 | cloned.dirty = true; 14 | cloned.value = property.value.slice(0); 15 | 16 | return cloned; 17 | } 18 | 19 | function shallow(property) { 20 | var cloned = wrapSingle([ 21 | Token.PROPERTY, 22 | [Token.PROPERTY_NAME, property.name] 23 | ]); 24 | cloned.important = property.important; 25 | cloned.hack = property.hack; 26 | cloned.unused = false; 27 | return cloned; 28 | } 29 | 30 | module.exports = { 31 | deep: deep, 32 | shallow: shallow 33 | }; 34 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/extract-properties.js: -------------------------------------------------------------------------------- 1 | // This extractor is used in level 2 optimizations 2 | // IMPORTANT: Mind Token class and this code is not related! 3 | // Properties will be tokenized in one step, see #429 4 | 5 | var Token = require('../../tokenizer/token'); 6 | var serializeRules = require('../../writer/one-time').rules; 7 | var serializeValue = require('../../writer/one-time').value; 8 | 9 | function extractProperties(token) { 10 | var properties = []; 11 | var inSpecificSelector; 12 | var property; 13 | var name; 14 | var value; 15 | var i, l; 16 | 17 | if (token[0] == Token.RULE) { 18 | inSpecificSelector = !/[\.\+>~]/.test(serializeRules(token[1])); 19 | 20 | for (i = 0, l = token[2].length; i < l; i++) { 21 | property = token[2][i]; 22 | 23 | if (property[0] != Token.PROPERTY) 24 | continue; 25 | 26 | name = property[1][1]; 27 | if (name.length === 0) 28 | continue; 29 | 30 | if (name.indexOf('--') === 0) 31 | continue; 32 | 33 | value = serializeValue(property, i); 34 | 35 | properties.push([ 36 | name, 37 | value, 38 | findNameRoot(name), 39 | token[2][i], 40 | name + ':' + value, 41 | token[1], 42 | inSpecificSelector 43 | ]); 44 | } 45 | } else if (token[0] == Token.NESTED_BLOCK) { 46 | for (i = 0, l = token[2].length; i < l; i++) { 47 | properties = properties.concat(extractProperties(token[2][i])); 48 | } 49 | } 50 | 51 | return properties; 52 | } 53 | 54 | function findNameRoot(name) { 55 | if (name == 'list-style') 56 | return name; 57 | if (name.indexOf('-radius') > 0) 58 | return 'border-radius'; 59 | if (name == 'border-collapse' || name == 'border-spacing' || name == 'border-image') 60 | return name; 61 | if (name.indexOf('border-') === 0 && /^border\-\w+\-\w+$/.test(name)) 62 | return name.match(/border\-\w+/)[0]; 63 | if (name.indexOf('border-') === 0 && /^border\-\w+$/.test(name)) 64 | return 'border'; 65 | if (name.indexOf('text-') === 0) 66 | return name; 67 | if (name == '-chrome-') 68 | return name; 69 | 70 | return name.replace(/^\-\w+\-/, '').match(/([a-zA-Z]+)/)[0].toLowerCase(); 71 | } 72 | 73 | module.exports = extractProperties; 74 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/invalid-property-error.js: -------------------------------------------------------------------------------- 1 | function InvalidPropertyError(message) { 2 | this.name = 'InvalidPropertyError'; 3 | this.message = message; 4 | this.stack = (new Error()).stack; 5 | } 6 | 7 | InvalidPropertyError.prototype = Object.create(Error.prototype); 8 | InvalidPropertyError.prototype.constructor = InvalidPropertyError; 9 | 10 | module.exports = InvalidPropertyError; 11 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/merge-adjacent.js: -------------------------------------------------------------------------------- 1 | var isMergeable = require('./is-mergeable'); 2 | 3 | var optimizeProperties = require('./properties/optimize'); 4 | 5 | var sortSelectors = require('../level-1/sort-selectors'); 6 | var tidyRules = require('../level-1/tidy-rules'); 7 | 8 | var OptimizationLevel = require('../../options/optimization-level').OptimizationLevel; 9 | 10 | var serializeBody = require('../../writer/one-time').body; 11 | var serializeRules = require('../../writer/one-time').rules; 12 | 13 | var Token = require('../../tokenizer/token'); 14 | 15 | function mergeAdjacent(tokens, context) { 16 | var lastToken = [null, [], []]; 17 | var options = context.options; 18 | var adjacentSpace = options.compatibility.selectors.adjacentSpace; 19 | var selectorsSortingMethod = options.level[OptimizationLevel.One].selectorsSortingMethod; 20 | var mergeablePseudoClasses = options.compatibility.selectors.mergeablePseudoClasses; 21 | var mergeablePseudoElements = options.compatibility.selectors.mergeablePseudoElements; 22 | var mergeLimit = options.compatibility.selectors.mergeLimit; 23 | var multiplePseudoMerging = options.compatibility.selectors.multiplePseudoMerging; 24 | 25 | for (var i = 0, l = tokens.length; i < l; i++) { 26 | var token = tokens[i]; 27 | 28 | if (token[0] != Token.RULE) { 29 | lastToken = [null, [], []]; 30 | continue; 31 | } 32 | 33 | if (lastToken[0] == Token.RULE && serializeRules(token[1]) == serializeRules(lastToken[1])) { 34 | Array.prototype.push.apply(lastToken[2], token[2]); 35 | optimizeProperties(lastToken[2], true, true, context); 36 | token[2] = []; 37 | } else if (lastToken[0] == Token.RULE && serializeBody(token[2]) == serializeBody(lastToken[2]) && 38 | isMergeable(serializeRules(token[1]), mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging) && 39 | isMergeable(serializeRules(lastToken[1]), mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging) && 40 | lastToken[1].length < mergeLimit) { 41 | lastToken[1] = tidyRules(lastToken[1].concat(token[1]), false, adjacentSpace, false, context.warnings); 42 | lastToken[1] = lastToken.length > 1 ? sortSelectors(lastToken[1], selectorsSortingMethod) : lastToken[1]; 43 | token[2] = []; 44 | } else { 45 | lastToken = token; 46 | } 47 | } 48 | } 49 | 50 | module.exports = mergeAdjacent; 51 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/merge-non-adjacent-by-body.js: -------------------------------------------------------------------------------- 1 | var isMergeable = require('./is-mergeable'); 2 | 3 | var sortSelectors = require('../level-1/sort-selectors'); 4 | var tidyRules = require('../level-1/tidy-rules'); 5 | 6 | var OptimizationLevel = require('../../options/optimization-level').OptimizationLevel; 7 | 8 | var serializeBody = require('../../writer/one-time').body; 9 | var serializeRules = require('../../writer/one-time').rules; 10 | 11 | var Token = require('../../tokenizer/token'); 12 | 13 | function unsafeSelector(value) { 14 | return /\.|\*| :/.test(value); 15 | } 16 | 17 | function isBemElement(token) { 18 | var asString = serializeRules(token[1]); 19 | return asString.indexOf('__') > -1 || asString.indexOf('--') > -1; 20 | } 21 | 22 | function withoutModifier(selector) { 23 | return selector.replace(/--[^ ,>\+~:]+/g, ''); 24 | } 25 | 26 | function removeAnyUnsafeElements(left, candidates) { 27 | var leftSelector = withoutModifier(serializeRules(left[1])); 28 | 29 | for (var body in candidates) { 30 | var right = candidates[body]; 31 | var rightSelector = withoutModifier(serializeRules(right[1])); 32 | 33 | if (rightSelector.indexOf(leftSelector) > -1 || leftSelector.indexOf(rightSelector) > -1) 34 | delete candidates[body]; 35 | } 36 | } 37 | 38 | function mergeNonAdjacentByBody(tokens, context) { 39 | var options = context.options; 40 | var mergeSemantically = options.level[OptimizationLevel.Two].mergeSemantically; 41 | var adjacentSpace = options.compatibility.selectors.adjacentSpace; 42 | var selectorsSortingMethod = options.level[OptimizationLevel.One].selectorsSortingMethod; 43 | var mergeablePseudoClasses = options.compatibility.selectors.mergeablePseudoClasses; 44 | var mergeablePseudoElements = options.compatibility.selectors.mergeablePseudoElements; 45 | var multiplePseudoMerging = options.compatibility.selectors.multiplePseudoMerging; 46 | var candidates = {}; 47 | 48 | for (var i = tokens.length - 1; i >= 0; i--) { 49 | var token = tokens[i]; 50 | if (token[0] != Token.RULE) 51 | continue; 52 | 53 | if (token[2].length > 0 && (!mergeSemantically && unsafeSelector(serializeRules(token[1])))) 54 | candidates = {}; 55 | 56 | if (token[2].length > 0 && mergeSemantically && isBemElement(token)) 57 | removeAnyUnsafeElements(token, candidates); 58 | 59 | var candidateBody = serializeBody(token[2]); 60 | var oldToken = candidates[candidateBody]; 61 | if (oldToken && 62 | isMergeable(serializeRules(token[1]), mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging) && 63 | isMergeable(serializeRules(oldToken[1]), mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging)) { 64 | 65 | if (token[2].length > 0) { 66 | token[1] = tidyRules(oldToken[1].concat(token[1]), false, adjacentSpace, false, context.warnings); 67 | token[1] = token[1].length > 1 ? sortSelectors(token[1], selectorsSortingMethod) : token[1]; 68 | } else { 69 | token[1] = oldToken[1].concat(token[1]); 70 | } 71 | 72 | oldToken[2] = []; 73 | candidates[candidateBody] = null; 74 | } 75 | 76 | candidates[serializeBody(token[2])] = token; 77 | } 78 | } 79 | 80 | module.exports = mergeNonAdjacentByBody; 81 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/merge-non-adjacent-by-selector.js: -------------------------------------------------------------------------------- 1 | var canReorder = require('./reorderable').canReorder; 2 | var extractProperties = require('./extract-properties'); 3 | 4 | var optimizeProperties = require('./properties/optimize'); 5 | 6 | var serializeRules = require('../../writer/one-time').rules; 7 | 8 | var Token = require('../../tokenizer/token'); 9 | 10 | function mergeNonAdjacentBySelector(tokens, context) { 11 | var specificityCache = context.cache.specificity; 12 | var allSelectors = {}; 13 | var repeatedSelectors = []; 14 | var i; 15 | 16 | for (i = tokens.length - 1; i >= 0; i--) { 17 | if (tokens[i][0] != Token.RULE) 18 | continue; 19 | if (tokens[i][2].length === 0) 20 | continue; 21 | 22 | var selector = serializeRules(tokens[i][1]); 23 | allSelectors[selector] = [i].concat(allSelectors[selector] || []); 24 | 25 | if (allSelectors[selector].length == 2) 26 | repeatedSelectors.push(selector); 27 | } 28 | 29 | for (i = repeatedSelectors.length - 1; i >= 0; i--) { 30 | var positions = allSelectors[repeatedSelectors[i]]; 31 | 32 | selectorIterator: 33 | for (var j = positions.length - 1; j > 0; j--) { 34 | var positionOne = positions[j - 1]; 35 | var tokenOne = tokens[positionOne]; 36 | var positionTwo = positions[j]; 37 | var tokenTwo = tokens[positionTwo]; 38 | 39 | directionIterator: 40 | for (var direction = 1; direction >= -1; direction -= 2) { 41 | var topToBottom = direction == 1; 42 | var from = topToBottom ? positionOne + 1 : positionTwo - 1; 43 | var to = topToBottom ? positionTwo : positionOne; 44 | var delta = topToBottom ? 1 : -1; 45 | var moved = topToBottom ? tokenOne : tokenTwo; 46 | var target = topToBottom ? tokenTwo : tokenOne; 47 | var movedProperties = extractProperties(moved); 48 | 49 | while (from != to) { 50 | var traversedProperties = extractProperties(tokens[from]); 51 | from += delta; 52 | 53 | // traversed then moved as we move selectors towards the start 54 | var reorderable = topToBottom ? 55 | canReorder(movedProperties, traversedProperties, specificityCache) : 56 | canReorder(traversedProperties, movedProperties, specificityCache); 57 | 58 | if (!reorderable && !topToBottom) 59 | continue selectorIterator; 60 | if (!reorderable && topToBottom) 61 | continue directionIterator; 62 | } 63 | 64 | if (topToBottom) { 65 | Array.prototype.push.apply(moved[2], target[2]); 66 | target[2] = moved[2]; 67 | } else { 68 | Array.prototype.push.apply(target[2], moved[2]); 69 | } 70 | 71 | optimizeProperties(target[2], true, true, context); 72 | moved[2] = []; 73 | } 74 | } 75 | } 76 | } 77 | 78 | module.exports = mergeNonAdjacentBySelector; 79 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/properties/every-values-pair.js: -------------------------------------------------------------------------------- 1 | var Marker = require('../../../tokenizer/marker'); 2 | 3 | function everyValuesPair(fn, left, right) { 4 | var leftSize = left.value.length; 5 | var rightSize = right.value.length; 6 | var total = Math.max(leftSize, rightSize); 7 | var lowerBound = Math.min(leftSize, rightSize) - 1; 8 | var leftValue; 9 | var rightValue; 10 | var position; 11 | 12 | for (position = 0; position < total; position++) { 13 | leftValue = left.value[position] && left.value[position][1] || leftValue; 14 | rightValue = right.value[position] && right.value[position][1] || rightValue; 15 | 16 | if (leftValue == Marker.COMMA || rightValue == Marker.COMMA) { 17 | continue; 18 | } 19 | 20 | if (!fn(leftValue, rightValue, position, position <= lowerBound)) { 21 | return false; 22 | } 23 | } 24 | 25 | return true; 26 | } 27 | 28 | module.exports = everyValuesPair; 29 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/properties/find-component-in.js: -------------------------------------------------------------------------------- 1 | var compactable = require('../compactable'); 2 | 3 | function findComponentIn(shorthand, longhand) { 4 | var comparator = nameComparator(longhand); 5 | 6 | return findInDirectComponents(shorthand, comparator) || findInSubComponents(shorthand, comparator); 7 | } 8 | 9 | function nameComparator(to) { 10 | return function (property) { 11 | return to.name === property.name; 12 | }; 13 | } 14 | 15 | function findInDirectComponents(shorthand, comparator) { 16 | return shorthand.components.filter(comparator)[0]; 17 | } 18 | 19 | function findInSubComponents(shorthand, comparator) { 20 | var shorthandComponent; 21 | var longhandMatch; 22 | var i, l; 23 | 24 | if (!compactable[shorthand.name].shorthandComponents) { 25 | return; 26 | } 27 | 28 | for (i = 0, l = shorthand.components.length; i < l; i++) { 29 | shorthandComponent = shorthand.components[i]; 30 | longhandMatch = findInDirectComponents(shorthandComponent, comparator); 31 | 32 | if (longhandMatch) { 33 | return longhandMatch; 34 | } 35 | } 36 | 37 | return; 38 | } 39 | 40 | module.exports = findComponentIn; 41 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/properties/has-inherit.js: -------------------------------------------------------------------------------- 1 | function hasInherit(property) { 2 | for (var i = property.value.length - 1; i >= 0; i--) { 3 | if (property.value[i][1] == 'inherit') 4 | return true; 5 | } 6 | 7 | return false; 8 | } 9 | 10 | module.exports = hasInherit; 11 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/properties/is-component-of.js: -------------------------------------------------------------------------------- 1 | var compactable = require('../compactable'); 2 | 3 | function isComponentOf(property1, property2, shallow) { 4 | return isDirectComponentOf(property1, property2) || 5 | !shallow && !!compactable[property1.name].shorthandComponents && isSubComponentOf(property1, property2); 6 | } 7 | 8 | function isDirectComponentOf(property1, property2) { 9 | var descriptor = compactable[property1.name]; 10 | 11 | return 'components' in descriptor && descriptor.components.indexOf(property2.name) > -1; 12 | } 13 | 14 | function isSubComponentOf(property1, property2) { 15 | return property1 16 | .components 17 | .some(function (component) { 18 | return isDirectComponentOf(component, property2); 19 | }); 20 | } 21 | 22 | module.exports = isComponentOf; 23 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/properties/is-mergeable-shorthand.js: -------------------------------------------------------------------------------- 1 | var Marker = require('../../../tokenizer/marker'); 2 | 3 | function isMergeableShorthand(shorthand) { 4 | if (shorthand.name != 'font') { 5 | return true; 6 | } 7 | 8 | return shorthand.value[0][1].indexOf(Marker.INTERNAL) == -1; 9 | } 10 | 11 | module.exports = isMergeableShorthand; 12 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/properties/optimize.js: -------------------------------------------------------------------------------- 1 | var mergeIntoShorthands = require('./merge-into-shorthands'); 2 | var overrideProperties = require('./override-properties'); 3 | var populateComponents = require('./populate-components'); 4 | 5 | var restoreWithComponents = require('../restore-with-components'); 6 | 7 | var wrapForOptimizing = require('../../wrap-for-optimizing').all; 8 | var removeUnused = require('../../remove-unused'); 9 | var restoreFromOptimizing = require('../../restore-from-optimizing'); 10 | 11 | var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel; 12 | 13 | function optimizeProperties(properties, withOverriding, withMerging, context) { 14 | var levelOptions = context.options.level[OptimizationLevel.Two]; 15 | var _properties = wrapForOptimizing(properties, false, levelOptions.skipProperties); 16 | var _property; 17 | var i, l; 18 | 19 | populateComponents(_properties, context.validator, context.warnings); 20 | 21 | for (i = 0, l = _properties.length; i < l; i++) { 22 | _property = _properties[i]; 23 | if (_property.block) { 24 | optimizeProperties(_property.value[0][1], withOverriding, withMerging, context); 25 | } 26 | } 27 | 28 | if (withMerging && levelOptions.mergeIntoShorthands) { 29 | mergeIntoShorthands(_properties, context.validator); 30 | } 31 | 32 | if (withOverriding && levelOptions.overrideProperties) { 33 | overrideProperties(_properties, withMerging, context.options.compatibility, context.validator); 34 | } 35 | 36 | restoreFromOptimizing(_properties, restoreWithComponents); 37 | removeUnused(_properties); 38 | } 39 | 40 | module.exports = optimizeProperties; 41 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/properties/overrides-non-component-shorthand.js: -------------------------------------------------------------------------------- 1 | var compactable = require('../compactable'); 2 | 3 | function overridesNonComponentShorthand(property1, property2) { 4 | return property1.name in compactable && 5 | 'overridesShorthands' in compactable[property1.name] && 6 | compactable[property1.name].overridesShorthands.indexOf(property2.name) > -1; 7 | } 8 | 9 | module.exports = overridesNonComponentShorthand; 10 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/properties/populate-components.js: -------------------------------------------------------------------------------- 1 | var compactable = require('../compactable'); 2 | var InvalidPropertyError = require('../invalid-property-error'); 3 | 4 | function populateComponents(properties, validator, warnings) { 5 | var component; 6 | var j, m; 7 | 8 | for (var i = properties.length - 1; i >= 0; i--) { 9 | var property = properties[i]; 10 | var descriptor = compactable[property.name]; 11 | 12 | if (descriptor && descriptor.shorthand) { 13 | property.shorthand = true; 14 | property.dirty = true; 15 | 16 | try { 17 | property.components = descriptor.breakUp(property, compactable, validator); 18 | 19 | if (descriptor.shorthandComponents) { 20 | for (j = 0, m = property.components.length; j < m; j++) { 21 | component = property.components[j]; 22 | component.components = compactable[component.name].breakUp(component, compactable, validator); 23 | } 24 | } 25 | } catch (e) { 26 | if (e instanceof InvalidPropertyError) { 27 | property.components = []; // this will set property.unused to true below 28 | warnings.push(e.message); 29 | } else { 30 | throw e; 31 | } 32 | } 33 | 34 | if (property.components.length > 0) 35 | property.multiplex = property.components[0].multiplex; 36 | else 37 | property.unused = true; 38 | } 39 | } 40 | } 41 | 42 | module.exports = populateComponents; 43 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/properties/understandable.js: -------------------------------------------------------------------------------- 1 | var sameVendorPrefixes = require('./vendor-prefixes').same; 2 | 3 | function understandable(validator, value1, value2, _position, isPaired) { 4 | if (!sameVendorPrefixes(value1, value2)) { 5 | return false; 6 | } 7 | 8 | if (isPaired && validator.isVariable(value1) !== validator.isVariable(value2)) { 9 | return false; 10 | } 11 | 12 | return true; 13 | } 14 | 15 | module.exports = understandable; 16 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/properties/vendor-prefixes.js: -------------------------------------------------------------------------------- 1 | var VENDOR_PREFIX_PATTERN = /(?:^|\W)(\-\w+\-)/g; 2 | 3 | function unique(value) { 4 | var prefixes = []; 5 | var match; 6 | 7 | while ((match = VENDOR_PREFIX_PATTERN.exec(value)) !== null) { 8 | if (prefixes.indexOf(match[0]) == -1) { 9 | prefixes.push(match[0]); 10 | } 11 | } 12 | 13 | return prefixes; 14 | } 15 | 16 | function same(value1, value2) { 17 | return unique(value1).sort().join(',') == unique(value2).sort().join(','); 18 | } 19 | 20 | module.exports = { 21 | unique: unique, 22 | same: same 23 | }; 24 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/remove-duplicate-font-at-rules.js: -------------------------------------------------------------------------------- 1 | var Token = require('../../tokenizer/token'); 2 | 3 | var serializeAll = require('../../writer/one-time').all; 4 | 5 | var FONT_FACE_SCOPE = '@font-face'; 6 | 7 | function removeDuplicateFontAtRules(tokens) { 8 | var fontAtRules = []; 9 | var token; 10 | var key; 11 | var i, l; 12 | 13 | for (i = 0, l = tokens.length; i < l; i++) { 14 | token = tokens[i]; 15 | 16 | if (token[0] != Token.AT_RULE_BLOCK && token[1][0][1] != FONT_FACE_SCOPE) { 17 | continue; 18 | } 19 | 20 | key = serializeAll([token]); 21 | 22 | if (fontAtRules.indexOf(key) > -1) { 23 | token[2] = []; 24 | } else { 25 | fontAtRules.push(key); 26 | } 27 | } 28 | } 29 | 30 | module.exports = removeDuplicateFontAtRules; 31 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/remove-duplicate-media-queries.js: -------------------------------------------------------------------------------- 1 | var Token = require('../../tokenizer/token'); 2 | 3 | var serializeAll = require('../../writer/one-time').all; 4 | var serializeRules = require('../../writer/one-time').rules; 5 | 6 | function removeDuplicateMediaQueries(tokens) { 7 | var candidates = {}; 8 | var candidate; 9 | var token; 10 | var key; 11 | var i, l; 12 | 13 | for (i = 0, l = tokens.length; i < l; i++) { 14 | token = tokens[i]; 15 | if (token[0] != Token.NESTED_BLOCK) { 16 | continue; 17 | } 18 | 19 | key = serializeRules(token[1]) + '%' + serializeAll(token[2]); 20 | candidate = candidates[key]; 21 | 22 | if (candidate) { 23 | candidate[2] = []; 24 | } 25 | 26 | candidates[key] = token; 27 | } 28 | } 29 | 30 | module.exports = removeDuplicateMediaQueries; 31 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/remove-duplicates.js: -------------------------------------------------------------------------------- 1 | var Token = require('../../tokenizer/token'); 2 | 3 | var serializeBody = require('../../writer/one-time').body; 4 | var serializeRules = require('../../writer/one-time').rules; 5 | 6 | function removeDuplicates(tokens) { 7 | var matched = {}; 8 | var moreThanOnce = []; 9 | var id, token; 10 | var body, bodies; 11 | 12 | for (var i = 0, l = tokens.length; i < l; i++) { 13 | token = tokens[i]; 14 | if (token[0] != Token.RULE) 15 | continue; 16 | 17 | id = serializeRules(token[1]); 18 | 19 | if (matched[id] && matched[id].length == 1) 20 | moreThanOnce.push(id); 21 | else 22 | matched[id] = matched[id] || []; 23 | 24 | matched[id].push(i); 25 | } 26 | 27 | for (i = 0, l = moreThanOnce.length; i < l; i++) { 28 | id = moreThanOnce[i]; 29 | bodies = []; 30 | 31 | for (var j = matched[id].length - 1; j >= 0; j--) { 32 | token = tokens[matched[id][j]]; 33 | body = serializeBody(token[2]); 34 | 35 | if (bodies.indexOf(body) > -1) 36 | token[2] = []; 37 | else 38 | bodies.push(body); 39 | } 40 | } 41 | } 42 | 43 | module.exports = removeDuplicates; 44 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/restore-with-components.js: -------------------------------------------------------------------------------- 1 | var compactable = require('./compactable'); 2 | 3 | function restoreWithComponents(property) { 4 | var descriptor = compactable[property.name]; 5 | 6 | if (descriptor && descriptor.shorthand) { 7 | return descriptor.restore(property, compactable); 8 | } else { 9 | return property.value; 10 | } 11 | } 12 | 13 | module.exports = restoreWithComponents; 14 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/rules-overlap.js: -------------------------------------------------------------------------------- 1 | var MODIFIER_PATTERN = /\-\-.+$/; 2 | 3 | function rulesOverlap(rule1, rule2, bemMode) { 4 | var scope1; 5 | var scope2; 6 | var i, l; 7 | var j, m; 8 | 9 | for (i = 0, l = rule1.length; i < l; i++) { 10 | scope1 = rule1[i][1]; 11 | 12 | for (j = 0, m = rule2.length; j < m; j++) { 13 | scope2 = rule2[j][1]; 14 | 15 | if (scope1 == scope2) { 16 | return true; 17 | } 18 | 19 | if (bemMode && withoutModifiers(scope1) == withoutModifiers(scope2)) { 20 | return true; 21 | } 22 | } 23 | } 24 | 25 | return false; 26 | } 27 | 28 | function withoutModifiers(scope) { 29 | return scope.replace(MODIFIER_PATTERN, ''); 30 | } 31 | 32 | module.exports = rulesOverlap; 33 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/specificities-overlap.js: -------------------------------------------------------------------------------- 1 | var specificity = require('./specificity'); 2 | 3 | function specificitiesOverlap(selector1, selector2, cache) { 4 | var specificity1; 5 | var specificity2; 6 | var i, l; 7 | var j, m; 8 | 9 | for (i = 0, l = selector1.length; i < l; i++) { 10 | specificity1 = findSpecificity(selector1[i][1], cache); 11 | 12 | for (j = 0, m = selector2.length; j < m; j++) { 13 | specificity2 = findSpecificity(selector2[j][1], cache); 14 | 15 | if (specificity1[0] === specificity2[0] && specificity1[1] === specificity2[1] && specificity1[2] === specificity2[2]) { 16 | return true; 17 | } 18 | } 19 | } 20 | 21 | return false; 22 | } 23 | 24 | function findSpecificity(selector, cache) { 25 | var value; 26 | 27 | if (!(selector in cache)) { 28 | cache[selector] = value = specificity(selector); 29 | } 30 | 31 | return value || cache[selector]; 32 | } 33 | 34 | module.exports = specificitiesOverlap; 35 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/specificity.js: -------------------------------------------------------------------------------- 1 | var Marker = require('../../tokenizer/marker'); 2 | 3 | var Selector = { 4 | ADJACENT_SIBLING: '+', 5 | DESCENDANT: '>', 6 | DOT: '.', 7 | HASH: '#', 8 | NON_ADJACENT_SIBLING: '~', 9 | PSEUDO: ':' 10 | }; 11 | 12 | var LETTER_PATTERN = /[a-zA-Z]/; 13 | var NOT_PREFIX = ':not('; 14 | var SEPARATOR_PATTERN = /[\s,\(>~\+]/; 15 | 16 | function specificity(selector) { 17 | var result = [0, 0, 0]; 18 | var character; 19 | var isEscaped; 20 | var isSingleQuoted; 21 | var isDoubleQuoted; 22 | var roundBracketLevel = 0; 23 | var couldIntroduceNewTypeSelector; 24 | var withinNotPseudoClass = false; 25 | var wasPseudoClass = false; 26 | var i, l; 27 | 28 | for (i = 0, l = selector.length; i < l; i++) { 29 | character = selector[i]; 30 | 31 | if (isEscaped) { 32 | // noop 33 | } else if (character == Marker.SINGLE_QUOTE && !isDoubleQuoted && !isSingleQuoted) { 34 | isSingleQuoted = true; 35 | } else if (character == Marker.SINGLE_QUOTE && !isDoubleQuoted && isSingleQuoted) { 36 | isSingleQuoted = false; 37 | } else if (character == Marker.DOUBLE_QUOTE && !isDoubleQuoted && !isSingleQuoted) { 38 | isDoubleQuoted = true; 39 | } else if (character == Marker.DOUBLE_QUOTE && isDoubleQuoted && !isSingleQuoted) { 40 | isDoubleQuoted = false; 41 | } else if (isSingleQuoted || isDoubleQuoted) { 42 | continue; 43 | } else if (roundBracketLevel > 0 && !withinNotPseudoClass) { 44 | // noop 45 | } else if (character == Marker.OPEN_ROUND_BRACKET) { 46 | roundBracketLevel++; 47 | } else if (character == Marker.CLOSE_ROUND_BRACKET && roundBracketLevel == 1) { 48 | roundBracketLevel--; 49 | withinNotPseudoClass = false; 50 | } else if (character == Marker.CLOSE_ROUND_BRACKET) { 51 | roundBracketLevel--; 52 | } else if (character == Selector.HASH) { 53 | result[0]++; 54 | } else if (character == Selector.DOT || character == Marker.OPEN_SQUARE_BRACKET) { 55 | result[1]++; 56 | } else if (character == Selector.PSEUDO && !wasPseudoClass && !isNotPseudoClass(selector, i)) { 57 | result[1]++; 58 | withinNotPseudoClass = false; 59 | } else if (character == Selector.PSEUDO) { 60 | withinNotPseudoClass = true; 61 | } else if ((i === 0 || couldIntroduceNewTypeSelector) && LETTER_PATTERN.test(character)) { 62 | result[2]++; 63 | } 64 | 65 | isEscaped = character == Marker.BACK_SLASH; 66 | wasPseudoClass = character == Selector.PSEUDO; 67 | couldIntroduceNewTypeSelector = !isEscaped && SEPARATOR_PATTERN.test(character); 68 | } 69 | 70 | return result; 71 | } 72 | 73 | function isNotPseudoClass(selector, index) { 74 | return selector.indexOf(NOT_PREFIX, index) === index; 75 | } 76 | 77 | module.exports = specificity; 78 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/level-2/tidy-rule-duplicates.js: -------------------------------------------------------------------------------- 1 | function ruleSorter(s1, s2) { 2 | return s1[1] > s2[1] ? 1 : -1; 3 | } 4 | 5 | function tidyRuleDuplicates(rules) { 6 | var list = []; 7 | var repeated = []; 8 | 9 | for (var i = 0, l = rules.length; i < l; i++) { 10 | var rule = rules[i]; 11 | 12 | if (repeated.indexOf(rule[1]) == -1) { 13 | repeated.push(rule[1]); 14 | list.push(rule); 15 | } 16 | } 17 | 18 | return list.sort(ruleSorter); 19 | } 20 | 21 | module.exports = tidyRuleDuplicates; 22 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/remove-unused.js: -------------------------------------------------------------------------------- 1 | function removeUnused(properties) { 2 | for (var i = properties.length - 1; i >= 0; i--) { 3 | var property = properties[i]; 4 | 5 | if (property.unused) { 6 | property.all.splice(property.position, 1); 7 | } 8 | } 9 | } 10 | 11 | module.exports = removeUnused; 12 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/optimizer/restore-from-optimizing.js: -------------------------------------------------------------------------------- 1 | var Hack = require('./hack'); 2 | 3 | var Marker = require('../tokenizer/marker'); 4 | 5 | var ASTERISK_HACK = '*'; 6 | var BACKSLASH_HACK = '\\'; 7 | var IMPORTANT_TOKEN = '!important'; 8 | var UNDERSCORE_HACK = '_'; 9 | var BANG_HACK = '!ie'; 10 | 11 | function restoreFromOptimizing(properties, restoreCallback) { 12 | var property; 13 | var restored; 14 | var current; 15 | var i; 16 | 17 | for (i = properties.length - 1; i >= 0; i--) { 18 | property = properties[i]; 19 | 20 | if (property.unused) { 21 | continue; 22 | } 23 | 24 | if (!property.dirty && !property.important && !property.hack) { 25 | continue; 26 | } 27 | 28 | if (restoreCallback) { 29 | restored = restoreCallback(property); 30 | property.value = restored; 31 | } else { 32 | restored = property.value; 33 | } 34 | 35 | if (property.important) { 36 | restoreImportant(property); 37 | } 38 | 39 | if (property.hack) { 40 | restoreHack(property); 41 | } 42 | 43 | if ('all' in property) { 44 | current = property.all[property.position]; 45 | current[1][1] = property.name; 46 | 47 | current.splice(2, current.length - 1); 48 | Array.prototype.push.apply(current, restored); 49 | } 50 | } 51 | } 52 | 53 | function restoreImportant(property) { 54 | property.value[property.value.length - 1][1] += IMPORTANT_TOKEN; 55 | } 56 | 57 | function restoreHack(property) { 58 | if (property.hack[0] == Hack.UNDERSCORE) { 59 | property.name = UNDERSCORE_HACK + property.name; 60 | } else if (property.hack[0] == Hack.ASTERISK) { 61 | property.name = ASTERISK_HACK + property.name; 62 | } else if (property.hack[0] == Hack.BACKSLASH) { 63 | property.value[property.value.length - 1][1] += BACKSLASH_HACK + property.hack[1]; 64 | } else if (property.hack[0] == Hack.BANG) { 65 | property.value[property.value.length - 1][1] += Marker.SPACE + BANG_HACK; 66 | } 67 | } 68 | 69 | module.exports = restoreFromOptimizing; 70 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/options/fetch.js: -------------------------------------------------------------------------------- 1 | var loadRemoteResource = require('../reader/load-remote-resource'); 2 | 3 | function fetchFrom(callback) { 4 | return callback || loadRemoteResource; 5 | } 6 | 7 | module.exports = fetchFrom; 8 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/options/inline-request.js: -------------------------------------------------------------------------------- 1 | var url = require('url'); 2 | 3 | var override = require('../utils/override'); 4 | 5 | function inlineRequestFrom(option) { 6 | return override( 7 | /* jshint camelcase: false */ 8 | proxyOptionsFrom(process.env.HTTP_PROXY || process.env.http_proxy), 9 | option || {} 10 | ); 11 | } 12 | 13 | function proxyOptionsFrom(httpProxy) { 14 | return httpProxy ? 15 | { 16 | hostname: url.parse(httpProxy).hostname, 17 | port: parseInt(url.parse(httpProxy).port) 18 | } : 19 | {}; 20 | } 21 | 22 | module.exports = inlineRequestFrom; 23 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/options/inline-timeout.js: -------------------------------------------------------------------------------- 1 | var DEFAULT_TIMEOUT = 5000; 2 | 3 | function inlineTimeoutFrom(option) { 4 | return option || DEFAULT_TIMEOUT; 5 | } 6 | 7 | module.exports = inlineTimeoutFrom; 8 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/options/inline.js: -------------------------------------------------------------------------------- 1 | function inlineOptionsFrom(rules) { 2 | if (Array.isArray(rules)) { 3 | return rules; 4 | } 5 | 6 | if (rules === false) { 7 | return ['none']; 8 | } 9 | 10 | return undefined === rules ? 11 | ['local'] : 12 | rules.split(','); 13 | } 14 | 15 | module.exports = inlineOptionsFrom; 16 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/options/rebase-to.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | 3 | function rebaseToFrom(option) { 4 | return option ? path.resolve(option) : process.cwd(); 5 | } 6 | 7 | module.exports = rebaseToFrom; 8 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/options/rebase.js: -------------------------------------------------------------------------------- 1 | function rebaseFrom(rebaseOption) { 2 | return undefined === rebaseOption ? true : !!rebaseOption; 3 | } 4 | 5 | module.exports = rebaseFrom; 6 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/options/rounding-precision.js: -------------------------------------------------------------------------------- 1 | var override = require('../utils/override'); 2 | 3 | var INTEGER_PATTERN = /^\d+$/; 4 | 5 | var ALL_UNITS = ['*', 'all']; 6 | var DEFAULT_PRECISION = 'off'; // all precision changes are disabled 7 | var DIRECTIVES_SEPARATOR = ','; // e.g. *=5,px=3 8 | var DIRECTIVE_VALUE_SEPARATOR = '='; // e.g. *=5 9 | 10 | function roundingPrecisionFrom(source) { 11 | return override(defaults(DEFAULT_PRECISION), buildPrecisionFrom(source)); 12 | } 13 | 14 | function defaults(value) { 15 | return { 16 | 'ch': value, 17 | 'cm': value, 18 | 'em': value, 19 | 'ex': value, 20 | 'in': value, 21 | 'mm': value, 22 | 'pc': value, 23 | 'pt': value, 24 | 'px': value, 25 | 'q': value, 26 | 'rem': value, 27 | 'vh': value, 28 | 'vmax': value, 29 | 'vmin': value, 30 | 'vw': value, 31 | '%': value 32 | }; 33 | } 34 | 35 | function buildPrecisionFrom(source) { 36 | if (source === null || source === undefined) { 37 | return {}; 38 | } 39 | 40 | if (typeof source == 'boolean') { 41 | return {}; 42 | } 43 | 44 | if (typeof source == 'number' && source == -1) { 45 | return defaults(DEFAULT_PRECISION); 46 | } 47 | 48 | if (typeof source == 'number') { 49 | return defaults(source); 50 | } 51 | 52 | if (typeof source == 'string' && INTEGER_PATTERN.test(source)) { 53 | return defaults(parseInt(source)); 54 | } 55 | 56 | if (typeof source == 'string' && source == DEFAULT_PRECISION) { 57 | return defaults(DEFAULT_PRECISION); 58 | } 59 | 60 | if (typeof source == 'object') { 61 | return source; 62 | } 63 | 64 | return source 65 | .split(DIRECTIVES_SEPARATOR) 66 | .reduce(function (accumulator, directive) { 67 | var directiveParts = directive.split(DIRECTIVE_VALUE_SEPARATOR); 68 | var name = directiveParts[0]; 69 | var value = parseInt(directiveParts[1]); 70 | 71 | if (isNaN(value) || value == -1) { 72 | value = DEFAULT_PRECISION; 73 | } 74 | 75 | if (ALL_UNITS.indexOf(name) > -1) { 76 | accumulator = override(accumulator, defaults(value)); 77 | } else { 78 | accumulator[name] = value; 79 | } 80 | 81 | return accumulator; 82 | }, {}); 83 | } 84 | 85 | module.exports = { 86 | DEFAULT: DEFAULT_PRECISION, 87 | roundingPrecisionFrom: roundingPrecisionFrom 88 | }; 89 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/reader/extract-import-url-and-media.js: -------------------------------------------------------------------------------- 1 | var split = require('../utils/split'); 2 | 3 | var BRACE_PREFIX = /^\(/; 4 | var BRACE_SUFFIX = /\)$/; 5 | var IMPORT_PREFIX_PATTERN = /^@import/i; 6 | var QUOTE_PREFIX_PATTERN = /['"]\s*/; 7 | var QUOTE_SUFFIX_PATTERN = /\s*['"]/; 8 | var URL_PREFIX_PATTERN = /^url\(\s*/i; 9 | var URL_SUFFIX_PATTERN = /\s*\)/i; 10 | 11 | function extractImportUrlAndMedia(atRuleValue) { 12 | var uri; 13 | var mediaQuery; 14 | var stripped; 15 | var parts; 16 | 17 | stripped = atRuleValue 18 | .replace(IMPORT_PREFIX_PATTERN, '') 19 | .trim() 20 | .replace(URL_PREFIX_PATTERN, '(') 21 | .replace(URL_SUFFIX_PATTERN, ')') 22 | .replace(QUOTE_PREFIX_PATTERN, '') 23 | .replace(QUOTE_SUFFIX_PATTERN, ''); 24 | 25 | parts = split(stripped, ' '); 26 | 27 | uri = parts[0] 28 | .replace(BRACE_PREFIX, '') 29 | .replace(BRACE_SUFFIX, ''); 30 | mediaQuery = parts.slice(1).join(' '); 31 | 32 | return [uri, mediaQuery]; 33 | } 34 | 35 | module.exports = extractImportUrlAndMedia; 36 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/reader/input-source-map-tracker.js: -------------------------------------------------------------------------------- 1 | var SourceMapConsumer = require('source-map').SourceMapConsumer; 2 | 3 | function inputSourceMapTracker() { 4 | var maps = {}; 5 | 6 | return { 7 | all: all.bind(null, maps), 8 | isTracking: isTracking.bind(null, maps), 9 | originalPositionFor: originalPositionFor.bind(null, maps), 10 | track: track.bind(null, maps) 11 | }; 12 | } 13 | 14 | function all(maps) { 15 | return maps; 16 | } 17 | 18 | function isTracking(maps, source) { 19 | return source in maps; 20 | } 21 | 22 | function originalPositionFor(maps, metadata, range, selectorFallbacks) { 23 | var line = metadata[0]; 24 | var column = metadata[1]; 25 | var source = metadata[2]; 26 | var position = { 27 | line: line, 28 | column: column + range 29 | }; 30 | var originalPosition; 31 | 32 | while (!originalPosition && position.column > column) { 33 | position.column--; 34 | originalPosition = maps[source].originalPositionFor(position); 35 | } 36 | 37 | if (!originalPosition || originalPosition.column < 0) { 38 | return metadata; 39 | } 40 | 41 | if (originalPosition.line === null && line > 1 && selectorFallbacks > 0) { 42 | return originalPositionFor(maps, [line - 1, column, source], range, selectorFallbacks - 1); 43 | } 44 | 45 | return originalPosition.line !== null ? 46 | toMetadata(originalPosition) : 47 | metadata; 48 | } 49 | 50 | function toMetadata(asHash) { 51 | return [asHash.line, asHash.column, asHash.source]; 52 | } 53 | 54 | function track(maps, source, data) { 55 | maps[source] = new SourceMapConsumer(data); 56 | } 57 | 58 | module.exports = inputSourceMapTracker; 59 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/reader/is-allowed-resource.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var url = require('url'); 3 | 4 | var isRemoteResource = require('../utils/is-remote-resource'); 5 | var hasProtocol = require('../utils/has-protocol'); 6 | 7 | var HTTP_PROTOCOL = 'http:'; 8 | 9 | function isAllowedResource(uri, isRemote, rules) { 10 | var match; 11 | var absoluteUri; 12 | var allowed = isRemote ? false : true; 13 | var rule; 14 | var isNegated; 15 | var normalizedRule; 16 | var i; 17 | 18 | if (rules.length === 0) { 19 | return false; 20 | } 21 | 22 | if (isRemote && !hasProtocol(uri)) { 23 | uri = HTTP_PROTOCOL + uri; 24 | } 25 | 26 | match = isRemote ? 27 | url.parse(uri).host : 28 | uri; 29 | 30 | absoluteUri = isRemote ? 31 | uri : 32 | path.resolve(uri); 33 | 34 | for (i = 0; i < rules.length; i++) { 35 | rule = rules[i]; 36 | isNegated = rule[0] == '!'; 37 | normalizedRule = rule.substring(1); 38 | 39 | if (isNegated && isRemote && isRemoteRule(normalizedRule)) { 40 | allowed = allowed && !isAllowedResource(uri, true, [normalizedRule]); 41 | } else if (isNegated && !isRemote && !isRemoteRule(normalizedRule)) { 42 | allowed = allowed && !isAllowedResource(uri, false, [normalizedRule]); 43 | } else if (isNegated) { 44 | allowed = allowed && true; 45 | } else if (rule == 'all') { 46 | allowed = true; 47 | } else if (isRemote && rule == 'local') { 48 | allowed = allowed || false; 49 | } else if (isRemote && rule == 'remote') { 50 | allowed = true; 51 | } else if (!isRemote && rule == 'remote') { 52 | allowed = false; 53 | } else if (!isRemote && rule == 'local') { 54 | allowed = true; 55 | } else if (rule === match) { 56 | allowed = true; 57 | } else if (rule === uri) { 58 | allowed = true; 59 | } else if (isRemote && absoluteUri.indexOf(rule) === 0) { 60 | allowed = true; 61 | } else if (!isRemote && absoluteUri.indexOf(path.resolve(rule)) === 0) { 62 | allowed = true; 63 | } else if (isRemote != isRemoteRule(normalizedRule)) { 64 | allowed = allowed && true; 65 | } else { 66 | allowed = false; 67 | } 68 | } 69 | 70 | return allowed; 71 | } 72 | 73 | function isRemoteRule(rule) { 74 | return isRemoteResource(rule) || url.parse(HTTP_PROTOCOL + '//' + rule).host == rule; 75 | } 76 | 77 | module.exports = isAllowedResource; 78 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/reader/load-remote-resource.js: -------------------------------------------------------------------------------- 1 | var http = require('http'); 2 | var https = require('https'); 3 | var url = require('url'); 4 | 5 | var isHttpResource = require('../utils/is-http-resource'); 6 | var isHttpsResource = require('../utils/is-https-resource'); 7 | var override = require('../utils/override'); 8 | 9 | var HTTP_PROTOCOL = 'http:'; 10 | 11 | function loadRemoteResource(uri, inlineRequest, inlineTimeout, callback) { 12 | var proxyProtocol = inlineRequest.protocol || inlineRequest.hostname; 13 | var errorHandled = false; 14 | var requestOptions; 15 | var fetch; 16 | 17 | requestOptions = override( 18 | url.parse(uri), 19 | inlineRequest || {} 20 | ); 21 | 22 | if (inlineRequest.hostname !== undefined) { 23 | // overwrite as we always expect a http proxy currently 24 | requestOptions.protocol = inlineRequest.protocol || HTTP_PROTOCOL; 25 | requestOptions.path = requestOptions.href; 26 | } 27 | 28 | fetch = (proxyProtocol && !isHttpsResource(proxyProtocol)) || isHttpResource(uri) ? 29 | http.get : 30 | https.get; 31 | 32 | fetch(requestOptions, function (res) { 33 | var chunks = []; 34 | var movedUri; 35 | 36 | if (errorHandled) { 37 | return; 38 | } 39 | 40 | if (res.statusCode < 200 || res.statusCode > 399) { 41 | return callback(res.statusCode, null); 42 | } else if (res.statusCode > 299) { 43 | movedUri = url.resolve(uri, res.headers.location); 44 | return loadRemoteResource(movedUri, inlineRequest, inlineTimeout, callback); 45 | } 46 | 47 | res.on('data', function (chunk) { 48 | chunks.push(chunk.toString()); 49 | }); 50 | res.on('end', function () { 51 | var body = chunks.join(''); 52 | callback(null, body); 53 | }); 54 | }) 55 | .on('error', function (res) { 56 | if (errorHandled) { 57 | return; 58 | } 59 | 60 | errorHandled = true; 61 | callback(res.message, null); 62 | }) 63 | .on('timeout', function () { 64 | if (errorHandled) { 65 | return; 66 | } 67 | 68 | errorHandled = true; 69 | callback('timeout', null); 70 | }) 71 | .setTimeout(inlineTimeout); 72 | } 73 | 74 | module.exports = loadRemoteResource; 75 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/reader/match-data-uri.js: -------------------------------------------------------------------------------- 1 | var DATA_URI_PATTERN = /^data:(\S*?)?(;charset=[^;]+)?(;[^,]+?)?,(.+)/; 2 | 3 | function matchDataUri(uri) { 4 | return DATA_URI_PATTERN.exec(uri); 5 | } 6 | 7 | module.exports = matchDataUri; 8 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/reader/normalize-path.js: -------------------------------------------------------------------------------- 1 | var UNIX_SEPARATOR = '/'; 2 | var WINDOWS_SEPARATOR_PATTERN = /\\/g; 3 | 4 | function normalizePath(path) { 5 | return path.replace(WINDOWS_SEPARATOR_PATTERN, UNIX_SEPARATOR); 6 | } 7 | 8 | module.exports = normalizePath; 9 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/reader/rebase-local-map.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | 3 | function rebaseLocalMap(sourceMap, sourceUri, rebaseTo) { 4 | var currentPath = path.resolve(''); 5 | var absoluteUri = path.resolve(currentPath, sourceUri); 6 | var absoluteUriDirectory = path.dirname(absoluteUri); 7 | 8 | sourceMap.sources = sourceMap.sources.map(function(source) { 9 | return path.relative(rebaseTo, path.resolve(absoluteUriDirectory, source)); 10 | }); 11 | 12 | return sourceMap; 13 | } 14 | 15 | module.exports = rebaseLocalMap; 16 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/reader/rebase-remote-map.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var url = require('url'); 3 | 4 | function rebaseRemoteMap(sourceMap, sourceUri) { 5 | var sourceDirectory = path.dirname(sourceUri); 6 | 7 | sourceMap.sources = sourceMap.sources.map(function(source) { 8 | return url.resolve(sourceDirectory, source); 9 | }); 10 | 11 | return sourceMap; 12 | } 13 | 14 | module.exports = rebaseRemoteMap; 15 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/reader/rebase.js: -------------------------------------------------------------------------------- 1 | var extractImportUrlAndMedia = require('./extract-import-url-and-media'); 2 | var restoreImport = require('./restore-import'); 3 | var rewriteUrl = require('./rewrite-url'); 4 | 5 | var Token = require('../tokenizer/token'); 6 | var isImport = require('../utils/is-import'); 7 | 8 | var SOURCE_MAP_COMMENT_PATTERN = /^\/\*# sourceMappingURL=(\S+) \*\/$/; 9 | 10 | function rebase(tokens, rebaseAll, validator, rebaseConfig) { 11 | return rebaseAll ? 12 | rebaseEverything(tokens, validator, rebaseConfig) : 13 | rebaseAtRules(tokens, validator, rebaseConfig); 14 | } 15 | 16 | function rebaseEverything(tokens, validator, rebaseConfig) { 17 | var token; 18 | var i, l; 19 | 20 | for (i = 0, l = tokens.length; i < l; i++) { 21 | token = tokens[i]; 22 | 23 | switch (token[0]) { 24 | case Token.AT_RULE: 25 | rebaseAtRule(token, validator, rebaseConfig); 26 | break; 27 | case Token.AT_RULE_BLOCK: 28 | rebaseProperties(token[2], validator, rebaseConfig); 29 | break; 30 | case Token.COMMENT: 31 | rebaseSourceMapComment(token, rebaseConfig); 32 | break; 33 | case Token.NESTED_BLOCK: 34 | rebaseEverything(token[2], validator, rebaseConfig); 35 | break; 36 | case Token.RULE: 37 | rebaseProperties(token[2], validator, rebaseConfig); 38 | break; 39 | } 40 | } 41 | 42 | return tokens; 43 | } 44 | 45 | function rebaseAtRules(tokens, validator, rebaseConfig) { 46 | var token; 47 | var i, l; 48 | 49 | for (i = 0, l = tokens.length; i < l; i++) { 50 | token = tokens[i]; 51 | 52 | switch (token[0]) { 53 | case Token.AT_RULE: 54 | rebaseAtRule(token, validator, rebaseConfig); 55 | break; 56 | } 57 | } 58 | 59 | return tokens; 60 | } 61 | 62 | function rebaseAtRule(token, validator, rebaseConfig) { 63 | if (!isImport(token[1])) { 64 | return; 65 | } 66 | 67 | var uriAndMediaQuery = extractImportUrlAndMedia(token[1]); 68 | var newUrl = rewriteUrl(uriAndMediaQuery[0], rebaseConfig); 69 | var mediaQuery = uriAndMediaQuery[1]; 70 | 71 | token[1] = restoreImport(newUrl, mediaQuery); 72 | } 73 | 74 | function rebaseSourceMapComment(token, rebaseConfig) { 75 | var matches = SOURCE_MAP_COMMENT_PATTERN.exec(token[1]); 76 | 77 | if (matches && matches[1].indexOf('data:') === -1) { 78 | token[1] = token[1].replace(matches[1], rewriteUrl(matches[1], rebaseConfig, true)); 79 | } 80 | } 81 | 82 | function rebaseProperties(properties, validator, rebaseConfig) { 83 | var property; 84 | var value; 85 | var i, l; 86 | var j, m; 87 | 88 | for (i = 0, l = properties.length; i < l; i++) { 89 | property = properties[i]; 90 | 91 | for (j = 2 /* 0 is Token.PROPERTY, 1 is name */, m = property.length; j < m; j++) { 92 | value = property[j][1]; 93 | 94 | if (validator.isUrl(value)) { 95 | property[j][1] = rewriteUrl(value, rebaseConfig); 96 | } 97 | } 98 | } 99 | } 100 | 101 | module.exports = rebase; 102 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/reader/restore-import.js: -------------------------------------------------------------------------------- 1 | function restoreImport(uri, mediaQuery) { 2 | return ('@import ' + uri + ' ' + mediaQuery).trim(); 3 | } 4 | 5 | module.exports = restoreImport; 6 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/reader/rewrite-url.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var url = require('url'); 3 | 4 | var DOUBLE_QUOTE = '"'; 5 | var SINGLE_QUOTE = '\''; 6 | var URL_PREFIX = 'url('; 7 | var URL_SUFFIX = ')'; 8 | 9 | var QUOTE_PREFIX_PATTERN = /^["']/; 10 | var QUOTE_SUFFIX_PATTERN = /["']$/; 11 | var ROUND_BRACKETS_PATTERN = /[\(\)]/; 12 | var URL_PREFIX_PATTERN = /^url\(/i; 13 | var URL_SUFFIX_PATTERN = /\)$/; 14 | var WHITESPACE_PATTERN = /\s/; 15 | 16 | var isWindows = process.platform == 'win32'; 17 | 18 | function rebase(uri, rebaseConfig) { 19 | if (!rebaseConfig) { 20 | return uri; 21 | } 22 | 23 | if (isAbsolute(uri) && !isRemote(rebaseConfig.toBase)) { 24 | return uri; 25 | } 26 | 27 | if (isRemote(uri) || isSVGMarker(uri) || isInternal(uri)) { 28 | return uri; 29 | } 30 | 31 | if (isData(uri)) { 32 | return '\'' + uri + '\''; 33 | } 34 | 35 | if (isRemote(rebaseConfig.toBase)) { 36 | return url.resolve(rebaseConfig.toBase, uri); 37 | } 38 | 39 | return rebaseConfig.absolute ? 40 | normalize(absolute(uri, rebaseConfig)) : 41 | normalize(relative(uri, rebaseConfig)); 42 | } 43 | 44 | function isAbsolute(uri) { 45 | return path.isAbsolute(uri); 46 | } 47 | 48 | function isSVGMarker(uri) { 49 | return uri[0] == '#'; 50 | } 51 | 52 | function isInternal(uri) { 53 | return /^\w+:\w+/.test(uri); 54 | } 55 | 56 | function isRemote(uri) { 57 | return /^[^:]+?:\/\//.test(uri) || uri.indexOf('//') === 0; 58 | } 59 | 60 | function isData(uri) { 61 | return uri.indexOf('data:') === 0; 62 | } 63 | 64 | function absolute(uri, rebaseConfig) { 65 | return path 66 | .resolve(path.join(rebaseConfig.fromBase || '', uri)) 67 | .replace(rebaseConfig.toBase, ''); 68 | } 69 | 70 | function relative(uri, rebaseConfig) { 71 | return path.relative(rebaseConfig.toBase, path.join(rebaseConfig.fromBase || '', uri)); 72 | } 73 | 74 | function normalize(uri) { 75 | return isWindows ? uri.replace(/\\/g, '/') : uri; 76 | } 77 | 78 | function quoteFor(unquotedUrl) { 79 | if (unquotedUrl.indexOf(SINGLE_QUOTE) > -1) { 80 | return DOUBLE_QUOTE; 81 | } else if (unquotedUrl.indexOf(DOUBLE_QUOTE) > -1) { 82 | return SINGLE_QUOTE; 83 | } else if (hasWhitespace(unquotedUrl) || hasRoundBrackets(unquotedUrl)) { 84 | return SINGLE_QUOTE; 85 | } else { 86 | return ''; 87 | } 88 | } 89 | 90 | function hasWhitespace(url) { 91 | return WHITESPACE_PATTERN.test(url); 92 | } 93 | 94 | function hasRoundBrackets(url) { 95 | return ROUND_BRACKETS_PATTERN.test(url); 96 | } 97 | 98 | function rewriteUrl(originalUrl, rebaseConfig, pathOnly) { 99 | var strippedUrl = originalUrl 100 | .replace(URL_PREFIX_PATTERN, '') 101 | .replace(URL_SUFFIX_PATTERN, '') 102 | .trim(); 103 | 104 | var unquotedUrl = strippedUrl 105 | .replace(QUOTE_PREFIX_PATTERN, '') 106 | .replace(QUOTE_SUFFIX_PATTERN, '') 107 | .trim(); 108 | 109 | var quote = strippedUrl[0] == SINGLE_QUOTE || strippedUrl[0] == DOUBLE_QUOTE ? 110 | strippedUrl[0] : 111 | quoteFor(unquotedUrl); 112 | 113 | return pathOnly ? 114 | rebase(unquotedUrl, rebaseConfig) : 115 | URL_PREFIX + quote + rebase(unquotedUrl, rebaseConfig) + quote + URL_SUFFIX; 116 | } 117 | 118 | module.exports = rewriteUrl; 119 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/tokenizer/marker.js: -------------------------------------------------------------------------------- 1 | var Marker = { 2 | ASTERISK: '*', 3 | AT: '@', 4 | BACK_SLASH: '\\', 5 | CARRIAGE_RETURN: '\r', 6 | CLOSE_CURLY_BRACKET: '}', 7 | CLOSE_ROUND_BRACKET: ')', 8 | CLOSE_SQUARE_BRACKET: ']', 9 | COLON: ':', 10 | COMMA: ',', 11 | DOUBLE_QUOTE: '"', 12 | EXCLAMATION: '!', 13 | FORWARD_SLASH: '/', 14 | INTERNAL: '-clean-css-', 15 | NEW_LINE_NIX: '\n', 16 | OPEN_CURLY_BRACKET: '{', 17 | OPEN_ROUND_BRACKET: '(', 18 | OPEN_SQUARE_BRACKET: '[', 19 | SEMICOLON: ';', 20 | SINGLE_QUOTE: '\'', 21 | SPACE: ' ', 22 | TAB: '\t', 23 | UNDERSCORE: '_' 24 | }; 25 | 26 | module.exports = Marker; 27 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/tokenizer/token.js: -------------------------------------------------------------------------------- 1 | var Token = { 2 | AT_RULE: 'at-rule', // e.g. `@import`, `@charset` 3 | AT_RULE_BLOCK: 'at-rule-block', // e.g. `@font-face{...}` 4 | AT_RULE_BLOCK_SCOPE: 'at-rule-block-scope', // e.g. `@font-face` 5 | COMMENT: 'comment', // e.g. `/* comment */` 6 | NESTED_BLOCK: 'nested-block', // e.g. `@media screen{...}`, `@keyframes animation {...}` 7 | NESTED_BLOCK_SCOPE: 'nested-block-scope', // e.g. `@media`, `@keyframes` 8 | PROPERTY: 'property', // e.g. `color:red` 9 | PROPERTY_BLOCK: 'property-block', // e.g. `--var:{color:red}` 10 | PROPERTY_NAME: 'property-name', // e.g. `color` 11 | PROPERTY_VALUE: 'property-value', // e.g. `red` 12 | RAW: 'raw', // e.g. anything between /* clean-css ignore:start */ and /* clean-css ignore:end */ comments 13 | RULE: 'rule', // e.g `div > a{...}` 14 | RULE_SCOPE: 'rule-scope' // e.g `div > a` 15 | }; 16 | 17 | module.exports = Token; 18 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/utils/clone-array.js: -------------------------------------------------------------------------------- 1 | function cloneArray(array) { 2 | var cloned = array.slice(0); 3 | 4 | for (var i = 0, l = cloned.length; i < l; i++) { 5 | if (Array.isArray(cloned[i])) 6 | cloned[i] = cloneArray(cloned[i]); 7 | } 8 | 9 | return cloned; 10 | } 11 | 12 | module.exports = cloneArray; 13 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/utils/format-position.js: -------------------------------------------------------------------------------- 1 | function formatPosition(metadata) { 2 | var line = metadata[0]; 3 | var column = metadata[1]; 4 | var source = metadata[2]; 5 | 6 | return source ? 7 | source + ':' + line + ':' + column : 8 | line + ':' + column; 9 | } 10 | 11 | module.exports = formatPosition; 12 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/utils/has-protocol.js: -------------------------------------------------------------------------------- 1 | var NO_PROTOCOL_RESOURCE_PATTERN = /^\/\//; 2 | 3 | function hasProtocol(uri) { 4 | return !NO_PROTOCOL_RESOURCE_PATTERN.test(uri); 5 | } 6 | 7 | module.exports = hasProtocol; 8 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/utils/is-data-uri-resource.js: -------------------------------------------------------------------------------- 1 | var DATA_URI_PATTERN = /^data:(\S*?)?(;charset=[^;]+)?(;[^,]+?)?,(.+)/; 2 | 3 | function isDataUriResource(uri) { 4 | return DATA_URI_PATTERN.test(uri); 5 | } 6 | 7 | module.exports = isDataUriResource; 8 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/utils/is-http-resource.js: -------------------------------------------------------------------------------- 1 | var HTTP_RESOURCE_PATTERN = /^http:\/\//; 2 | 3 | function isHttpResource(uri) { 4 | return HTTP_RESOURCE_PATTERN.test(uri); 5 | } 6 | 7 | module.exports = isHttpResource; 8 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/utils/is-https-resource.js: -------------------------------------------------------------------------------- 1 | var HTTPS_RESOURCE_PATTERN = /^https:\/\//; 2 | 3 | function isHttpsResource(uri) { 4 | return HTTPS_RESOURCE_PATTERN.test(uri); 5 | } 6 | 7 | module.exports = isHttpsResource; 8 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/utils/is-import.js: -------------------------------------------------------------------------------- 1 | var IMPORT_PREFIX_PATTERN = /^@import/i; 2 | 3 | function isImport(value) { 4 | return IMPORT_PREFIX_PATTERN.test(value); 5 | } 6 | 7 | module.exports = isImport; 8 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/utils/is-remote-resource.js: -------------------------------------------------------------------------------- 1 | var REMOTE_RESOURCE_PATTERN = /^(\w+:\/\/|\/\/)/; 2 | 3 | function isRemoteResource(uri) { 4 | return REMOTE_RESOURCE_PATTERN.test(uri); 5 | } 6 | 7 | module.exports = isRemoteResource; 8 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/utils/natural-compare.js: -------------------------------------------------------------------------------- 1 | // adapted from http://nedbatchelder.com/blog/200712.html#e20071211T054956 2 | 3 | var NUMBER_PATTERN = /([0-9]+)/; 4 | 5 | function naturalCompare(value1, value2) { 6 | var keys1 = ('' + value1).split(NUMBER_PATTERN).map(tryParseInt); 7 | var keys2 = ('' + value2).split(NUMBER_PATTERN).map(tryParseInt); 8 | var key1; 9 | var key2; 10 | var compareFirst = Math.min(keys1.length, keys2.length); 11 | var i, l; 12 | 13 | for (i = 0, l = compareFirst; i < l; i++) { 14 | key1 = keys1[i]; 15 | key2 = keys2[i]; 16 | 17 | if (key1 != key2) { 18 | return key1 > key2 ? 1 : -1; 19 | } 20 | } 21 | 22 | return keys1.length > keys2.length ? 1 : (keys1.length == keys2.length ? 0 : -1); 23 | } 24 | 25 | function tryParseInt(value) { 26 | return ('' + parseInt(value)) == value ? 27 | parseInt(value) : 28 | value; 29 | } 30 | 31 | module.exports = naturalCompare; 32 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/utils/override.js: -------------------------------------------------------------------------------- 1 | function override(source1, source2) { 2 | var target = {}; 3 | var key1; 4 | var key2; 5 | var item; 6 | 7 | for (key1 in source1) { 8 | item = source1[key1]; 9 | 10 | if (Array.isArray(item)) { 11 | target[key1] = item.slice(0); 12 | } else if (typeof item == 'object' && item !== null) { 13 | target[key1] = override(item, {}); 14 | } else { 15 | target[key1] = item; 16 | } 17 | } 18 | 19 | for (key2 in source2) { 20 | item = source2[key2]; 21 | 22 | if (key2 in target && Array.isArray(item)) { 23 | target[key2] = item.slice(0); 24 | } else if (key2 in target && typeof item == 'object' && item !== null) { 25 | target[key2] = override(target[key2], item); 26 | } else { 27 | target[key2] = item; 28 | } 29 | } 30 | 31 | return target; 32 | } 33 | 34 | module.exports = override; 35 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/utils/split.js: -------------------------------------------------------------------------------- 1 | var Marker = require('../tokenizer/marker'); 2 | 3 | function split(value, separator) { 4 | var openLevel = Marker.OPEN_ROUND_BRACKET; 5 | var closeLevel = Marker.CLOSE_ROUND_BRACKET; 6 | var level = 0; 7 | var cursor = 0; 8 | var lastStart = 0; 9 | var lastValue; 10 | var lastCharacter; 11 | var len = value.length; 12 | var parts = []; 13 | 14 | if (value.indexOf(separator) == -1) { 15 | return [value]; 16 | } 17 | 18 | if (value.indexOf(openLevel) == -1) { 19 | return value.split(separator); 20 | } 21 | 22 | while (cursor < len) { 23 | if (value[cursor] == openLevel) { 24 | level++; 25 | } else if (value[cursor] == closeLevel) { 26 | level--; 27 | } 28 | 29 | if (level === 0 && cursor > 0 && cursor + 1 < len && value[cursor] == separator) { 30 | parts.push(value.substring(lastStart, cursor)); 31 | lastStart = cursor + 1; 32 | } 33 | 34 | cursor++; 35 | } 36 | 37 | if (lastStart < cursor + 1) { 38 | lastValue = value.substring(lastStart); 39 | lastCharacter = lastValue[lastValue.length - 1]; 40 | if (lastCharacter == separator) { 41 | lastValue = lastValue.substring(0, lastValue.length - 1); 42 | } 43 | 44 | parts.push(lastValue); 45 | } 46 | 47 | return parts; 48 | } 49 | 50 | module.exports = split; 51 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/writer/one-time.js: -------------------------------------------------------------------------------- 1 | var helpers = require('./helpers'); 2 | 3 | function store(serializeContext, token) { 4 | serializeContext.output.push(typeof token == 'string' ? token : token[1]); 5 | } 6 | 7 | function context() { 8 | var newContext = { 9 | output: [], 10 | store: store 11 | }; 12 | 13 | return newContext; 14 | } 15 | 16 | function all(tokens) { 17 | var oneTimeContext = context(); 18 | helpers.all(oneTimeContext, tokens); 19 | return oneTimeContext.output.join(''); 20 | } 21 | 22 | function body(tokens) { 23 | var oneTimeContext = context(); 24 | helpers.body(oneTimeContext, tokens); 25 | return oneTimeContext.output.join(''); 26 | } 27 | 28 | function property(tokens, position) { 29 | var oneTimeContext = context(); 30 | helpers.property(oneTimeContext, tokens, position, true); 31 | return oneTimeContext.output.join(''); 32 | } 33 | 34 | function rules(tokens) { 35 | var oneTimeContext = context(); 36 | helpers.rules(oneTimeContext, tokens); 37 | return oneTimeContext.output.join(''); 38 | } 39 | 40 | function value(tokens) { 41 | var oneTimeContext = context(); 42 | helpers.value(oneTimeContext, tokens); 43 | return oneTimeContext.output.join(''); 44 | } 45 | 46 | module.exports = { 47 | all: all, 48 | body: body, 49 | property: property, 50 | rules: rules, 51 | value: value 52 | }; 53 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/lib/writer/simple.js: -------------------------------------------------------------------------------- 1 | var all = require('./helpers').all; 2 | 3 | function store(serializeContext, token) { 4 | var value = typeof token == 'string' ? 5 | token : 6 | token[1]; 7 | var wrap = serializeContext.wrap; 8 | 9 | wrap(serializeContext, value); 10 | track(serializeContext, value); 11 | serializeContext.output.push(value); 12 | } 13 | 14 | function wrap(serializeContext, value) { 15 | if (serializeContext.column + value.length > serializeContext.format.wrapAt) { 16 | track(serializeContext, serializeContext.format.breakWith); 17 | serializeContext.output.push(serializeContext.format.breakWith); 18 | } 19 | } 20 | 21 | function track(serializeContext, value) { 22 | var parts = value.split('\n'); 23 | 24 | serializeContext.line += parts.length - 1; 25 | serializeContext.column = parts.length > 1 ? 0 : (serializeContext.column + parts.pop().length); 26 | } 27 | 28 | function serializeStyles(tokens, context) { 29 | var serializeContext = { 30 | column: 0, 31 | format: context.options.format, 32 | indentBy: 0, 33 | indentWith: '', 34 | line: 1, 35 | output: [], 36 | spaceAfterClosingBrace: context.options.compatibility.properties.spaceAfterClosingBrace, 37 | store: store, 38 | wrap: context.options.format.wrapAt ? 39 | wrap : 40 | function () { /* noop */ } 41 | }; 42 | 43 | all(serializeContext, tokens); 44 | 45 | return { 46 | styles: serializeContext.output.join('') 47 | }; 48 | } 49 | 50 | module.exports = serializeStyles; 51 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/clean-css/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "clean-css@^4.2.1", 3 | "_id": "clean-css@4.2.3", 4 | "_inBundle": false, 5 | "_integrity": "sha512-VcMWDN54ZN/DS+g58HYL5/n4Zrqe8vHJpGA8KdgUXFU4fuP/aHNw8eld9SyEIyabIMJX/0RaY/fplOo5hYLSFA==", 6 | "_location": "/clean-css", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "clean-css@^4.2.1", 12 | "name": "clean-css", 13 | "escapedName": "clean-css", 14 | "rawSpec": "^4.2.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^4.2.1" 17 | }, 18 | "_requiredBy": [ 19 | "/html-minifier" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.3.tgz", 22 | "_shasum": "507b5de7d97b48ee53d84adb0160ff6216380f78", 23 | "_spec": "clean-css@^4.2.1", 24 | "_where": "/Users/danbartlett/Dev/AWS/SAM/aws-serverless-cms/dependencies/nodejs/node_modules/html-minifier", 25 | "author": { 26 | "name": "Jakub Pawlowicz", 27 | "email": "contact@jakubpawlowicz.com", 28 | "url": "http://twitter.com/jakubpawlowicz" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/jakubpawlowicz/clean-css/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": { 35 | "source-map": "~0.6.0" 36 | }, 37 | "deprecated": false, 38 | "description": "A well-tested CSS minifier", 39 | "devDependencies": { 40 | "browserify": "^14.0.0", 41 | "http-proxy": "1.x", 42 | "jshint": "2.x", 43 | "nock": "9.x", 44 | "server-destroy": "1.x", 45 | "uglify-js": ">=2.6.1", 46 | "vows": "0.8.x" 47 | }, 48 | "engines": { 49 | "node": ">= 4.0" 50 | }, 51 | "files": [ 52 | "lib", 53 | "History.md", 54 | "index.js", 55 | "LICENSE" 56 | ], 57 | "homepage": "https://github.com/jakubpawlowicz/clean-css", 58 | "keywords": [ 59 | "css", 60 | "minifier" 61 | ], 62 | "license": "MIT", 63 | "main": "index.js", 64 | "name": "clean-css", 65 | "repository": { 66 | "type": "git", 67 | "url": "git+https://github.com/jakubpawlowicz/clean-css.git" 68 | }, 69 | "scripts": { 70 | "bench": "node ./test/bench.js", 71 | "browserify": "browserify --standalone CleanCSS index.js | uglifyjs --compress --mangle -o cleancss-browser.js", 72 | "check": "jshint .", 73 | "prepublish": "npm run check", 74 | "test": "vows" 75 | }, 76 | "version": "4.2.3" 77 | } 78 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/commander/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2011 TJ Holowaychuk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/commander/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "commander@^2.19.0", 3 | "_id": "commander@2.20.3", 4 | "_inBundle": false, 5 | "_integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", 6 | "_location": "/commander", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "commander@^2.19.0", 12 | "name": "commander", 13 | "escapedName": "commander", 14 | "rawSpec": "^2.19.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^2.19.0" 17 | }, 18 | "_requiredBy": [ 19 | "/html-minifier", 20 | "/uglify-js" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", 23 | "_shasum": "fd485e84c03eb4881c20722ba48035e8531aeb33", 24 | "_spec": "commander@^2.19.0", 25 | "_where": "/Users/danbartlett/Dev/AWS/SAM/aws-serverless-cms/dependencies/nodejs/node_modules/html-minifier", 26 | "author": { 27 | "name": "TJ Holowaychuk", 28 | "email": "tj@vision-media.ca" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/tj/commander.js/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": {}, 35 | "deprecated": false, 36 | "description": "the complete solution for node.js command-line programs", 37 | "devDependencies": { 38 | "@types/node": "^12.7.8", 39 | "eslint": "^6.4.0", 40 | "should": "^13.2.3", 41 | "sinon": "^7.5.0", 42 | "standard": "^14.3.1", 43 | "ts-node": "^8.4.1", 44 | "typescript": "^3.6.3" 45 | }, 46 | "files": [ 47 | "index.js", 48 | "typings/index.d.ts" 49 | ], 50 | "homepage": "https://github.com/tj/commander.js#readme", 51 | "keywords": [ 52 | "commander", 53 | "command", 54 | "option", 55 | "parser" 56 | ], 57 | "license": "MIT", 58 | "main": "index", 59 | "name": "commander", 60 | "repository": { 61 | "type": "git", 62 | "url": "git+https://github.com/tj/commander.js.git" 63 | }, 64 | "scripts": { 65 | "lint": "eslint index.js", 66 | "test": "node test/run.js && npm run test-typings", 67 | "test-typings": "tsc -p tsconfig.json" 68 | }, 69 | "typings": "typings/index.d.ts", 70 | "version": "2.20.3" 71 | } 72 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/he/LICENSE-MIT.txt: -------------------------------------------------------------------------------- 1 | Copyright Mathias Bynens 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/he/man/he.1: -------------------------------------------------------------------------------- 1 | .Dd April 5, 2016 2 | .Dt he 1 3 | .Sh NAME 4 | .Nm he 5 | .Nd encode/decode HTML entities just like a browser would 6 | .Sh SYNOPSIS 7 | .Nm 8 | .Op Fl -escape Ar string 9 | .br 10 | .Op Fl -encode Ar string 11 | .br 12 | .Op Fl -encode Fl -use-named-refs Fl -everything Fl -allow-unsafe Ar string 13 | .br 14 | .Op Fl -decode Ar string 15 | .br 16 | .Op Fl -decode Fl -attribute Ar string 17 | .br 18 | .Op Fl -decode Fl -strict Ar string 19 | .br 20 | .Op Fl v | -version 21 | .br 22 | .Op Fl h | -help 23 | .Sh DESCRIPTION 24 | .Nm 25 | encodes/decodes HTML entities in strings just like a browser would. 26 | .Sh OPTIONS 27 | .Bl -ohang -offset 28 | .It Sy "--escape" 29 | Take a string of text and escape it for use in text contexts in XML or HTML documents. Only the following characters are escaped: `&`, `<`, `>`, `"`, and `'`. 30 | .It Sy "--encode" 31 | Take a string of text and encode any symbols that aren't printable ASCII symbols and that can be replaced with character references. For example, it would turn `©` into `©`, but it wouldn't turn `+` into `+` since there is no point in doing so. Additionally, it replaces any remaining non-ASCII symbols with a hexadecimal escape sequence (e.g. `𝌆`). The return value of this function is always valid HTML. 32 | .It Sy "--encode --use-named-refs" 33 | Enable the use of named character references (like `©`) in the output. If compatibility with older browsers is a concern, don't use this option. 34 | .It Sy "--encode --everything" 35 | Encode every symbol in the input string, even safe printable ASCII symbols. 36 | .It Sy "--encode --allow-unsafe" 37 | Encode non-ASCII characters only. This leaves unsafe HTML/XML symbols like `&`, `<`, `>`, `"`, and `'` intact. 38 | .It Sy "--encode --decimal" 39 | Use decimal digits rather than hexadecimal digits for encoded character references, e.g. output `©` instead of `©`. 40 | .It Sy "--decode" 41 | Takes a string of HTML and decode any named and numerical character references in it using the algorithm described in the HTML spec. 42 | .It Sy "--decode --attribute" 43 | Parse the input as if it was an HTML attribute value rather than a string in an HTML text content. 44 | .It Sy "--decode --strict" 45 | Throw an error if an invalid character reference is encountered. 46 | .It Sy "-v, --version" 47 | Print he's version. 48 | .It Sy "-h, --help" 49 | Show the help screen. 50 | .El 51 | .Sh EXIT STATUS 52 | The 53 | .Nm he 54 | utility exits with one of the following values: 55 | .Pp 56 | .Bl -tag -width flag -compact 57 | .It Li 0 58 | .Nm 59 | did what it was instructed to do successfully; either it encoded/decoded the input and printed the result, or it printed the version or usage message. 60 | .It Li 1 61 | .Nm 62 | encountered an error. 63 | .El 64 | .Sh EXAMPLES 65 | .Bl -ohang -offset 66 | .It Sy "he --escape ''" 67 | Print an escaped version of the given string that is safe for use in HTML text contexts, escaping only `&`, `<`, `>`, `"`, and `'`. 68 | .It Sy "he --decode '©𝌆'" 69 | Print the decoded version of the given HTML string. 70 | .It Sy "echo\ '©𝌆'\ |\ he --decode" 71 | Print the decoded version of the HTML string that gets piped in. 72 | .El 73 | .Sh BUGS 74 | he's bug tracker is located at . 75 | .Sh AUTHOR 76 | Mathias Bynens 77 | .Sh WWW 78 | 79 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/he/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "he@^1.2.0", 3 | "_id": "he@1.2.0", 4 | "_inBundle": false, 5 | "_integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", 6 | "_location": "/he", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "he@^1.2.0", 12 | "name": "he", 13 | "escapedName": "he", 14 | "rawSpec": "^1.2.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.2.0" 17 | }, 18 | "_requiredBy": [ 19 | "/html-minifier" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", 22 | "_shasum": "84ae65fa7eafb165fddb61566ae14baf05664f0f", 23 | "_spec": "he@^1.2.0", 24 | "_where": "/Users/danbartlett/Dev/AWS/SAM/aws-serverless-cms/dependencies/nodejs/node_modules/html-minifier", 25 | "author": { 26 | "name": "Mathias Bynens", 27 | "url": "https://mathiasbynens.be/" 28 | }, 29 | "bin": { 30 | "he": "bin/he" 31 | }, 32 | "bugs": { 33 | "url": "https://github.com/mathiasbynens/he/issues" 34 | }, 35 | "bundleDependencies": false, 36 | "deprecated": false, 37 | "description": "A robust HTML entities encoder/decoder with full Unicode support.", 38 | "devDependencies": { 39 | "codecov.io": "^0.1.6", 40 | "grunt": "^0.4.5", 41 | "grunt-cli": "^1.3.1", 42 | "grunt-shell": "^1.1.1", 43 | "grunt-template": "^0.2.3", 44 | "istanbul": "^0.4.2", 45 | "jsesc": "^1.0.0", 46 | "lodash": "^4.8.2", 47 | "qunit-extras": "^1.4.5", 48 | "qunitjs": "~1.11.0", 49 | "regenerate": "^1.2.1", 50 | "regexgen": "^1.3.0", 51 | "requirejs": "^2.1.22", 52 | "sort-object": "^3.0.2" 53 | }, 54 | "directories": { 55 | "bin": "bin", 56 | "man": "man", 57 | "test": "tests" 58 | }, 59 | "files": [ 60 | "LICENSE-MIT.txt", 61 | "he.js", 62 | "bin/", 63 | "man/" 64 | ], 65 | "homepage": "https://mths.be/he", 66 | "keywords": [ 67 | "string", 68 | "entities", 69 | "entity", 70 | "html", 71 | "encode", 72 | "decode", 73 | "unicode" 74 | ], 75 | "license": "MIT", 76 | "main": "he.js", 77 | "man": [ 78 | "/Users/danbartlett/Dev/AWS/SAM/aws-serverless-cms/dependencies/nodejs/node_modules/he/man/he.1" 79 | ], 80 | "name": "he", 81 | "repository": { 82 | "type": "git", 83 | "url": "git+https://github.com/mathiasbynens/he.git" 84 | }, 85 | "scripts": { 86 | "build": "grunt build", 87 | "test": "node tests/tests.js" 88 | }, 89 | "version": "1.2.0" 90 | } 91 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/html-minifier/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2018 Juriy "kangax" Zaytsev 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/html-minifier/sample-cli-config-file.conf: -------------------------------------------------------------------------------- 1 | { 2 | "caseSensitive": false, 3 | "collapseBooleanAttributes": true, 4 | "collapseInlineTagWhitespace": false, 5 | "collapseWhitespace": true, 6 | "conservativeCollapse": false, 7 | "continueOnParseError": true, 8 | "customAttrCollapse": ".*", 9 | "decodeEntities": true, 10 | "html5": true, 11 | "ignoreCustomFragments": [ 12 | "<#[\\s\\S]*?#>", 13 | "<%[\\s\\S]*?%>", 14 | "<\\?[\\s\\S]*?\\?>" 15 | ], 16 | "includeAutoGeneratedTags": false, 17 | "keepClosingSlash": false, 18 | "maxLineLength": 0, 19 | "minifyCSS": true, 20 | "minifyJS": true, 21 | "preserveLineBreaks": false, 22 | "preventAttributesEscaping": false, 23 | "processConditionalComments": true, 24 | "processScripts": [ 25 | "text/html" 26 | ], 27 | "removeAttributeQuotes": true, 28 | "removeComments": true, 29 | "removeEmptyAttributes": true, 30 | "removeEmptyElements": true, 31 | "removeOptionalTags": true, 32 | "removeRedundantAttributes": true, 33 | "removeScriptTypeAttributes": true, 34 | "removeStyleLinkTypeAttributes": true, 35 | "removeTagWhitespace": true, 36 | "sortAttributes": true, 37 | "sortClassName": true, 38 | "trimCustomFragments": true, 39 | "useShortDoctype": true 40 | } 41 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/html-minifier/src/tokenchain.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function Sorter() { 4 | } 5 | 6 | Sorter.prototype.sort = function(tokens, fromIndex) { 7 | fromIndex = fromIndex || 0; 8 | for (var i = 0, len = this.keys.length; i < len; i++) { 9 | var key = this.keys[i]; 10 | var token = key.slice(1); 11 | var index = tokens.indexOf(token, fromIndex); 12 | if (index !== -1) { 13 | do { 14 | if (index !== fromIndex) { 15 | tokens.splice(index, 1); 16 | tokens.splice(fromIndex, 0, token); 17 | } 18 | fromIndex++; 19 | } while ((index = tokens.indexOf(token, fromIndex)) !== -1); 20 | return this[key].sort(tokens, fromIndex); 21 | } 22 | } 23 | return tokens; 24 | }; 25 | 26 | function TokenChain() { 27 | } 28 | 29 | TokenChain.prototype = { 30 | add: function(tokens) { 31 | var self = this; 32 | tokens.forEach(function(token) { 33 | var key = '$' + token; 34 | if (!self[key]) { 35 | self[key] = []; 36 | self[key].processed = 0; 37 | } 38 | self[key].push(tokens); 39 | }); 40 | }, 41 | createSorter: function() { 42 | var self = this; 43 | var sorter = new Sorter(); 44 | sorter.keys = Object.keys(self).sort(function(j, k) { 45 | var m = self[j].length; 46 | var n = self[k].length; 47 | return m < n ? 1 : m > n ? -1 : j < k ? -1 : j > k ? 1 : 0; 48 | }).filter(function(key) { 49 | if (self[key].processed < self[key].length) { 50 | var token = key.slice(1); 51 | var chain = new TokenChain(); 52 | self[key].forEach(function(tokens) { 53 | var index; 54 | while ((index = tokens.indexOf(token)) !== -1) { 55 | tokens.splice(index, 1); 56 | } 57 | tokens.forEach(function(token) { 58 | self['$' + token].processed++; 59 | }); 60 | chain.add(tokens.slice(0)); 61 | }); 62 | sorter[key] = chain.createSorter(); 63 | return true; 64 | } 65 | return false; 66 | }); 67 | return sorter; 68 | } 69 | }; 70 | 71 | module.exports = TokenChain; 72 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/html-minifier/src/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function createMap(values, ignoreCase) { 4 | var map = {}; 5 | values.forEach(function(value) { 6 | map[value] = 1; 7 | }); 8 | return ignoreCase ? function(value) { 9 | return map[value.toLowerCase()] === 1; 10 | } : function(value) { 11 | return map[value] === 1; 12 | }; 13 | } 14 | 15 | exports.createMap = createMap; 16 | exports.createMapFromString = function(values, ignoreCase) { 17 | return createMap(values.split(/,/), ignoreCase); 18 | }; 19 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/lower-case/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/lower-case/README.md: -------------------------------------------------------------------------------- 1 | # Lower Case 2 | 3 | [![NPM version][npm-image]][npm-url] 4 | [![NPM downloads][downloads-image]][downloads-url] 5 | [![Build status][travis-image]][travis-url] 6 | [![Test coverage][coveralls-image]][coveralls-url] 7 | 8 | Lower case a string. 9 | 10 | Supports Unicode (non-ASCII characters) and non-string entities, such as objects with a `toString` property, numbers and booleans. Empty values (`null` and `undefined`) will result in an empty string. 11 | 12 | ## Installation 13 | 14 | ``` 15 | npm install lower-case --save 16 | ``` 17 | 18 | ## Usage 19 | 20 | ```js 21 | var lowerCase = require('lower-case') 22 | 23 | lowerCase(null) //=> "" 24 | lowerCase('STRING') //=> "string" 25 | lowerCase('STRING', 'tr') //=> "strıng" 26 | 27 | lowerCase({ toString: function () { return 'TEST' } }) //=> "test" 28 | ``` 29 | 30 | ## Typings 31 | 32 | Includes a [TypeScript definition](lower-case.d.ts). 33 | 34 | ## License 35 | 36 | MIT 37 | 38 | [npm-image]: https://img.shields.io/npm/v/lower-case.svg?style=flat 39 | [npm-url]: https://npmjs.org/package/lower-case 40 | [downloads-image]: https://img.shields.io/npm/dm/lower-case.svg?style=flat 41 | [downloads-url]: https://npmjs.org/package/lower-case 42 | [travis-image]: https://img.shields.io/travis/blakeembrey/lower-case.svg?style=flat 43 | [travis-url]: https://travis-ci.org/blakeembrey/lower-case 44 | [coveralls-image]: https://img.shields.io/coveralls/blakeembrey/lower-case.svg?style=flat 45 | [coveralls-url]: https://coveralls.io/r/blakeembrey/lower-case?branch=master 46 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/lower-case/lower-case.d.ts: -------------------------------------------------------------------------------- 1 | declare function lowerCase (value: string, locale?: string): string; 2 | 3 | export = lowerCase; 4 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/lower-case/lower-case.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Special language-specific overrides. 3 | * 4 | * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt 5 | * 6 | * @type {Object} 7 | */ 8 | var LANGUAGES = { 9 | tr: { 10 | regexp: /\u0130|\u0049|\u0049\u0307/g, 11 | map: { 12 | '\u0130': '\u0069', 13 | '\u0049': '\u0131', 14 | '\u0049\u0307': '\u0069' 15 | } 16 | }, 17 | az: { 18 | regexp: /[\u0130]/g, 19 | map: { 20 | '\u0130': '\u0069', 21 | '\u0049': '\u0131', 22 | '\u0049\u0307': '\u0069' 23 | } 24 | }, 25 | lt: { 26 | regexp: /[\u0049\u004A\u012E\u00CC\u00CD\u0128]/g, 27 | map: { 28 | '\u0049': '\u0069\u0307', 29 | '\u004A': '\u006A\u0307', 30 | '\u012E': '\u012F\u0307', 31 | '\u00CC': '\u0069\u0307\u0300', 32 | '\u00CD': '\u0069\u0307\u0301', 33 | '\u0128': '\u0069\u0307\u0303' 34 | } 35 | } 36 | } 37 | 38 | /** 39 | * Lowercase a string. 40 | * 41 | * @param {String} str 42 | * @return {String} 43 | */ 44 | module.exports = function (str, locale) { 45 | var lang = LANGUAGES[locale] 46 | 47 | str = str == null ? '' : String(str) 48 | 49 | if (lang) { 50 | str = str.replace(lang.regexp, function (m) { return lang.map[m] }) 51 | } 52 | 53 | return str.toLowerCase() 54 | } 55 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/lower-case/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "lower-case@^1.1.1", 3 | "_id": "lower-case@1.1.4", 4 | "_inBundle": false, 5 | "_integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=", 6 | "_location": "/lower-case", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "lower-case@^1.1.1", 12 | "name": "lower-case", 13 | "escapedName": "lower-case", 14 | "rawSpec": "^1.1.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.1.1" 17 | }, 18 | "_requiredBy": [ 19 | "/no-case" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", 22 | "_shasum": "9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac", 23 | "_spec": "lower-case@^1.1.1", 24 | "_where": "/Users/danbartlett/Dev/AWS/SAM/aws-serverless-cms/dependencies/nodejs/node_modules/no-case", 25 | "author": { 26 | "name": "Blake Embrey", 27 | "email": "hello@blakeembrey.com", 28 | "url": "http://blakeembrey.me" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/blakeembrey/lower-case/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": {}, 35 | "deprecated": false, 36 | "description": "Lowercase a string", 37 | "devDependencies": { 38 | "istanbul": "^0.3.5", 39 | "mocha": "^2.1.0", 40 | "pre-commit": "^1.0.2", 41 | "standard": "^2.4.5" 42 | }, 43 | "files": [ 44 | "lower-case.js", 45 | "lower-case.d.ts", 46 | "LICENSE" 47 | ], 48 | "homepage": "https://github.com/blakeembrey/lower-case", 49 | "keywords": [ 50 | "cases", 51 | "lower", 52 | "lowercase", 53 | "case" 54 | ], 55 | "license": "MIT", 56 | "main": "lower-case.js", 57 | "name": "lower-case", 58 | "repository": { 59 | "type": "git", 60 | "url": "git://github.com/blakeembrey/lower-case.git" 61 | }, 62 | "scripts": { 63 | "lint": "standard", 64 | "test": "npm run lint && npm run test-cov", 65 | "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- -R spec --bail", 66 | "test-std": "mocha -- -R spec --bail" 67 | }, 68 | "standard": { 69 | "ignore": [ 70 | "coverage/**", 71 | "node_modules/**", 72 | "bower_components/**" 73 | ] 74 | }, 75 | "typings": "lower-case.d.ts", 76 | "version": "1.1.4" 77 | } 78 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/no-case/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/no-case/README.md: -------------------------------------------------------------------------------- 1 | # No Case 2 | 3 | [![NPM version][npm-image]][npm-url] 4 | [![NPM downloads][downloads-image]][downloads-url] 5 | [![Build status][travis-image]][travis-url] 6 | [![Test coverage][coveralls-image]][coveralls-url] 7 | [![Greenkeeper badge](https://badges.greenkeeper.io/blakeembrey/no-case.svg)](https://greenkeeper.io/) 8 | 9 | Transform a string to lower space cased. Optional locale and replacement character supported. 10 | 11 | Supports Unicode (non-ASCII characters) and non-string entities, such as objects with a `toString` property, numbers and booleans. Empty values (`null` and `undefined`) will result in an empty string. 12 | 13 | ## Installation 14 | 15 | ``` 16 | npm install no-case --save 17 | ``` 18 | 19 | ## Usage 20 | 21 | ```javascript 22 | var noCase = require('no-case') 23 | 24 | noCase(null) //=> "" 25 | noCase('string') //=> "string" 26 | noCase('dot.case') //=> "dot case" 27 | noCase('camelCase') //=> "camel case" 28 | noCase('Beyoncé Knowles') //=> "beyoncé knowles" 29 | 30 | noCase('A STRING', 'tr') //=> "a strıng" 31 | 32 | noCase('HELLO WORLD!', null, '_') //=> "hello_world" 33 | ``` 34 | 35 | ## Typings 36 | 37 | Includes a [TypeScript definition](no-case.d.ts). 38 | 39 | ## License 40 | 41 | MIT 42 | 43 | [npm-image]: https://img.shields.io/npm/v/no-case.svg?style=flat 44 | [npm-url]: https://npmjs.org/package/no-case 45 | [downloads-image]: https://img.shields.io/npm/dm/no-case.svg?style=flat 46 | [downloads-url]: https://npmjs.org/package/no-case 47 | [travis-image]: https://img.shields.io/travis/blakeembrey/no-case.svg?style=flat 48 | [travis-url]: https://travis-ci.org/blakeembrey/no-case 49 | [coveralls-image]: https://img.shields.io/coveralls/blakeembrey/no-case.svg?style=flat 50 | [coveralls-url]: https://coveralls.io/r/blakeembrey/no-case?branch=master 51 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/no-case/no-case.d.ts: -------------------------------------------------------------------------------- 1 | declare function noCase (value: string, locale?: string, replacement?: string): string; 2 | 3 | export = noCase; 4 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/no-case/no-case.js: -------------------------------------------------------------------------------- 1 | var lowerCase = require('lower-case') 2 | 3 | var NON_WORD_REGEXP = require('./vendor/non-word-regexp') 4 | var CAMEL_CASE_REGEXP = require('./vendor/camel-case-regexp') 5 | var CAMEL_CASE_UPPER_REGEXP = require('./vendor/camel-case-upper-regexp') 6 | 7 | /** 8 | * Sentence case a string. 9 | * 10 | * @param {string} str 11 | * @param {string} locale 12 | * @param {string} replacement 13 | * @return {string} 14 | */ 15 | module.exports = function (str, locale, replacement) { 16 | if (str == null) { 17 | return '' 18 | } 19 | 20 | replacement = typeof replacement !== 'string' ? ' ' : replacement 21 | 22 | function replace (match, index, value) { 23 | if (index === 0 || index === (value.length - match.length)) { 24 | return '' 25 | } 26 | 27 | return replacement 28 | } 29 | 30 | str = String(str) 31 | // Support camel case ("camelCase" -> "camel Case"). 32 | .replace(CAMEL_CASE_REGEXP, '$1 $2') 33 | // Support odd camel case ("CAMELCase" -> "CAMEL Case"). 34 | .replace(CAMEL_CASE_UPPER_REGEXP, '$1 $2') 35 | // Remove all non-word characters and replace with a single space. 36 | .replace(NON_WORD_REGEXP, replace) 37 | 38 | // Lower case the entire string. 39 | return lowerCase(str, locale) 40 | } 41 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/no-case/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "no-case@^2.2.0", 3 | "_id": "no-case@2.3.2", 4 | "_inBundle": false, 5 | "_integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", 6 | "_location": "/no-case", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "no-case@^2.2.0", 12 | "name": "no-case", 13 | "escapedName": "no-case", 14 | "rawSpec": "^2.2.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^2.2.0" 17 | }, 18 | "_requiredBy": [ 19 | "/camel-case", 20 | "/param-case" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", 23 | "_shasum": "60b813396be39b3f1288a4c1ed5d1e7d28b464ac", 24 | "_spec": "no-case@^2.2.0", 25 | "_where": "/Users/danbartlett/Dev/AWS/SAM/aws-serverless-cms/dependencies/nodejs/node_modules/camel-case", 26 | "author": { 27 | "name": "Blake Embrey", 28 | "email": "hello@blakeembrey.com", 29 | "url": "http://blakeembrey.me" 30 | }, 31 | "bugs": { 32 | "url": "https://github.com/blakeembrey/no-case/issues" 33 | }, 34 | "bundleDependencies": false, 35 | "dependencies": { 36 | "lower-case": "^1.1.1" 37 | }, 38 | "deprecated": false, 39 | "description": "Remove case from a string", 40 | "devDependencies": { 41 | "chai": "^4.0.2", 42 | "istanbul": "^0.4.3", 43 | "jsesc": "^2.2.0", 44 | "mocha": "^3.0.0", 45 | "standard": "^10.0.2", 46 | "xregexp": "^3.1.1" 47 | }, 48 | "files": [ 49 | "no-case.js", 50 | "no-case.d.ts", 51 | "vendor", 52 | "LICENSE" 53 | ], 54 | "homepage": "https://github.com/blakeembrey/no-case", 55 | "keywords": [ 56 | "no", 57 | "case", 58 | "space", 59 | "lower", 60 | "trim" 61 | ], 62 | "license": "MIT", 63 | "main": "no-case.js", 64 | "name": "no-case", 65 | "repository": { 66 | "type": "git", 67 | "url": "git://github.com/blakeembrey/no-case.git" 68 | }, 69 | "scripts": { 70 | "build": "node build.js", 71 | "lint": "standard", 72 | "test": "npm run lint && npm run test-cov", 73 | "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- -R spec --bail" 74 | }, 75 | "standard": { 76 | "ignore": [ 77 | "coverage/**" 78 | ] 79 | }, 80 | "typings": "no-case.d.ts", 81 | "version": "2.3.2" 82 | } 83 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/param-case/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/param-case/README.md: -------------------------------------------------------------------------------- 1 | # Param Case 2 | 3 | [![NPM version][npm-image]][npm-url] 4 | [![NPM downloads][downloads-image]][downloads-url] 5 | [![Build status][travis-image]][travis-url] 6 | [![Test coverage][coveralls-image]][coveralls-url] 7 | 8 | Param case a string. 9 | 10 | Supports Unicode (non-ASCII characters) and non-string entities, such as objects with a `toString` property, numbers and booleans. Empty values (`null` and `undefined`) will result in an empty string. 11 | 12 | ## Installation 13 | 14 | ``` 15 | npm install param-case --save 16 | ``` 17 | 18 | ## Usage 19 | 20 | ```javascript 21 | var paramCase = require('param-case') 22 | 23 | paramCase('string') //=> "string" 24 | paramCase('camelCase') //=> "camel-case" 25 | paramCase('sentence case') //=> "sentence-case" 26 | 27 | paramCase('MY STRING', 'tr') //=> "my-strıng" 28 | ``` 29 | 30 | ## Typings 31 | 32 | Includes a [TypeScript definition](param-case.d.ts). 33 | 34 | ## License 35 | 36 | MIT 37 | 38 | [npm-image]: https://img.shields.io/npm/v/param-case.svg?style=flat 39 | [npm-url]: https://npmjs.org/package/param-case 40 | [downloads-image]: https://img.shields.io/npm/dm/param-case.svg?style=flat 41 | [downloads-url]: https://npmjs.org/package/param-case 42 | [travis-image]: https://img.shields.io/travis/blakeembrey/param-case.svg?style=flat 43 | [travis-url]: https://travis-ci.org/blakeembrey/param-case 44 | [coveralls-image]: https://img.shields.io/coveralls/blakeembrey/param-case.svg?style=flat 45 | [coveralls-url]: https://coveralls.io/r/blakeembrey/param-case?branch=master 46 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/param-case/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "param-case@^2.1.1", 3 | "_id": "param-case@2.1.1", 4 | "_inBundle": false, 5 | "_integrity": "sha1-35T9jPZTHs915r75oIWPvHK+Ikc=", 6 | "_location": "/param-case", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "param-case@^2.1.1", 12 | "name": "param-case", 13 | "escapedName": "param-case", 14 | "rawSpec": "^2.1.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^2.1.1" 17 | }, 18 | "_requiredBy": [ 19 | "/html-minifier" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz", 22 | "_shasum": "df94fd8cf6531ecf75e6bef9a0858fbc72be2247", 23 | "_spec": "param-case@^2.1.1", 24 | "_where": "/Users/danbartlett/Dev/AWS/SAM/aws-serverless-cms/dependencies/nodejs/node_modules/html-minifier", 25 | "author": { 26 | "name": "Blake Embrey", 27 | "email": "hello@blakeembrey.com", 28 | "url": "http://blakeembrey.me" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/blakeembrey/param-case/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": { 35 | "no-case": "^2.2.0" 36 | }, 37 | "deprecated": false, 38 | "description": "Param case a string", 39 | "devDependencies": { 40 | "istanbul": "^0.4.3", 41 | "mocha": "^3.2.0", 42 | "standard": "^9.0.1" 43 | }, 44 | "files": [ 45 | "param-case.js", 46 | "param-case.d.ts", 47 | "LICENSE" 48 | ], 49 | "homepage": "https://github.com/blakeembrey/param-case", 50 | "keywords": [ 51 | "param", 52 | "case", 53 | "dash", 54 | "hyphen" 55 | ], 56 | "license": "MIT", 57 | "main": "param-case.js", 58 | "name": "param-case", 59 | "repository": { 60 | "type": "git", 61 | "url": "git://github.com/blakeembrey/param-case.git" 62 | }, 63 | "scripts": { 64 | "lint": "standard", 65 | "test": "npm run lint && npm run test-cov", 66 | "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- -R spec --bail", 67 | "test-std": "mocha -- -R spec --bail" 68 | }, 69 | "typings": "param-case.d.ts", 70 | "version": "2.1.1" 71 | } 72 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/param-case/param-case.d.ts: -------------------------------------------------------------------------------- 1 | declare function paramCase (value: string, locale?: string): string; 2 | 3 | export = paramCase; 4 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/param-case/param-case.js: -------------------------------------------------------------------------------- 1 | var noCase = require('no-case') 2 | 3 | /** 4 | * Param case a string. 5 | * 6 | * @param {string} value 7 | * @param {string} [locale] 8 | * @return {string} 9 | */ 10 | module.exports = function (value, locale) { 11 | return noCase(value, locale, '-') 12 | } 13 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/constants.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = 4 | { 5 | // Output 6 | ABSOLUTE: "absolute", 7 | PATH_RELATIVE: "pathRelative", 8 | ROOT_RELATIVE: "rootRelative", 9 | SHORTEST: "shortest" 10 | }; 11 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var constants = require("./constants"); 4 | var formatUrl = require("./format"); 5 | var getOptions = require("./options"); 6 | var objUtils = require("./util/object"); 7 | var parseUrl = require("./parse"); 8 | var relateUrl = require("./relate"); 9 | 10 | 11 | 12 | function RelateUrl(from, options) 13 | { 14 | this.options = getOptions(options, 15 | { 16 | defaultPorts: {ftp:21, http:80, https:443}, 17 | directoryIndexes: ["index.html"], 18 | ignore_www: false, 19 | output: RelateUrl.SHORTEST, 20 | rejectedSchemes: ["data","javascript","mailto"], 21 | removeAuth: false, 22 | removeDirectoryIndexes: true, 23 | removeEmptyQueries: false, 24 | removeRootTrailingSlash: true, 25 | schemeRelative: true, 26 | site: undefined, 27 | slashesDenoteHost: true 28 | }); 29 | 30 | this.from = parseUrl.from(from, this.options, null); 31 | } 32 | 33 | 34 | 35 | /* 36 | Usage: instance=new RelateUrl(); instance.relate(); 37 | */ 38 | RelateUrl.prototype.relate = function(from, to, options) 39 | { 40 | // relate(to,options) 41 | if ( objUtils.isPlainObject(to) ) 42 | { 43 | options = to; 44 | to = from; 45 | from = null; 46 | } 47 | // relate(to) 48 | else if (!to) 49 | { 50 | to = from; 51 | from = null; 52 | } 53 | 54 | options = getOptions(options, this.options); 55 | from = from || options.site; 56 | from = parseUrl.from(from, options, this.from); 57 | 58 | if (!from || !from.href) 59 | { 60 | throw new Error("from value not defined."); 61 | } 62 | else if (from.extra.hrefInfo.minimumPathOnly) 63 | { 64 | throw new Error("from value supplied is not absolute: "+from.href); 65 | } 66 | 67 | to = parseUrl.to(to, options); 68 | 69 | if (to.valid===false) return to.href; 70 | 71 | to = relateUrl(from, to, options); 72 | to = formatUrl(to, options); 73 | 74 | return to; 75 | } 76 | 77 | 78 | 79 | /* 80 | Usage: RelateUrl.relate(); 81 | */ 82 | RelateUrl.relate = function(from, to, options) 83 | { 84 | return new RelateUrl().relate(from, to, options); 85 | } 86 | 87 | 88 | 89 | // Make constants accessible from API 90 | objUtils.shallowMerge(RelateUrl, constants); 91 | 92 | 93 | 94 | module.exports = RelateUrl; 95 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/options.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var objUtils = require("./util/object"); 4 | 5 | 6 | 7 | function getOptions(options, defaults) 8 | { 9 | if ( objUtils.isPlainObject(options) ) 10 | { 11 | var newOptions = {}; 12 | 13 | for (var i in defaults) 14 | { 15 | if ( defaults.hasOwnProperty(i) ) 16 | { 17 | if (options[i] !== undefined) 18 | { 19 | newOptions[i] = mergeOption(options[i], defaults[i]); 20 | } 21 | else 22 | { 23 | newOptions[i] = defaults[i]; 24 | } 25 | } 26 | } 27 | 28 | return newOptions; 29 | } 30 | else 31 | { 32 | return defaults; 33 | } 34 | } 35 | 36 | 37 | 38 | function mergeOption(newValues, defaultValues) 39 | { 40 | if (defaultValues instanceof Object && newValues instanceof Object) 41 | { 42 | if (defaultValues instanceof Array && newValues instanceof Array) 43 | { 44 | return defaultValues.concat(newValues); 45 | } 46 | else 47 | { 48 | return objUtils.shallowMerge(newValues, defaultValues); 49 | } 50 | } 51 | 52 | return newValues; 53 | } 54 | 55 | 56 | 57 | module.exports = getOptions; 58 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/parse/host.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function parseHost(urlObj, options) 4 | { 5 | // TWEAK :: condition only for speed optimization 6 | if (options.ignore_www) 7 | { 8 | var host = urlObj.host.full; 9 | 10 | if (host) 11 | { 12 | var stripped = host; 13 | 14 | if (host.indexOf("www.") === 0) 15 | { 16 | stripped = host.substr(4); 17 | } 18 | 19 | urlObj.host.stripped = stripped; 20 | } 21 | } 22 | } 23 | 24 | 25 | 26 | module.exports = parseHost; 27 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/parse/hrefInfo.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function hrefInfo(urlObj) 4 | { 5 | var minimumPathOnly = (!urlObj.scheme && !urlObj.auth && !urlObj.host.full && !urlObj.port); 6 | var minimumResourceOnly = (minimumPathOnly && !urlObj.path.absolute.string); 7 | var minimumQueryOnly = (minimumResourceOnly && !urlObj.resource); 8 | var minimumHashOnly = (minimumQueryOnly && !urlObj.query.string.full.length); 9 | var empty = (minimumHashOnly && !urlObj.hash); 10 | 11 | urlObj.extra.hrefInfo.minimumPathOnly = minimumPathOnly; 12 | urlObj.extra.hrefInfo.minimumResourceOnly = minimumResourceOnly; 13 | urlObj.extra.hrefInfo.minimumQueryOnly = minimumQueryOnly; 14 | urlObj.extra.hrefInfo.minimumHashOnly = minimumHashOnly; 15 | urlObj.extra.hrefInfo.empty = empty; 16 | } 17 | 18 | 19 | 20 | module.exports = hrefInfo; 21 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/parse/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var hrefInfo = require("./hrefInfo"); 4 | var parseHost = require("./host"); 5 | var parsePath = require("./path"); 6 | var parsePort = require("./port"); 7 | var parseQuery = require("./query"); 8 | var parseUrlString = require("./urlstring"); 9 | var pathUtils = require("../util/path"); 10 | 11 | 12 | 13 | function parseFromUrl(url, options, fallback) 14 | { 15 | if (url) 16 | { 17 | var urlObj = parseUrl(url, options); 18 | 19 | // Because the following occurs in the relate stage for "to" URLs, 20 | // such had to be mostly duplicated here 21 | 22 | var pathArray = pathUtils.resolveDotSegments(urlObj.path.absolute.array); 23 | 24 | urlObj.path.absolute.array = pathArray; 25 | urlObj.path.absolute.string = "/" + pathUtils.join(pathArray); 26 | 27 | return urlObj; 28 | } 29 | else 30 | { 31 | return fallback; 32 | } 33 | } 34 | 35 | 36 | 37 | function parseUrl(url, options) 38 | { 39 | var urlObj = parseUrlString(url, options); 40 | 41 | if (urlObj.valid===false) return urlObj; 42 | 43 | parseHost(urlObj, options); 44 | parsePort(urlObj, options); 45 | parsePath(urlObj, options); 46 | parseQuery(urlObj, options); 47 | hrefInfo(urlObj); 48 | 49 | return urlObj; 50 | } 51 | 52 | 53 | 54 | module.exports = 55 | { 56 | from: parseFromUrl, 57 | to: parseUrl 58 | }; 59 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/parse/path.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function isDirectoryIndex(resource, options) 4 | { 5 | var verdict = false; 6 | 7 | options.directoryIndexes.every( function(index) 8 | { 9 | if (index === resource) 10 | { 11 | verdict = true; 12 | return false; 13 | } 14 | 15 | return true; 16 | }); 17 | 18 | return verdict; 19 | } 20 | 21 | 22 | 23 | function parsePath(urlObj, options) 24 | { 25 | var path = urlObj.path.absolute.string; 26 | 27 | if (path) 28 | { 29 | var lastSlash = path.lastIndexOf("/"); 30 | 31 | if (lastSlash > -1) 32 | { 33 | if (++lastSlash < path.length) 34 | { 35 | var resource = path.substr(lastSlash); 36 | 37 | if (resource!=="." && resource!=="..") 38 | { 39 | urlObj.resource = resource; 40 | path = path.substr(0, lastSlash); 41 | } 42 | else 43 | { 44 | path += "/"; 45 | } 46 | } 47 | 48 | urlObj.path.absolute.string = path; 49 | urlObj.path.absolute.array = splitPath(path); 50 | } 51 | else if (path==="." || path==="..") 52 | { 53 | // "..?var", "..#anchor", etc ... not "..index.html" 54 | path += "/"; 55 | 56 | urlObj.path.absolute.string = path; 57 | urlObj.path.absolute.array = splitPath(path); 58 | } 59 | else 60 | { 61 | // Resource-only 62 | urlObj.resource = path; 63 | urlObj.path.absolute.string = null; 64 | } 65 | 66 | urlObj.extra.resourceIsIndex = isDirectoryIndex(urlObj.resource, options); 67 | } 68 | // Else: query/hash-only or empty 69 | } 70 | 71 | 72 | 73 | function splitPath(path) 74 | { 75 | // TWEAK :: condition only for speed optimization 76 | if (path !== "/") 77 | { 78 | var cleaned = []; 79 | 80 | path.split("/").forEach( function(dir) 81 | { 82 | // Cleanup -- splitting "/dir/" becomes ["","dir",""] 83 | if (dir !== "") 84 | { 85 | cleaned.push(dir); 86 | } 87 | }); 88 | 89 | return cleaned; 90 | } 91 | else 92 | { 93 | // Faster to skip the above block and just create an array 94 | return []; 95 | } 96 | } 97 | 98 | 99 | 100 | module.exports = parsePath; 101 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/parse/port.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function parsePort(urlObj, options) 4 | { 5 | var defaultPort = -1; 6 | 7 | for (var i in options.defaultPorts) 8 | { 9 | if ( i===urlObj.scheme && options.defaultPorts.hasOwnProperty(i) ) 10 | { 11 | defaultPort = options.defaultPorts[i]; 12 | break; 13 | } 14 | } 15 | 16 | if (defaultPort > -1) 17 | { 18 | // Force same type as urlObj.port 19 | defaultPort = defaultPort.toString(); 20 | 21 | if (urlObj.port === null) 22 | { 23 | urlObj.port = defaultPort; 24 | } 25 | 26 | urlObj.extra.portIsDefault = (urlObj.port === defaultPort); 27 | } 28 | } 29 | 30 | 31 | 32 | module.exports = parsePort; 33 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/parse/query.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var hasOwnProperty = Object.prototype.hasOwnProperty; 3 | 4 | 5 | 6 | function parseQuery(urlObj, options) 7 | { 8 | urlObj.query.string.full = stringify(urlObj.query.object, false); 9 | 10 | // TWEAK :: condition only for speed optimization 11 | if (options.removeEmptyQueries) 12 | { 13 | urlObj.query.string.stripped = stringify(urlObj.query.object, true); 14 | } 15 | } 16 | 17 | 18 | 19 | function stringify(queryObj, removeEmptyQueries) 20 | { 21 | var count = 0; 22 | var str = ""; 23 | 24 | for (var i in queryObj) 25 | { 26 | if ( i!=="" && hasOwnProperty.call(queryObj, i)===true ) 27 | { 28 | var value = queryObj[i]; 29 | 30 | if (value !== "" || !removeEmptyQueries) 31 | { 32 | str += (++count===1) ? "?" : "&"; 33 | 34 | i = encodeURIComponent(i); 35 | 36 | if (value !== "") 37 | { 38 | str += i +"="+ encodeURIComponent(value).replace(/%20/g,"+"); 39 | } 40 | else 41 | { 42 | str += i; 43 | } 44 | } 45 | } 46 | } 47 | 48 | return str; 49 | } 50 | 51 | 52 | 53 | module.exports = parseQuery; 54 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/parse/urlstring.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _parseUrl = require("url").parse; 4 | 5 | 6 | 7 | /* 8 | Customize the URL object that Node generates 9 | because: 10 | 11 | * necessary data for later 12 | * urlObj.host is useless 13 | * urlObj.hostname is too long 14 | * urlObj.path is useless 15 | * urlObj.pathname is too long 16 | * urlObj.protocol is inaccurate; should be called "scheme" 17 | * urlObj.search is mostly useless 18 | */ 19 | function clean(urlObj) 20 | { 21 | var scheme = urlObj.protocol; 22 | 23 | if (scheme) 24 | { 25 | // Remove ":" suffix 26 | if (scheme.indexOf(":") === scheme.length-1) 27 | { 28 | scheme = scheme.substr(0, scheme.length-1); 29 | } 30 | } 31 | 32 | urlObj.host = 33 | { 34 | // TODO :: unescape(encodeURIComponent(s)) ? ... http://ecmanaut.blogspot.ca/2006/07/encoding-decoding-utf8-in-javascript.html 35 | full: urlObj.hostname, 36 | stripped: null 37 | }; 38 | 39 | urlObj.path = 40 | { 41 | absolute: 42 | { 43 | array: null, 44 | string: urlObj.pathname 45 | }, 46 | relative: 47 | { 48 | array: null, 49 | string: null 50 | } 51 | }; 52 | 53 | urlObj.query = 54 | { 55 | object: urlObj.query, 56 | string: 57 | { 58 | full: null, 59 | stripped: null 60 | } 61 | }; 62 | 63 | urlObj.extra = 64 | { 65 | hrefInfo: 66 | { 67 | minimumPathOnly: null, 68 | minimumResourceOnly: null, 69 | minimumQueryOnly: null, 70 | minimumHashOnly: null, 71 | empty: null, 72 | 73 | separatorOnlyQuery: urlObj.search==="?" 74 | }, 75 | portIsDefault: null, 76 | relation: 77 | { 78 | maximumScheme: null, 79 | maximumAuth: null, 80 | maximumHost: null, 81 | maximumPort: null, 82 | maximumPath: null, 83 | maximumResource: null, 84 | maximumQuery: null, 85 | maximumHash: null, 86 | 87 | minimumScheme: null, 88 | minimumAuth: null, 89 | minimumHost: null, 90 | minimumPort: null, 91 | minimumPath: null, 92 | minimumResource: null, 93 | minimumQuery: null, 94 | minimumHash: null, 95 | 96 | overridesQuery: null 97 | }, 98 | resourceIsIndex: null, 99 | slashes: urlObj.slashes 100 | }; 101 | 102 | urlObj.resource = null; 103 | urlObj.scheme = scheme; 104 | delete urlObj.hostname; 105 | delete urlObj.pathname; 106 | delete urlObj.protocol; 107 | delete urlObj.search; 108 | delete urlObj.slashes; 109 | 110 | return urlObj; 111 | } 112 | 113 | 114 | 115 | function validScheme(url, options) 116 | { 117 | var valid = true; 118 | 119 | options.rejectedSchemes.every( function(rejectedScheme) 120 | { 121 | valid = !(url.indexOf(rejectedScheme+":") === 0); 122 | 123 | // Break loop 124 | return valid; 125 | }); 126 | 127 | return valid; 128 | } 129 | 130 | 131 | 132 | function parseUrlString(url, options) 133 | { 134 | if ( validScheme(url,options) ) 135 | { 136 | return clean( _parseUrl(url, true, options.slashesDenoteHost) ); 137 | } 138 | else 139 | { 140 | return {href:url, valid:false}; 141 | } 142 | } 143 | 144 | 145 | 146 | module.exports = parseUrlString; 147 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/relate/absolutize.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var findRelation = require("./findRelation"); 4 | var objUtils = require("../util/object"); 5 | var pathUtils = require("../util/path"); 6 | 7 | 8 | 9 | function absolutize(urlObj, siteUrlObj, options) 10 | { 11 | findRelation.upToPath(urlObj, siteUrlObj, options); 12 | 13 | // Fill in relative URLs 14 | if (urlObj.extra.relation.minimumScheme) urlObj.scheme = siteUrlObj.scheme; 15 | if (urlObj.extra.relation.minimumAuth) urlObj.auth = siteUrlObj.auth; 16 | if (urlObj.extra.relation.minimumHost) urlObj.host = objUtils.clone(siteUrlObj.host); 17 | if (urlObj.extra.relation.minimumPort) copyPort(urlObj, siteUrlObj); 18 | if (urlObj.extra.relation.minimumScheme) copyPath(urlObj, siteUrlObj); 19 | 20 | // Check remaining relativeness now that path has been copied and/or resolved 21 | findRelation.pathOn(urlObj, siteUrlObj, options); 22 | 23 | // Fill in relative URLs 24 | if (urlObj.extra.relation.minimumResource) copyResource(urlObj, siteUrlObj); 25 | if (urlObj.extra.relation.minimumQuery) urlObj.query = objUtils.clone(siteUrlObj.query); 26 | if (urlObj.extra.relation.minimumHash) urlObj.hash = siteUrlObj.hash; 27 | } 28 | 29 | 30 | 31 | /* 32 | Get an absolute path that's relative to site url. 33 | */ 34 | function copyPath(urlObj, siteUrlObj) 35 | { 36 | if (urlObj.extra.relation.maximumHost || !urlObj.extra.hrefInfo.minimumResourceOnly) 37 | { 38 | var pathArray = urlObj.path.absolute.array; 39 | var pathString = "/"; 40 | 41 | // If not erroneous URL 42 | if (pathArray) 43 | { 44 | // If is relative path 45 | if (urlObj.extra.hrefInfo.minimumPathOnly && urlObj.path.absolute.string.indexOf("/")!==0) 46 | { 47 | // Append path to site path 48 | pathArray = siteUrlObj.path.absolute.array.concat(pathArray); 49 | } 50 | 51 | pathArray = pathUtils.resolveDotSegments(pathArray); 52 | pathString += pathUtils.join(pathArray); 53 | } 54 | else 55 | { 56 | pathArray = []; 57 | } 58 | 59 | urlObj.path.absolute.array = pathArray; 60 | urlObj.path.absolute.string = pathString; 61 | } 62 | else 63 | { 64 | // Resource-, query- or hash-only or empty 65 | urlObj.path = objUtils.clone(siteUrlObj.path); 66 | } 67 | } 68 | 69 | 70 | 71 | function copyPort(urlObj, siteUrlObj) 72 | { 73 | urlObj.port = siteUrlObj.port; 74 | 75 | urlObj.extra.portIsDefault = siteUrlObj.extra.portIsDefault; 76 | } 77 | 78 | 79 | 80 | function copyResource(urlObj, siteUrlObj) 81 | { 82 | urlObj.resource = siteUrlObj.resource; 83 | 84 | urlObj.extra.resourceIsIndex = siteUrlObj.extra.resourceIsIndex; 85 | } 86 | 87 | 88 | 89 | module.exports = absolutize; 90 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/relate/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var absolutize = require("./absolutize"); 4 | var relativize = require("./relativize"); 5 | 6 | 7 | 8 | function relateUrl(siteUrlObj, urlObj, options) 9 | { 10 | absolutize(urlObj, siteUrlObj, options); 11 | relativize(urlObj, siteUrlObj, options); 12 | 13 | return urlObj; 14 | } 15 | 16 | 17 | 18 | module.exports = relateUrl; 19 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/relate/relativize.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var pathUtils = require("../util/path"); 4 | 5 | 6 | 7 | /* 8 | Get a path relative to the site path. 9 | */ 10 | function relatePath(absolutePath, siteAbsolutePath) 11 | { 12 | var relativePath = []; 13 | 14 | // At this point, it's related to the host/port 15 | var related = true; 16 | var parentIndex = -1; 17 | 18 | // Find parents 19 | siteAbsolutePath.forEach( function(siteAbsoluteDir, i) 20 | { 21 | if (related) 22 | { 23 | if (absolutePath[i] !== siteAbsoluteDir) 24 | { 25 | related = false; 26 | } 27 | else 28 | { 29 | parentIndex = i; 30 | } 31 | } 32 | 33 | if (!related) 34 | { 35 | // Up one level 36 | relativePath.push(".."); 37 | } 38 | }); 39 | 40 | // Form path 41 | absolutePath.forEach( function(dir, i) 42 | { 43 | if (i > parentIndex) 44 | { 45 | relativePath.push(dir); 46 | } 47 | }); 48 | 49 | return relativePath; 50 | } 51 | 52 | 53 | 54 | function relativize(urlObj, siteUrlObj, options) 55 | { 56 | if (urlObj.extra.relation.minimumScheme) 57 | { 58 | var pathArray = relatePath(urlObj.path.absolute.array, siteUrlObj.path.absolute.array); 59 | 60 | urlObj.path.relative.array = pathArray; 61 | urlObj.path.relative.string = pathUtils.join(pathArray); 62 | } 63 | } 64 | 65 | 66 | 67 | module.exports = relativize; 68 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/util/devlog.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var inspect = require("util").inspect; 4 | 5 | 6 | 7 | function log(data) 8 | { 9 | console.log( inspect(data, {depth:null, colors:true}) ); 10 | } 11 | 12 | 13 | 14 | function logAll(data) 15 | { 16 | console.log( inspect(data, {depth:null, showHidden:true, colors:true}) ); 17 | } 18 | 19 | 20 | 21 | module.exports = 22 | { 23 | log: log, 24 | logAll: logAll 25 | }; 26 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/util/object.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /* 4 | Deep-clone an object. 5 | */ 6 | function clone(obj) 7 | { 8 | if (obj instanceof Object) 9 | { 10 | var clonedObj = (obj instanceof Array) ? [] : {}; 11 | 12 | for (var i in obj) 13 | { 14 | if ( obj.hasOwnProperty(i) ) 15 | { 16 | clonedObj[i] = clone( obj[i] ); 17 | } 18 | } 19 | 20 | return clonedObj; 21 | } 22 | 23 | return obj; 24 | } 25 | 26 | 27 | 28 | /* 29 | https://github.com/jonschlinkert/is-plain-object 30 | */ 31 | function isPlainObject(obj) 32 | { 33 | return !!obj && typeof obj==="object" && obj.constructor===Object; 34 | } 35 | 36 | 37 | 38 | /* 39 | Shallow-merge two objects. 40 | */ 41 | function shallowMerge(target, source) 42 | { 43 | if (target instanceof Object && source instanceof Object) 44 | { 45 | for (var i in source) 46 | { 47 | if ( source.hasOwnProperty(i) ) 48 | { 49 | target[i] = source[i]; 50 | } 51 | } 52 | } 53 | 54 | return target; 55 | } 56 | 57 | 58 | 59 | module.exports = 60 | { 61 | clone: clone, 62 | isPlainObject: isPlainObject, 63 | shallowMerge: shallowMerge 64 | }; 65 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/lib/util/path.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function joinPath(pathArray) 4 | { 5 | if (pathArray.length > 0) 6 | { 7 | return pathArray.join("/") + "/"; 8 | } 9 | else 10 | { 11 | return ""; 12 | } 13 | } 14 | 15 | 16 | 17 | function resolveDotSegments(pathArray) 18 | { 19 | var pathAbsolute = []; 20 | 21 | pathArray.forEach( function(dir) 22 | { 23 | if (dir !== "..") 24 | { 25 | if (dir !== ".") 26 | { 27 | pathAbsolute.push(dir); 28 | } 29 | } 30 | else 31 | { 32 | // Remove parent 33 | if (pathAbsolute.length > 0) 34 | { 35 | pathAbsolute.splice(pathAbsolute.length-1, 1); 36 | } 37 | } 38 | }); 39 | 40 | return pathAbsolute; 41 | } 42 | 43 | 44 | 45 | module.exports = 46 | { 47 | join: joinPath, 48 | resolveDotSegments: resolveDotSegments 49 | }; 50 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Steven Vachon (svachon.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/relateurl/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "relateurl@^0.2.7", 3 | "_id": "relateurl@0.2.7", 4 | "_inBundle": false, 5 | "_integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=", 6 | "_location": "/relateurl", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "relateurl@^0.2.7", 12 | "name": "relateurl", 13 | "escapedName": "relateurl", 14 | "rawSpec": "^0.2.7", 15 | "saveSpec": null, 16 | "fetchSpec": "^0.2.7" 17 | }, 18 | "_requiredBy": [ 19 | "/html-minifier" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", 22 | "_shasum": "54dbf377e51440aca90a4cd274600d3ff2d888a9", 23 | "_spec": "relateurl@^0.2.7", 24 | "_where": "/Users/danbartlett/Dev/AWS/SAM/aws-serverless-cms/dependencies/nodejs/node_modules/html-minifier", 25 | "author": { 26 | "name": "Steven Vachon", 27 | "email": "contact@svachon.com", 28 | "url": "http://www.svachon.com/" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/stevenvachon/relateurl/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "deprecated": false, 35 | "description": "Minify URLs by converting them from absolute to relative.", 36 | "devDependencies": { 37 | "browserify": "^13.0.1", 38 | "chai": "^3.5.0", 39 | "mocha": "^2.5.3", 40 | "uglify-js": "^2.7.0" 41 | }, 42 | "engines": { 43 | "node": ">= 0.10" 44 | }, 45 | "files": [ 46 | "lib", 47 | "license" 48 | ], 49 | "homepage": "https://github.com/stevenvachon/relateurl", 50 | "keywords": [ 51 | "uri", 52 | "url", 53 | "minifier", 54 | "minify", 55 | "lint", 56 | "relative", 57 | "absolute" 58 | ], 59 | "license": "MIT", 60 | "main": "lib", 61 | "name": "relateurl", 62 | "repository": { 63 | "type": "git", 64 | "url": "git://github.com/stevenvachon/relateurl.git" 65 | }, 66 | "scripts": { 67 | "browserify": "browserify lib/ --standalone RelateUrl | uglifyjs --compress --mangle -o relateurl-browser.js", 68 | "test": "mocha test/ --bail --reporter spec --check-leaks" 69 | }, 70 | "version": "0.2.7" 71 | } 72 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/source-map/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 2009-2011, Mozilla Foundation and contributors 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the names of the Mozilla Foundation nor the names of project 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/source-map/lib/base64.js: -------------------------------------------------------------------------------- 1 | /* -*- Mode: js; js-indent-level: 2; -*- */ 2 | /* 3 | * Copyright 2011 Mozilla Foundation and contributors 4 | * Licensed under the New BSD license. See LICENSE or: 5 | * http://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); 9 | 10 | /** 11 | * Encode an integer in the range of 0 to 63 to a single base 64 digit. 12 | */ 13 | exports.encode = function (number) { 14 | if (0 <= number && number < intToCharMap.length) { 15 | return intToCharMap[number]; 16 | } 17 | throw new TypeError("Must be between 0 and 63: " + number); 18 | }; 19 | 20 | /** 21 | * Decode a single base 64 character code digit to an integer. Returns -1 on 22 | * failure. 23 | */ 24 | exports.decode = function (charCode) { 25 | var bigA = 65; // 'A' 26 | var bigZ = 90; // 'Z' 27 | 28 | var littleA = 97; // 'a' 29 | var littleZ = 122; // 'z' 30 | 31 | var zero = 48; // '0' 32 | var nine = 57; // '9' 33 | 34 | var plus = 43; // '+' 35 | var slash = 47; // '/' 36 | 37 | var littleOffset = 26; 38 | var numberOffset = 52; 39 | 40 | // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ 41 | if (bigA <= charCode && charCode <= bigZ) { 42 | return (charCode - bigA); 43 | } 44 | 45 | // 26 - 51: abcdefghijklmnopqrstuvwxyz 46 | if (littleA <= charCode && charCode <= littleZ) { 47 | return (charCode - littleA + littleOffset); 48 | } 49 | 50 | // 52 - 61: 0123456789 51 | if (zero <= charCode && charCode <= nine) { 52 | return (charCode - zero + numberOffset); 53 | } 54 | 55 | // 62: + 56 | if (charCode == plus) { 57 | return 62; 58 | } 59 | 60 | // 63: / 61 | if (charCode == slash) { 62 | return 63; 63 | } 64 | 65 | // Invalid base64 digit. 66 | return -1; 67 | }; 68 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/source-map/lib/mapping-list.js: -------------------------------------------------------------------------------- 1 | /* -*- Mode: js; js-indent-level: 2; -*- */ 2 | /* 3 | * Copyright 2014 Mozilla Foundation and contributors 4 | * Licensed under the New BSD license. See LICENSE or: 5 | * http://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | var util = require('./util'); 9 | 10 | /** 11 | * Determine whether mappingB is after mappingA with respect to generated 12 | * position. 13 | */ 14 | function generatedPositionAfter(mappingA, mappingB) { 15 | // Optimized for most common case 16 | var lineA = mappingA.generatedLine; 17 | var lineB = mappingB.generatedLine; 18 | var columnA = mappingA.generatedColumn; 19 | var columnB = mappingB.generatedColumn; 20 | return lineB > lineA || lineB == lineA && columnB >= columnA || 21 | util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; 22 | } 23 | 24 | /** 25 | * A data structure to provide a sorted view of accumulated mappings in a 26 | * performance conscious manner. It trades a neglibable overhead in general 27 | * case for a large speedup in case of mappings being added in order. 28 | */ 29 | function MappingList() { 30 | this._array = []; 31 | this._sorted = true; 32 | // Serves as infimum 33 | this._last = {generatedLine: -1, generatedColumn: 0}; 34 | } 35 | 36 | /** 37 | * Iterate through internal items. This method takes the same arguments that 38 | * `Array.prototype.forEach` takes. 39 | * 40 | * NOTE: The order of the mappings is NOT guaranteed. 41 | */ 42 | MappingList.prototype.unsortedForEach = 43 | function MappingList_forEach(aCallback, aThisArg) { 44 | this._array.forEach(aCallback, aThisArg); 45 | }; 46 | 47 | /** 48 | * Add the given source mapping. 49 | * 50 | * @param Object aMapping 51 | */ 52 | MappingList.prototype.add = function MappingList_add(aMapping) { 53 | if (generatedPositionAfter(this._last, aMapping)) { 54 | this._last = aMapping; 55 | this._array.push(aMapping); 56 | } else { 57 | this._sorted = false; 58 | this._array.push(aMapping); 59 | } 60 | }; 61 | 62 | /** 63 | * Returns the flat, sorted array of mappings. The mappings are sorted by 64 | * generated position. 65 | * 66 | * WARNING: This method returns internal data without copying, for 67 | * performance. The return value must NOT be mutated, and should be treated as 68 | * an immutable borrow. If you want to take ownership, you must make your own 69 | * copy. 70 | */ 71 | MappingList.prototype.toArray = function MappingList_toArray() { 72 | if (!this._sorted) { 73 | this._array.sort(util.compareByGeneratedPositionsInflated); 74 | this._sorted = true; 75 | } 76 | return this._array; 77 | }; 78 | 79 | exports.MappingList = MappingList; 80 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/source-map/source-map.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011 Mozilla Foundation and contributors 3 | * Licensed under the New BSD license. See LICENSE.txt or: 4 | * http://opensource.org/licenses/BSD-3-Clause 5 | */ 6 | exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator; 7 | exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer; 8 | exports.SourceNode = require('./lib/source-node').SourceNode; 9 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/uglify-js/LICENSE: -------------------------------------------------------------------------------- 1 | UglifyJS is released under the BSD license: 2 | 3 | Copyright 2012-2019 (c) Mihai Bazon 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | * Redistributions of source code must retain the above 10 | copyright notice, this list of conditions and the following 11 | disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following 15 | disclaimer in the documentation and/or other materials 16 | provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY 19 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 23 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 25 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 27 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 28 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 | SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/uglify-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "uglify-js@^3.5.1", 3 | "_id": "uglify-js@3.9.2", 4 | "_inBundle": false, 5 | "_integrity": "sha512-zGVwKslUAD/EeqOrD1nQaBmXIHl1Vw371we8cvS8I6mYK9rmgX5tv8AAeJdfsQ3Kk5mGax2SVV/AizxdNGhl7Q==", 6 | "_location": "/uglify-js", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "uglify-js@^3.5.1", 12 | "name": "uglify-js", 13 | "escapedName": "uglify-js", 14 | "rawSpec": "^3.5.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^3.5.1" 17 | }, 18 | "_requiredBy": [ 19 | "/html-minifier" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.9.2.tgz", 22 | "_shasum": "012b74fb6a2e440d9ba1f79110a479d3b1f2d48d", 23 | "_spec": "uglify-js@^3.5.1", 24 | "_where": "/Users/danbartlett/Dev/AWS/SAM/aws-serverless-cms/dependencies/nodejs/node_modules/html-minifier", 25 | "author": { 26 | "name": "Mihai Bazon", 27 | "email": "mihai.bazon@gmail.com", 28 | "url": "http://lisperator.net/" 29 | }, 30 | "bin": { 31 | "uglifyjs": "bin/uglifyjs" 32 | }, 33 | "bugs": { 34 | "url": "https://github.com/mishoo/UglifyJS2/issues" 35 | }, 36 | "bundleDependencies": false, 37 | "dependencies": { 38 | "commander": "~2.20.3" 39 | }, 40 | "deprecated": false, 41 | "description": "JavaScript parser, mangler/compressor and beautifier toolkit", 42 | "devDependencies": { 43 | "acorn": "~7.1.0", 44 | "semver": "~6.3.0" 45 | }, 46 | "engines": { 47 | "node": ">=0.8.0" 48 | }, 49 | "files": [ 50 | "bin", 51 | "lib", 52 | "tools", 53 | "LICENSE" 54 | ], 55 | "homepage": "https://github.com/mishoo/UglifyJS2#readme", 56 | "keywords": [ 57 | "cli", 58 | "compress", 59 | "compressor", 60 | "ecma", 61 | "ecmascript", 62 | "es", 63 | "es5", 64 | "javascript", 65 | "js", 66 | "jsmin", 67 | "min", 68 | "minification", 69 | "minifier", 70 | "minify", 71 | "optimize", 72 | "optimizer", 73 | "pack", 74 | "packer", 75 | "parse", 76 | "parser", 77 | "uglifier", 78 | "uglify" 79 | ], 80 | "license": "BSD-2-Clause", 81 | "main": "tools/node.js", 82 | "maintainers": [ 83 | { 84 | "name": "Alex Lam", 85 | "email": "alexlamsl@gmail.com" 86 | }, 87 | { 88 | "name": "Mihai Bazon", 89 | "email": "mihai.bazon@gmail.com", 90 | "url": "http://lisperator.net/" 91 | } 92 | ], 93 | "name": "uglify-js", 94 | "repository": { 95 | "type": "git", 96 | "url": "git+https://github.com/mishoo/UglifyJS2.git" 97 | }, 98 | "scripts": { 99 | "test": "node test/compress.js && node test/mocha.js" 100 | }, 101 | "version": "3.9.2" 102 | } 103 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/uglify-js/tools/exit.js: -------------------------------------------------------------------------------- 1 | // workaround for tty output truncation upon process.exit() 2 | var exit = process.exit; 3 | process.exit = function() { 4 | var args = [].slice.call(arguments); 5 | process.once("uncaughtException", function() { 6 | (function callback() { 7 | if (process.stdout.bufferSize || process.stderr.bufferSize) { 8 | setTimeout(callback, 1); 9 | } else { 10 | exit.apply(process, args); 11 | } 12 | })(); 13 | }); 14 | throw exit; 15 | }; 16 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/uglify-js/tools/exports.js: -------------------------------------------------------------------------------- 1 | exports["Dictionary"] = Dictionary; 2 | exports["List"] = List; 3 | exports["minify"] = minify; 4 | exports["parse"] = parse; 5 | exports["push_uniq"] = push_uniq; 6 | exports["TreeTransformer"] = TreeTransformer; 7 | exports["TreeWalker"] = TreeWalker; 8 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/uglify-js/tools/node.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs"); 2 | 3 | exports.FILES = [ 4 | require.resolve("../lib/utils.js"), 5 | require.resolve("../lib/ast.js"), 6 | require.resolve("../lib/parse.js"), 7 | require.resolve("../lib/transform.js"), 8 | require.resolve("../lib/scope.js"), 9 | require.resolve("../lib/output.js"), 10 | require.resolve("../lib/compress.js"), 11 | require.resolve("../lib/sourcemap.js"), 12 | require.resolve("../lib/mozilla-ast.js"), 13 | require.resolve("../lib/propmangle.js"), 14 | require.resolve("../lib/minify.js"), 15 | require.resolve("./exports.js"), 16 | ]; 17 | 18 | new Function("exports", function() { 19 | var code = exports.FILES.map(function(file) { 20 | return fs.readFileSync(file, "utf8"); 21 | }); 22 | code.push("exports.describe_ast = " + describe_ast.toString()); 23 | return code.join("\n\n"); 24 | }())(exports); 25 | 26 | function describe_ast() { 27 | var out = OutputStream({ beautify: true }); 28 | function doitem(ctor) { 29 | out.print("AST_" + ctor.TYPE); 30 | var props = ctor.SELF_PROPS.filter(function(prop) { 31 | return !/^\$/.test(prop); 32 | }); 33 | if (props.length > 0) { 34 | out.space(); 35 | out.with_parens(function() { 36 | props.forEach(function(prop, i) { 37 | if (i) out.space(); 38 | out.print(prop); 39 | }); 40 | }); 41 | } 42 | if (ctor.documentation) { 43 | out.space(); 44 | out.print_string(ctor.documentation); 45 | } 46 | if (ctor.SUBCLASSES.length > 0) { 47 | out.space(); 48 | out.with_block(function() { 49 | ctor.SUBCLASSES.sort(function(a, b) { 50 | return a.TYPE < b.TYPE ? -1 : 1; 51 | }).forEach(function(ctor, i) { 52 | out.indent(); 53 | doitem(ctor); 54 | out.newline(); 55 | }); 56 | }); 57 | } 58 | }; 59 | doitem(AST_Node); 60 | return out + "\n"; 61 | } 62 | 63 | function infer_options(options) { 64 | var result = exports.minify("", options); 65 | return result.error && result.error.defs; 66 | } 67 | 68 | exports.default_options = function() { 69 | var defs = infer_options({ 0: 0 }); 70 | Object.keys(defs).forEach(function(component) { 71 | var options = {}; 72 | options[component] = { 0: 0 }; 73 | if (options = infer_options(options)) { 74 | defs[component] = options; 75 | } 76 | }); 77 | return defs; 78 | }; 79 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/upper-case/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/upper-case/README.md: -------------------------------------------------------------------------------- 1 | # Upper Case 2 | 3 | [![NPM version][npm-image]][npm-url] 4 | [![NPM downloads][downloads-image]][downloads-url] 5 | [![Build status][travis-image]][travis-url] 6 | [![Test coverage][coveralls-image]][coveralls-url] 7 | 8 | Upper case a string. 9 | 10 | Supports Unicode (non-ASCII characters) and non-string entities, such as objects with a `toString` property, numbers and booleans. Empty values (`null` and `undefined`) will result in an empty string. 11 | 12 | ## Installation 13 | 14 | ``` 15 | npm install upper-case --save 16 | ``` 17 | 18 | ## Usage 19 | 20 | ```js 21 | var upperCase = require('upper-case') 22 | 23 | upperCase(null) //=> "" 24 | upperCase('string') //=> "STRING" 25 | upperCase('string', 'tr') //=> "STRİNG" 26 | 27 | upperCase({ toString: function () { return 'test' } }) //=> "TEST" 28 | ``` 29 | 30 | ## Typings 31 | 32 | Includes a [TypeScript definition](upper-case.d.ts). 33 | 34 | ## License 35 | 36 | MIT 37 | 38 | [npm-image]: https://img.shields.io/npm/v/upper-case.svg?style=flat 39 | [npm-url]: https://npmjs.org/package/upper-case 40 | [downloads-image]: https://img.shields.io/npm/dm/upper-case.svg?style=flat 41 | [downloads-url]: https://npmjs.org/package/upper-case 42 | [travis-image]: https://img.shields.io/travis/blakeembrey/upper-case.svg?style=flat 43 | [travis-url]: https://travis-ci.org/blakeembrey/upper-case 44 | [coveralls-image]: https://img.shields.io/coveralls/blakeembrey/upper-case.svg?style=flat 45 | [coveralls-url]: https://coveralls.io/r/blakeembrey/upper-case?branch=master 46 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/upper-case/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "upper-case@^1.1.1", 3 | "_id": "upper-case@1.1.3", 4 | "_inBundle": false, 5 | "_integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=", 6 | "_location": "/upper-case", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "upper-case@^1.1.1", 12 | "name": "upper-case", 13 | "escapedName": "upper-case", 14 | "rawSpec": "^1.1.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.1.1" 17 | }, 18 | "_requiredBy": [ 19 | "/camel-case" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", 22 | "_shasum": "f6b4501c2ec4cdd26ba78be7222961de77621598", 23 | "_spec": "upper-case@^1.1.1", 24 | "_where": "/Users/danbartlett/Dev/AWS/SAM/aws-serverless-cms/dependencies/nodejs/node_modules/camel-case", 25 | "author": { 26 | "name": "Blake Embrey", 27 | "email": "hello@blakeembrey.com", 28 | "url": "http://blakeembrey.me" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/blakeembrey/upper-case/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "deprecated": false, 35 | "description": "Upper case a string", 36 | "devDependencies": { 37 | "istanbul": "^0.3.5", 38 | "mocha": "^2.1.0", 39 | "pre-commit": "^1.0.2", 40 | "standard": "^2.4.5" 41 | }, 42 | "files": [ 43 | "upper-case.js", 44 | "upper-case.d.ts", 45 | "LICENSE" 46 | ], 47 | "homepage": "https://github.com/blakeembrey/upper-case", 48 | "keywords": [ 49 | "cases", 50 | "upper", 51 | "uppercase", 52 | "case" 53 | ], 54 | "license": "MIT", 55 | "main": "upper-case.js", 56 | "name": "upper-case", 57 | "repository": { 58 | "type": "git", 59 | "url": "git://github.com/blakeembrey/upper-case.git" 60 | }, 61 | "scripts": { 62 | "lint": "standard", 63 | "test": "npm run lint && npm run test-cov", 64 | "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- -R spec --bail", 65 | "test-std": "mocha -- -R spec --bail" 66 | }, 67 | "standard": { 68 | "ignore": [ 69 | "coverage/**", 70 | "node_modules/**", 71 | "bower_components/**" 72 | ] 73 | }, 74 | "typings": "upper-case.d.ts", 75 | "version": "1.1.3" 76 | } 77 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/upper-case/upper-case.d.ts: -------------------------------------------------------------------------------- 1 | declare function upperCase (value: string, locale?: string): string; 2 | 3 | export = upperCase; 4 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/node_modules/upper-case/upper-case.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Special language-specific overrides. 3 | * 4 | * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt 5 | * 6 | * @type {Object} 7 | */ 8 | var LANGUAGES = { 9 | tr: { 10 | regexp: /[\u0069]/g, 11 | map: { 12 | '\u0069': '\u0130' 13 | } 14 | }, 15 | az: { 16 | regexp: /[\u0069]/g, 17 | map: { 18 | '\u0069': '\u0130' 19 | } 20 | }, 21 | lt: { 22 | regexp: /[\u0069\u006A\u012F]\u0307|\u0069\u0307[\u0300\u0301\u0303]/g, 23 | map: { 24 | '\u0069\u0307': '\u0049', 25 | '\u006A\u0307': '\u004A', 26 | '\u012F\u0307': '\u012E', 27 | '\u0069\u0307\u0300': '\u00CC', 28 | '\u0069\u0307\u0301': '\u00CD', 29 | '\u0069\u0307\u0303': '\u0128' 30 | } 31 | } 32 | } 33 | 34 | /** 35 | * Upper case a string. 36 | * 37 | * @param {String} str 38 | * @return {String} 39 | */ 40 | module.exports = function (str, locale) { 41 | var lang = LANGUAGES[locale] 42 | 43 | str = str == null ? '' : String(str) 44 | 45 | if (lang) { 46 | str = str.replace(lang.regexp, function (m) { return lang.map[m] }) 47 | } 48 | 49 | return str.toUpperCase() 50 | } 51 | -------------------------------------------------------------------------------- /sam-backend/dependencies/nodejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "html-minifier": "^4.0.0" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /sam-backend/enhance-product-page/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "enhance-product-page", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /sam-backend/get-dynamodb-object/index.js: -------------------------------------------------------------------------------- 1 | const AWS = require('aws-sdk'); 2 | AWS.config.update({ region: process.env.REGION }); 3 | const docClient = new AWS.DynamoDB.DocumentClient({apiVersion: '2012-08-10'}); 4 | 5 | 6 | exports.handler = function (event, response, callback) { 7 | 8 | console.log("event is ", event); 9 | 10 | let eid = event.queryStringParameters.eid; 11 | 12 | let items = []; 13 | 14 | let qParams = { 15 | TableName: process.env.TABLE_NAME, 16 | FilterExpression: "#eid = :eid", 17 | ExpressionAttributeNames: { 18 | "#eid": "eid" 19 | }, 20 | ExpressionAttributeValues: { 21 | ":eid": eid 22 | } 23 | 24 | }; 25 | 26 | docClient.scan(qParams, onScan); 27 | 28 | // SET UP TO SCAN RECURSIVELY 29 | function onScan(err, data) { 30 | 31 | if (err) { 32 | console.error("Unable to scan the table. Error JSON:", JSON.stringify(err, null, 2)); 33 | } else { 34 | 35 | //console.error("data is :", data); 36 | console.log("data.Items.length is... ", data.Items.length); 37 | 38 | for (let i = 0; i < data.Items.length; i++) { 39 | items.push(data.Items[i]); 40 | } 41 | 42 | // continue scanning if we have more movies 43 | if (typeof data.LastEvaluatedKey != "undefined") { 44 | console.log("Scanning for more..."); 45 | qParams.ExclusiveStartKey = data.LastEvaluatedKey; 46 | docClient.scan(qParams, onScan); 47 | } else { 48 | 49 | callback(null, { 50 | statusCode: 200, 51 | headers: { 52 | "Access-Control-Allow-Origin": "*" 53 | }, 54 | body: JSON.stringify(items) 55 | }); 56 | 57 | } 58 | } 59 | } 60 | 61 | 62 | }; -------------------------------------------------------------------------------- /sam-backend/get-dynamodb-object/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "get-dynamodb-object", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /sam-backend/get-dynamodb-objects/index.js: -------------------------------------------------------------------------------- 1 | const AWS = require('aws-sdk'); 2 | AWS.config.update({ region: process.env.REGION }); 3 | const docClient = new AWS.DynamoDB.DocumentClient({apiVersion: '2012-08-10'}); 4 | 5 | exports.handler = function (event, response, callback) { 6 | 7 | console.log("event is ", event); 8 | 9 | let ctype = event.queryStringParameters.ctype; 10 | 11 | let items = []; 12 | 13 | let qParams = { 14 | TableName: process.env.TABLE_NAME, 15 | FilterExpression: "#ctype = :CTYPE", 16 | ExpressionAttributeNames: { 17 | "#ctype": "ctype" 18 | }, 19 | ExpressionAttributeValues: { 20 | ":CTYPE": ctype 21 | } 22 | 23 | }; 24 | 25 | docClient.scan(qParams, onScan); 26 | 27 | // SET UP TO SCAN RECURSIVELY 28 | function onScan(err, data) { 29 | 30 | if (err) { 31 | console.error("Unable to scan the table. Error JSON:", JSON.stringify(err, null, 2)); 32 | } else { 33 | 34 | //console.error("data is :", data); 35 | console.log("data.Items.length is... ", data.Items.length); 36 | 37 | for (let i = 0; i < data.Items.length; i++) { 38 | items.push(data.Items[i]); 39 | } 40 | 41 | // continue scanning if we have more movies 42 | if (typeof data.LastEvaluatedKey != "undefined") { 43 | console.log("Scanning for more..."); 44 | qParams.ExclusiveStartKey = data.LastEvaluatedKey; 45 | docClient.scan(qParams, onScan); 46 | } else { 47 | 48 | callback(null, { 49 | statusCode: 200, 50 | headers: { 51 | "Access-Control-Allow-Origin": "*" 52 | }, 53 | body: JSON.stringify(items) 54 | }); 55 | 56 | } 57 | } 58 | } 59 | 60 | 61 | }; -------------------------------------------------------------------------------- /sam-backend/get-dynamodb-objects/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "get-dynamodb-objects", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /sam-backend/invalidate-cloudfront-cache/index.js: -------------------------------------------------------------------------------- 1 | const AWS = require('aws-sdk'); 2 | const cloudfront = new AWS.CloudFront({apiVersion: '2019-03-26'}); 3 | 4 | 5 | exports.handler = function (event, context, callback) { 6 | 7 | let srcKey = "/" + event.Records[0].s3.object.key; 8 | 9 | console.log("srcKey is ", srcKey); 10 | 11 | let nowStamp = Date.now().toString(); 12 | 13 | let params = { 14 | DistributionId: process.env.DISTRIBUTION_ID, 15 | InvalidationBatch: { 16 | CallerReference: nowStamp.toString(), 17 | Paths: { 18 | Quantity: 1, 19 | Items: [ 20 | srcKey.toString(), 21 | ] 22 | } 23 | } 24 | }; 25 | 26 | if (srcKey === "/index.html") { 27 | params = { 28 | DistributionId: process.env.DISTRIBUTION_ID, 29 | InvalidationBatch: { 30 | CallerReference: nowStamp.toString(), 31 | Paths: { 32 | Quantity: 2, 33 | Items: [ 34 | srcKey.toString(), 35 | "/" 36 | ] 37 | } 38 | } 39 | }; 40 | } 41 | 42 | //console.log("Invalidate Params => ", params); 43 | 44 | cloudfront.createInvalidation(params, function(err, data) { 45 | if (err) { 46 | console.log(err, err.stack); 47 | callback(true, { 48 | statusCode:200, 49 | body: "invalidateResults" 50 | }); 51 | } else { 52 | console.log("Invalidation Successful: ", data); 53 | callback(null, { 54 | statusCode:200, 55 | body: "invalidateResults" 56 | }); 57 | } 58 | }); 59 | 60 | }; 61 | -------------------------------------------------------------------------------- /sam-backend/invalidate-cloudfront-cache/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "invalidate-cloudfront-cache", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /sam-backend/move-to-production-bucket/index.js: -------------------------------------------------------------------------------- 1 | const AWS = require('aws-sdk'); 2 | const s3 = new AWS.S3({ apiVersion: '2006-03-01' }); 3 | const minify = require('html-minifier').minify; 4 | 5 | const compressAndWriteS3Object = async (f,k) => { 6 | 7 | // SET ContentType to HTML but check for Javascript 8 | let ct = 'text/html'; 9 | if (k.indexOf(".js") > -1) { 10 | ct = 'text/javascript'; 11 | } else if (k.indexOf(".css") > -1) { 12 | ct = 'text/css'; 13 | } 14 | 15 | let compressedBody = minify(f, { 16 | removeTagWhitespace: true, 17 | removeComments: true, 18 | collapseWhitespace: true, 19 | conservativeCollapse: true, 20 | minifyCSS: true, 21 | minifyJS: true, 22 | removeAttributeQuotes: true 23 | }); 24 | 25 | let putParams = { 26 | Body: compressedBody, 27 | Key: k, 28 | Bucket: process.env.DESTINATION_BUCKET, 29 | ContentType: ct, 30 | ACL: 'public-read' 31 | }; 32 | 33 | let putObjectPromise = s3.putObject(putParams).promise(); 34 | putObjectPromise.then(function(data) { 35 | console.log('Success'); 36 | }).catch(function(err) { 37 | console.log(err); 38 | }); 39 | 40 | return putObjectPromise; 41 | }; 42 | 43 | const getS3Object = async (k) => { 44 | 45 | let params = { 46 | Bucket: process.env.SOURCE_BUCKET, 47 | Key: k 48 | }; 49 | 50 | let data; 51 | try { 52 | data = await s3.getObject(params).promise(); 53 | return new Buffer.from(data.Body).toString("utf8"); 54 | } catch(err) { 55 | console.log('Error retrieving object', err); 56 | let blank = {}; 57 | return blank; 58 | } 59 | 60 | }; 61 | 62 | exports.handler = async (event, context, callback) => { 63 | 64 | let fileToCopy = await getS3Object(event.websiteKey); 65 | 66 | await compressAndWriteS3Object(fileToCopy, event.websiteKey); 67 | 68 | callback(null, event); 69 | 70 | }; -------------------------------------------------------------------------------- /sam-backend/move-to-production-bucket/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "move-to-production-bucket", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /sam-backend/put-dynamodb-object/index.js: -------------------------------------------------------------------------------- 1 | const AWS = require('aws-sdk'); 2 | AWS.config.update({ region: 'us-west-2' }); 3 | const docClient = new AWS.DynamoDB.DocumentClient({apiVersion: '2012-08-10'}); 4 | 5 | exports.handler = function (event, response, callback) { 6 | 7 | //console.log("event is ", event); 8 | 9 | let payload = JSON.parse(event.body); 10 | 11 | let updateParams = { 12 | TableName: process.env.TABLE_NAME, 13 | Item: payload 14 | }; 15 | 16 | docClient.put(updateParams, function(err, data) { 17 | if (err) { 18 | console.log(err); 19 | callback(null, { 20 | statusCode: 500, 21 | headers: { 22 | "Access-Control-Allow-Origin": "*" 23 | }, 24 | body: JSON.stringify(err) 25 | }); 26 | } else { 27 | console.log(data); 28 | callback(null, { 29 | statusCode: 200, 30 | headers: { 31 | "Access-Control-Allow-Origin": "*" 32 | }, 33 | body: JSON.stringify("Success!") 34 | }); 35 | } 36 | }); 37 | 38 | }; -------------------------------------------------------------------------------- /sam-backend/put-dynamodb-object/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "put-dynamodb-object", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /sam-backend/return-s3-post-policy/index.js: -------------------------------------------------------------------------------- 1 | const AWS = require('aws-sdk'); 2 | const s3 = new AWS.S3(); 3 | 4 | AWS.config.update({ 5 | accessKeyId: process.env.ACCESS_ID, 6 | secretAccessKey: process.env.ACCESS_KEY, 7 | region: process.env.REGION, 8 | signatureVersion: 'v4', 9 | }); 10 | 11 | 12 | exports.handler = async (event, context, callback) => { 13 | 14 | let params = { 15 | Bucket: process.env.UPLOAD_BUCKET, 16 | Fields: { 17 | key: event.queryStringParameters.fileName 18 | } 19 | }; 20 | 21 | s3.createPresignedPost(params, function(err, data) { 22 | if (err) { 23 | console.error('Presigning post data encountered an error', err); 24 | 25 | callback(true,{ 26 | statusCode:400, 27 | headers: { 28 | "Access-Control-Allow-Origin": "*" 29 | }, 30 | body:JSON.stringify(err) 31 | }); 32 | } else { 33 | console.log("data is ",data); 34 | 35 | callback(null,{ 36 | statusCode:200, 37 | headers: { 38 | "Access-Control-Allow-Origin": "*" 39 | }, 40 | body:JSON.stringify(data) 41 | }); 42 | 43 | } 44 | }); 45 | 46 | }; 47 | -------------------------------------------------------------------------------- /sam-backend/return-s3-post-policy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "return-s3-post-policy", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | --------------------------------------------------------------------------------